From d96992cd2d89786d3448d0dfe33bc04187dc2d94 Mon Sep 17 00:00:00 2001 From: Chen Asraf Date: Sun, 5 Dec 2021 00:49:10 +0200 Subject: [PATCH] update deps + update cmd requirements --- README.md | 16 +++++++++------- package.json | 4 ++-- src/cmd_util.ts | 38 ++++++++++++++++++++------------------ yarn.lock | 8 ++++---- 4 files changed, 35 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index dceb9bd..4429165 100644 --- a/README.md +++ b/README.md @@ -240,10 +240,11 @@ If you are a developer and want to contribute code, here are some starting tips: 1. Fork this repository 2. Run `yarn install` -3. Make any changes you would like -4. Create tests for your changes, is possible -5. Update the relevant documentation (readme, code comments, type comments) -6. Create a PR on upstream +3. Run `yarn dev` to start file watch mode +4. Make any changes you would like +5. Create tests for your changes +6. Update the relevant documentation (readme, code comments, type comments) +7. Create a PR on upstream Some tips on getting around the code: @@ -253,6 +254,7 @@ Some tips on getting around the code: - Use `yarn test` to run tests - Use `yarn cmd` to use the CLI feature of Simple Scaffold from within the root directory, enabling you to test different behaviors. See `yarn cmd -h` for more information. - This requires an updated build, and does not trigger one itself. Either use `yarn dev` or - `yarn build` before running this, or use `yarn build-cmd` instead, which builds before running - the cmd with args. + + > This requires an updated build, and does not trigger one itself. Either use `yarn dev` or + > `yarn build` before running this, or use `yarn build-cmd` instead, which triggers a build right + > before running the command with the rest of the given arguments. diff --git a/package.json b/package.json index 3334478..2fd43fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-scaffold", - "version": "1.0.0-alpha.11", + "version": "1.0.0-alpha.12", "description": "Create files based on templates", "repository": "https://github.com/chenasraf/simple-scaffold.git", "author": "Chen Asraf ", @@ -23,7 +23,7 @@ "glob": "^7.1.3", "handlebars": "^4.7.7", "lodash": "^4.17.21", - "massarg": "^1.0.3", + "massarg": "^1.0.4", "util.promisify": "^1.1.1" }, "devDependencies": { diff --git a/src/cmd_util.ts b/src/cmd_util.ts index 77315e7..62e2618 100644 --- a/src/cmd_util.ts +++ b/src/cmd_util.ts @@ -10,67 +10,69 @@ export function parseCliArgs(args = process.argv.slice(2)) { .option({ name: "name", aliases: ["n"], - isDefault: true, description: "Name to be passed to the generated files. {{name}} and {{Name}} inside contents and file names will be replaced accordingly.", + isDefault: true, + required: true, }) .option({ name: "output", aliases: ["o"], description: "Path to output to. If --create-sub-folder is enabled, the subfolder will be created inside this path.", + required: true, }) .option({ name: "templates", aliases: ["t"], + array: true, description: "Template files to use as input. You may provide multiple files, each of which can be a relative or absolute path, " + "or a glob pattern for multiple file matching easily.", - defaultValue: [], - array: true, + required: true, }) .option({ - aliases: ["w"], name: "overwrite", - description: "Enable to override output files, even if they already exist.", - defaultValue: false, + aliases: ["w"], boolean: true, + defaultValue: false, + description: "Enable to override output files, even if they already exist.", }) .option({ - aliases: ["d"], name: "data", + aliases: ["d"], description: "Add custom data to the templates. By default, only your app name is included.", parse: (v) => JSON.parse(v), }) .option({ - aliases: ["s"], name: "create-sub-folder", + aliases: ["s"], + boolean: true, + defaultValue: false, description: "Create subfolder with the input name", - defaultValue: false, - boolean: true, }) .option({ - aliases: ["q"], name: "quiet", - description: "Suppress output logs (Same as --verbose 0)", - defaultValue: false, + aliases: ["q"], boolean: true, + defaultValue: false, + description: "Suppress output logs (Same as --verbose 0)", }) .option({ - aliases: ["v"], name: "verbose", - description: `Determine amount of logs to display. The values are: ${chalk.bold`0 (none) | 1 (debug) | 2 (info) | 3 (warn) | 4 (error)`}. The provided level will display messages of the same level or higher.`, + aliases: ["v"], defaultValue: LogLevel.Info, + description: `Determine amount of logs to display. The values are: ${chalk.bold`0 (none) | 1 (debug) | 2 (info) | 3 (warn) | 4 (error)`}. The provided level will display messages of the same level or higher.`, parse: Number, }) .option({ - aliases: ["dr"], name: "dry-run", + aliases: ["dr"], + boolean: true, + defaultValue: false, description: "Don't emit files. This is good for testing your scaffolds and making sure they " + "don't fail, without having to write actual file contents or create directories.", - defaultValue: false, - boolean: true, }) // .example({ // input: `yarn cmd -t examples/test-input/Component -o examples/test-output -d '{"property":"myProp","value":"10"}'`, diff --git a/yarn.lock b/yarn.lock index ffdce86..24f656d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2161,10 +2161,10 @@ makeerror@1.0.x: dependencies: tmpl "1.0.x" -massarg@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/massarg/-/massarg-1.0.3.tgz#228cf2d84896924b6b12021ea23ed9a9077e15b7" - integrity sha512-LYb4XvAQ+PbBClyfkn9B4JtfwycfpnOnGIznALt9YLnrmQaCcXXJBQsG5SA/2w+bmLOeYRoR9GqqFLyaniCn9g== +massarg@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/massarg/-/massarg-1.0.4.tgz#8756193bee9bc7331b1f48a8840e86acf808f980" + integrity sha512-SakImNzZP8SN6tlcGBoC62z+12yv/To+h7KP8XapnOux5Mjiwprn4KhNHsjh2rbrKCAPqZQWYziAitSzGTkjMw== dependencies: chalk "^4.1.1" lodash "^4.17.21"