init/node-cli
Initializes a NodeJS based CLI project
Usage
npx @lukasbach/scripts init/node-cli
You can call the script directly if you have installed it globally:
npm i -g @lukasbach/scripts
ldo init/node-cli
Arguments
[0]: Repository name
Options
--name,-n: What is the name of the package?--description,-d: What is the description of the package?--topics: What are the tags of the package (comma seperated)?--author,-a: What is the author of the package?--license,-l: What is the license of the package?--funding,-f: Do you want to add funding information to the package.json?--name,-n: What is the name of the package?--description,-d: What is the description of the package?--topics: What are the tags of the package (comma seperated)?--author,-a: What is the author of the package?--license,-l: What is the license of the package?--funding,-f: Do you want to add funding information to the package.json?--path: Where do you want to create the project?--bin-folder: Where should the binary be stored?--bin-folder: What is the name of the CLI?--commander-type: Which commander setup do you want?--push: Do you want to push local changes as initial commit?--git: Do you want to initialize a github repository?-v,--verbose: Verbose logging
You can also omit options, and will be asked for them interactively.
Add --yes to skip all confirmations.
Referenced scripts
node/yarn-nodemodulesnode/configure-npm-reponode/setup-empty-yarnnode/voltanode/setup-publish-fastnode/setup-commandergithub/setup-node-verify-actionnode/normalize-package-jsongithub/create-from-local
Script source
/** Initializes a NodeJS based CLI project */
// TODO cd between scripts doesnt yet properly work
await utils.runScript("node/setup-empty-yarn");
await utils.runScript("node/volta");
await utils.runScript("node/setup-tsconfig", {
module: "nodenext",
resolution: "nodenext",
target: "es2021",
lib: "es2021",
emit: "Source and Declaration",
});
if (await ask.confirm("Do you want to use eslint with my default config?")) {
await utils.runScript("node/setup-eslint", { rule: "@lukasbach/base" });
}
if (await ask.confirm("Do you want to use publish-fast for releasing?")) {
await utils.runScript("node/setup-publish-fast");
}
await utils.runScript("node/setup-commander");
await utils.runScript("github/setup-node-verify-action");
await utils.runScript("node/normalize-package-json");
if (await ask.bool("git", "Do you want to initialize a github repository?")) {
await utils.runScript("github/create-from-local");
}