Create files for android roadmap

This commit is contained in:
Kamran Ahmed
2023-10-24 20:57:54 +01:00
parent 5c69b05470
commit 498e03720f
111 changed files with 123 additions and 15 deletions
+13 -15
View File
@@ -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) {
@@ -0,0 +1 @@
# Kotlin
@@ -0,0 +1 @@
# Java
@@ -0,0 +1 @@
# Pick a language
@@ -0,0 +1 @@
# Development ide
@@ -0,0 +1 @@
# Basics of kotlin
@@ -0,0 +1 @@
# Basics of oop
@@ -0,0 +1 @@
# Datastructures and algorithms
@@ -0,0 +1 @@
# Using gradle
@@ -0,0 +1 @@
# Hello world app
@@ -0,0 +1 @@
# The fundamentals
@@ -0,0 +1 @@
# Git
@@ -0,0 +1 @@
# Github
@@ -0,0 +1 @@
# Bitbucket
@@ -0,0 +1 @@
# Gitlab
@@ -0,0 +1 @@
# Version control
@@ -0,0 +1 @@
# Activity lifecycle
@@ -0,0 +1 @@
# Tasks backstack
@@ -0,0 +1 @@
# Activity
@@ -0,0 +1 @@
# Services
@@ -0,0 +1 @@
# Content provider
@@ -0,0 +1 @@
# Broadcast receiver
@@ -0,0 +1 @@
# Implicit intents
@@ -0,0 +1 @@
# Explicit intents
@@ -0,0 +1 @@
# Intent filters
@@ -0,0 +1 @@
# Intent
@@ -0,0 +1 @@
# App components
@@ -0,0 +1 @@
# Jetpack compose
@@ -0,0 +1 @@
# App shortcuts
@@ -0,0 +1 @@
# Navigation components
@@ -0,0 +1 @@
# Interface and navigation
@@ -0,0 +1 @@
# Repository pattern
@@ -0,0 +1 @@
# Builder pattern
@@ -0,0 +1 @@
# Observer pattern
@@ -0,0 +1 @@
# Dependency injection
@@ -0,0 +1 @@
# Factory pattern
@@ -0,0 +1 @@
# Architectural patterns
@@ -0,0 +1 @@
# Design architecture
@@ -0,0 +1 @@
# Shared preferences
@@ -0,0 +1 @@
# Datastore
@@ -0,0 +1 @@
# Room
@@ -0,0 +1 @@
# File system
@@ -0,0 +1 @@
# Storage
@@ -0,0 +1 @@
# Retrofit
@@ -0,0 +1 @@
# Okhttp
@@ -0,0 +1 @@
# Apollo android
@@ -0,0 +1 @@
# Network
@@ -0,0 +1 @@
# Coroutines
@@ -0,0 +1 @@
# Threads
@@ -0,0 +1 @@
# Rxjava
@@ -0,0 +1 @@
# Rxkotlin
@@ -0,0 +1 @@
# Work manager
@@ -0,0 +1 @@
# Asynchronism
@@ -0,0 +1 @@
# Firebase
@@ -0,0 +1 @@
# Google admob
@@ -0,0 +1 @@
# Google play services
@@ -0,0 +1 @@
# Google maps
@@ -0,0 +1 @@
# Common services
@@ -0,0 +1 @@
# Ktlint
@@ -0,0 +1 @@
# Detekt
@@ -0,0 +1 @@
# Linting
@@ -0,0 +1 @@
# Timber
@@ -0,0 +1 @@
# Leak canary

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