-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: replace help.md alias import with help file generator
- Loading branch information
1 parent
91d2dbd
commit 1e6f5a9
Showing
6 changed files
with
22 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,5 @@ test/tmp | |
test/typescript/typings | ||
perf/ | ||
.nyc_output/ | ||
|
||
cli/help.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
const { promises: fs } = require('fs'); | ||
const { resolve } = require('path'); | ||
|
||
async function generateHelpModule() { | ||
const mdFilename = resolve(__dirname, '../cli/help.md'); | ||
const mdContent = await fs.readFile(mdFilename, 'utf8'); | ||
|
||
const tsFilename = resolve(__dirname, '../cli/help.ts'); | ||
const tsContent = `import { version } from '../package.json'; | ||
export default \`${mdContent.replace('__VERSION__', '${version}').replace(/`/g, '\\`')}\`; | ||
`; | ||
await fs.writeFile(tsFilename, tsContent); | ||
} | ||
|
||
generateHelpModule(); |