Create files for android roadmap

pull/4628/head
Kamran Ahmed 1 year ago
parent 5c69b05470
commit 498e03720f
  1. 28
      scripts/roadmap-content.cjs
  2. 1
      src/data/roadmaps/android/content/100-pick-a-language/100-kotlin.md
  3. 1
      src/data/roadmaps/android/content/100-pick-a-language/101-java.md
  4. 1
      src/data/roadmaps/android/content/100-pick-a-language/index.md
  5. 1
      src/data/roadmaps/android/content/101-the-fundamentals/100-development-ide.md
  6. 1
      src/data/roadmaps/android/content/101-the-fundamentals/101-basics-of-kotlin.md
  7. 1
      src/data/roadmaps/android/content/101-the-fundamentals/102-basics-of-oop.md
  8. 1
      src/data/roadmaps/android/content/101-the-fundamentals/103-datastructures-and-algorithms.md
  9. 1
      src/data/roadmaps/android/content/101-the-fundamentals/104-using-gradle.md
  10. 1
      src/data/roadmaps/android/content/101-the-fundamentals/105-hello-world-app.md
  11. 1
      src/data/roadmaps/android/content/101-the-fundamentals/index.md
  12. 1
      src/data/roadmaps/android/content/102-version-control/100-git.md
  13. 1
      src/data/roadmaps/android/content/102-version-control/101-github.md
  14. 1
      src/data/roadmaps/android/content/102-version-control/102-bitbucket.md
  15. 1
      src/data/roadmaps/android/content/102-version-control/103-gitlab.md
  16. 1
      src/data/roadmaps/android/content/102-version-control/index.md
  17. 1
      src/data/roadmaps/android/content/103-app-components/100-activity/100-activity-lifecycle.md
  18. 1
      src/data/roadmaps/android/content/103-app-components/100-activity/101-state-changes.md
  19. 1
      src/data/roadmaps/android/content/103-app-components/100-activity/102-tasks-backstack.md
  20. 1
      src/data/roadmaps/android/content/103-app-components/100-activity/index.md
  21. 1
      src/data/roadmaps/android/content/103-app-components/101-services.md
  22. 1
      src/data/roadmaps/android/content/103-app-components/102-content-provider.md
  23. 1
      src/data/roadmaps/android/content/103-app-components/103-broadcast-receiver.md
  24. 1
      src/data/roadmaps/android/content/103-app-components/104-intent/100-implicit-intents.md
  25. 1
      src/data/roadmaps/android/content/103-app-components/104-intent/101-explicit-intents.md
  26. 1
      src/data/roadmaps/android/content/103-app-components/104-intent/102-intent-filters.md
  27. 1
      src/data/roadmaps/android/content/103-app-components/104-intent/index.md
  28. 1
      src/data/roadmaps/android/content/103-app-components/index.md
  29. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/100-jetpack-compose.md
  30. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/101-app-shortcuts.md
  31. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/102-navigation-components.md
  32. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/elements/100-text-view.md
  33. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/elements/101-edit-text.md
  34. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/elements/102-buttons.md
  35. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/elements/103-image-view.md
  36. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/elements/104-list-view.md
  37. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/elements/105-tabs.md
  38. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/elements/106-fragments.md
  39. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/elements/107-dialogs.md
  40. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/elements/108-toast.md
  41. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/elements/109-bottom-sheet.md
  42. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/elements/110-drawer.md
  43. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/elements/111-animations.md
  44. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/elements/index.md
  45. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/index.md
  46. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/layouts/100-frame.md
  47. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/layouts/101-linear.md
  48. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/layouts/102-relative.md
  49. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/layouts/103-constraint.md
  50. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/layouts/104-recycle-view.md
  51. 1
      src/data/roadmaps/android/content/104-interface-and-navigation/layouts/index.md
  52. 1
      src/data/roadmaps/android/content/105-design-architecture/100-repository-pattern.md
  53. 1
      src/data/roadmaps/android/content/105-design-architecture/101-builder-pattern.md
  54. 1
      src/data/roadmaps/android/content/105-design-architecture/102-observer-pattern/100-flow.md
  55. 1
      src/data/roadmaps/android/content/105-design-architecture/102-observer-pattern/101-rxjava.md
  56. 1
      src/data/roadmaps/android/content/105-design-architecture/102-observer-pattern/102-rxkotlin.md
  57. 1
      src/data/roadmaps/android/content/105-design-architecture/102-observer-pattern/103-livedata.md
  58. 1
      src/data/roadmaps/android/content/105-design-architecture/102-observer-pattern/index.md
  59. 1
      src/data/roadmaps/android/content/105-design-architecture/103-dependency-injection/100-dagger.md
  60. 1
      src/data/roadmaps/android/content/105-design-architecture/103-dependency-injection/101-hilt.md
  61. 1
      src/data/roadmaps/android/content/105-design-architecture/103-dependency-injection/102-koin.md
  62. 1
      src/data/roadmaps/android/content/105-design-architecture/103-dependency-injection/103-kodein.md
  63. 1
      src/data/roadmaps/android/content/105-design-architecture/103-dependency-injection/index.md
  64. 1
      src/data/roadmaps/android/content/105-design-architecture/104-factory-pattern.md
  65. 1
      src/data/roadmaps/android/content/105-design-architecture/architectural-patterns/100-mvi.md
  66. 1
      src/data/roadmaps/android/content/105-design-architecture/architectural-patterns/101-mvvm.md
  67. 1
      src/data/roadmaps/android/content/105-design-architecture/architectural-patterns/102-mvp.md
  68. 1
      src/data/roadmaps/android/content/105-design-architecture/architectural-patterns/103-mvc.md
  69. 1
      src/data/roadmaps/android/content/105-design-architecture/architectural-patterns/index.md
  70. 1
      src/data/roadmaps/android/content/105-design-architecture/index.md
  71. 1
      src/data/roadmaps/android/content/106-storage/100-shared-preferences.md
  72. 1
      src/data/roadmaps/android/content/106-storage/101-datastore.md
  73. 1
      src/data/roadmaps/android/content/106-storage/102-room.md
  74. 1
      src/data/roadmaps/android/content/106-storage/103-file-system.md
  75. 1
      src/data/roadmaps/android/content/106-storage/index.md
  76. 1
      src/data/roadmaps/android/content/107-network/100-retrofit.md
  77. 1
      src/data/roadmaps/android/content/107-network/101-okhttp.md
  78. 1
      src/data/roadmaps/android/content/107-network/102-apollo-android.md
  79. 1
      src/data/roadmaps/android/content/107-network/index.md
  80. 1
      src/data/roadmaps/android/content/108-asynchronism/100-coroutines.md
  81. 1
      src/data/roadmaps/android/content/108-asynchronism/101-threads.md
  82. 1
      src/data/roadmaps/android/content/108-asynchronism/102-rxjava.md
  83. 1
      src/data/roadmaps/android/content/108-asynchronism/103-rxkotlin.md
  84. 1
      src/data/roadmaps/android/content/108-asynchronism/104-work-manager.md
  85. 1
      src/data/roadmaps/android/content/108-asynchronism/index.md
  86. 1
      src/data/roadmaps/android/content/109-common-services/100-firebase/100-authentication.md
  87. 1
      src/data/roadmaps/android/content/109-common-services/100-firebase/101-crashlytics.md
  88. 1
      src/data/roadmaps/android/content/109-common-services/100-firebase/102-remote-config.md
  89. 1
      src/data/roadmaps/android/content/109-common-services/100-firebase/103-cloud-messaging.md
  90. 1
      src/data/roadmaps/android/content/109-common-services/100-firebase/104-fire-store.md
  91. 1
      src/data/roadmaps/android/content/109-common-services/100-firebase/index.md
  92. 1
      src/data/roadmaps/android/content/109-common-services/101-google-admob.md
  93. 1
      src/data/roadmaps/android/content/109-common-services/102-google-play-services.md
  94. 1
      src/data/roadmaps/android/content/109-common-services/103-google-maps.md
  95. 1
      src/data/roadmaps/android/content/109-common-services/index.md
  96. 1
      src/data/roadmaps/android/content/110-linting/100-ktlint.md
  97. 1
      src/data/roadmaps/android/content/110-linting/101-detekt.md
  98. 1
      src/data/roadmaps/android/content/110-linting/index.md
  99. 1
      src/data/roadmaps/android/content/111-debugging/100-timber.md
  100. 1
      src/data/roadmaps/android/content/111-debugging/101-leak-canary.md
  101. Some files were not shown because too many files have changed in this diff Show More

@ -19,13 +19,12 @@ if (!allowedRoadmapIds.includes(roadmapId)) {
}
const ROADMAP_CONTENT_DIR = path.join(ALL_ROADMAPS_DIR, roadmapId, 'content');
const { Configuration, OpenAIApi } = require('openai');
const configuration = new Configuration({
const OpenAI = require('openai');
const openai = new OpenAI({
apiKey: OPEN_AI_API_KEY,
});
const openai = new OpenAIApi(configuration);
function getFilesInFolder(folderPath, fileList = {}) {
const files = fs.readdirSync(folderPath);
@ -60,16 +59,16 @@ function writeTopicContent(currTopicUrl) {
const roadmapTitle = roadmapId.replace(/-/g, ' ');
let prompt = `I am reading a guide about "${roadmapTitle}". I am on the topic "${parentTopic}". I want to know more about "${childTopic}". Write me a brief summary of that. Content should be in markdown. I already know the benefits of each so do not add benefits in the output. Also include the code examples if applicable to this topic.`;
let prompt = `I am reading a guide about "${roadmapTitle}". I am on the topic "${parentTopic}". I want to know more about "${childTopic}". Write me a brief paragraph for that. Content should be in markdown. I already know the benefits of each so do not add benefits in the output.`;
if (!childTopic) {
prompt = `I am reading a guide about "${roadmapTitle}". I am on the topic "${parentTopic}". I want to know more about "${parentTopic}". Write me with a brief summary of that. Content should be in markdown. I already know the benefits of each so do not add benefits in the output. Also include the code examples if applicable to this topic.`;
prompt = `I am reading a guide about "${roadmapTitle}". I am on the topic "${parentTopic}". I want to know more about "${parentTopic}". Write me a brief paragraph for that. Content should be in markdown. I already know the benefits of each so do not add benefits in the output.`;
}
console.log(`Generating '${childTopic || parentTopic}'...`);
return new Promise((resolve, reject) => {
openai
.createChatCompletion({
openai.chat.completions
.create({
model: 'gpt-4',
messages: [
{
@ -79,7 +78,7 @@ function writeTopicContent(currTopicUrl) {
],
})
.then((response) => {
const article = response.data.choices[0].message.content;
const article = response.choices[0].message.content;
resolve(article);
})
@ -92,7 +91,7 @@ function writeTopicContent(currTopicUrl) {
async function writeFileForGroup(group, topicUrlToPathMapping) {
const topicId = group?.properties?.controlName;
const topicTitle = group?.children?.controls?.control?.find(
(control) => control?.typeID === 'Label'
(control) => control?.typeID === 'Label',
)?.properties?.text;
const currTopicUrl = topicId?.replace(/^\d+-/g, '/')?.replace(/:/g, '/');
if (!currTopicUrl) {
@ -138,15 +137,14 @@ async function writeFileForGroup(group, topicUrlToPathMapping) {
async function run() {
const topicUrlToPathMapping = getFilesInFolder(ROADMAP_CONTENT_DIR);
const roadmapJson = require(path.join(
ALL_ROADMAPS_DIR,
`${roadmapId}/${roadmapId}`
));
const roadmapJson = require(
path.join(ALL_ROADMAPS_DIR, `${roadmapId}/${roadmapId}`),
);
const groups = roadmapJson?.mockup?.controls?.control?.filter(
(control) =>
control.typeID === '__group__' &&
!control.properties?.controlName?.startsWith('ext_link')
!control.properties?.controlName?.startsWith('ext_link'),
);
if (!OPEN_AI_API_KEY) {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save