-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(create-tnf): bundle create-tnf (#83)
* chore(create-tnf): bundle create-tnf * chore: update pnpm-lock.yaml
- Loading branch information
Showing
15 changed files
with
87 additions
and
58 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
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
export { default as ConfirmPrompt } from './src/prompts/confirm.js'; | ||
export { default as GroupMultiSelectPrompt } from './src/prompts/group-multiselect.js'; | ||
export { default as MultiSelectPrompt } from './src/prompts/multi-select.js'; | ||
export { default as PasswordPrompt } from './src/prompts/password.js'; | ||
export { default as Prompt, isCancel } from './src/prompts/prompt.js'; | ||
export type { State } from './src/prompts/prompt.js'; | ||
export { default as SelectPrompt } from './src/prompts/select.js'; | ||
export { default as SelectKeyPrompt } from './src/prompts/select-key.js'; | ||
export { default as TextPrompt } from './src/prompts/text.js'; | ||
export { block } from './src/utils.js'; | ||
export { default as ConfirmPrompt } from './src/prompts/confirm'; | ||
export { default as GroupMultiSelectPrompt } from './src/prompts/group-multiselect'; | ||
export { default as MultiSelectPrompt } from './src/prompts/multi-select'; | ||
export { default as PasswordPrompt } from './src/prompts/password'; | ||
export { default as Prompt, isCancel } from './src/prompts/prompt'; | ||
export type { State } from './src/prompts/prompt'; | ||
export { default as SelectPrompt } from './src/prompts/select'; | ||
export { default as SelectKeyPrompt } from './src/prompts/select-key'; | ||
export { default as TextPrompt } from './src/prompts/text'; | ||
export { block } from './src/utils'; |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import assert from 'assert'; | ||
import 'zx/globals'; | ||
|
||
const compile = async () => { | ||
const mako = await import('@umijs/mako'); | ||
await mako.build({ | ||
config: { | ||
entry: { | ||
cli: './src/cli.ts', | ||
}, | ||
mode: 'production', | ||
devtool: false, | ||
output: { | ||
path: `./dist`, | ||
mode: 'bundle', | ||
}, | ||
platform: 'node', | ||
optimization: { | ||
// @ts-ignore | ||
concatenateModules: false, | ||
}, | ||
minify: false, | ||
cjs: true, | ||
}, | ||
root: process.cwd(), | ||
watch: false, | ||
}); | ||
|
||
// patch the output file | ||
// replace "src" with __dirname | ||
const outputFile = path.join(process.cwd(), 'dist/cli.js'); | ||
assert(fs.existsSync(outputFile), 'Output file not found'); | ||
const content = fs.readFileSync(outputFile, 'utf-8'); | ||
const newContent = content.replace(/"src"/g, `__dirname`); | ||
// make sure the new content has two "__dirname" | ||
assert(newContent.includes('__dirname'), 'Output file not patched correctly'); | ||
fs.writeFileSync(outputFile, newContent); | ||
console.log('Output file patched successfully'); | ||
}; | ||
|
||
(async () => { | ||
await compile(); | ||
})().catch(console.error); |