Skip to content

starting generate JSON file for module#99

Open
emmadal wants to merge 1 commit intomasterfrom
emmanueldalougou/nan-13-parse-markdown-and-generate-json-file
Open

starting generate JSON file for module#99
emmadal wants to merge 1 commit intomasterfrom
emmanueldalougou/nan-13-parse-markdown-and-generate-json-file

Conversation

@emmadal
Copy link
Copy Markdown
Contributor

@emmadal emmadal commented Oct 29, 2021

No description provided.

@linear
Copy link
Copy Markdown

linear Bot commented Oct 29, 2021

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 62d0226
Status: ✅  Deploy successful!
Preview URL: https://307fafbb.platform-nan-dev-8sl.pages.dev

View logs

Comment thread dev/build.js
process.env.HASH = `unk@${now.toString(36)}`
}

export const modJsDir = () => readdir(join(rootDir, 'js-module'))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pas convaincu de l'utilite de cette fonction, elle abstrait les mauvaise chose a mon avis.

A la limite fait un readdirFromRoot = path => readdir(join(rootDir, path))
Mais franchement on gagne pas grand chose vs juste faire le call

Comment thread dev/build.js
}),
)
return entries
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pareil, pas sur que ca soit specialement une bonne abstraction, a la limite faire un readdirContent:

const readdirContent = path => {
   const files = readdir(join(rootDir, path))
   const pendingEntries = files.map(async (fileName) => [
     fileName,
     await readFile(join(rootDir, path, fileName)),
   ])
   return Promise.all(pendingEntries)
}

Plus generique et re-utilisable, et tu fait la passe de markdown apres

Comment thread dev/module-parser.js
})

await (await readdir(rootDir))
.filter((filename) => filename.includes('module.json'))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.endsWith plutot que .includes la

Comment thread dev/module-parser.js
const modulebundle = await bundleJSONDir('modulebundle')
dirList.map(async (file) => {
const data = Object.fromEntries(entries)[file]
await writeFile(`${file.split('.md')[0]}.json`, JSON.stringify(data))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file.split('.md')[0]}.json toujours pas une tres bonne facon d'extraire l'extension


- variables
- data types
- console
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya pas de markdown vraiment a parser pour les modules, tu peu gerer un README mais la il aura pas ce genre de contenu, juste une description libre.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants