From 58ca5ed09230b2b5cc6a07a701c46371cd4bee0b Mon Sep 17 00:00:00 2001 From: Christian Varisco Date: Wed, 6 Dec 2017 12:02:35 +0100 Subject: [PATCH 1/3] Add args parameters merge with configs --- package-lock.json | 8 ++++---- package.json | 2 +- src/files.js | 1 - src/index.js | 5 ++++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9e40c46..41bfd63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "create-component-app", - "version": "1.4.1", + "version": "1.4.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1231,9 +1231,9 @@ } }, "chalk": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.2.0.tgz", - "integrity": "sha512-0BMM/2hG3ZaoPfR6F+h/oWpZtsh3b/s62TjSM6MGCJWEbJDN1acqCXvyhhZsDSVFklpebUoQ5O1kKC7lOzrn9g==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", + "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", "requires": { "ansi-styles": "3.2.0", "escape-string-regexp": "1.0.5", diff --git a/package.json b/package.json index 2222c4b..a9a1cb8 100644 --- a/package.json +++ b/package.json @@ -48,4 +48,4 @@ "mock-fs": "^3.12.1", "npm-watch": "^0.1.7" } -} \ No newline at end of file +} diff --git a/src/files.js b/src/files.js index 1429882..f41bd3e 100644 --- a/src/files.js +++ b/src/files.js @@ -51,7 +51,6 @@ function generateFileName(newFilePath, newFileName, templateFileName) { if (templateFileName.includes('COMPONENT_NAME')) { return templateFileName.replace(/COMPONENT_NAME/g, newFileName) } - console.log(templateFileName) return templateFileName } diff --git a/src/index.js b/src/index.js index c27e383..5c0c528 100644 --- a/src/index.js +++ b/src/index.js @@ -19,7 +19,10 @@ import { import { questions } from './questions' const args = yargs.argv -const config = getConfig(args.config) +const config = { + ...getConfig(args.config), + ...args, +} async function getTemplatesPath(templateName = null) { const { templatesDirPath } = config From d95aeaca38cfffe9268b519602abec860ba06a3a Mon Sep 17 00:00:00 2001 From: Christian Varisco Date: Wed, 6 Dec 2017 13:10:26 +0100 Subject: [PATCH 2/3] Change version --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a9a1cb8..fdb8703 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-component-app", - "version": "1.4.2", + "version": "1.5.0", "description": "Tool to generate different types of React components from the terminal.", "bin": { "create-component-app": "./dist/index.js" @@ -48,4 +48,4 @@ "mock-fs": "^3.12.1", "npm-watch": "^0.1.7" } -} +} \ No newline at end of file From abdf9f4f82ff2ab387ada0cacbcc4eed3c360a54 Mon Sep 17 00:00:00 2001 From: Christian Varisco Date: Thu, 7 Dec 2017 21:05:34 +0100 Subject: [PATCH 3/3] Add documentation --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 21d5c6e..9afa538 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,14 @@ $ create-component-app --config path/to/your/config.json **Passing a config file via the CLI overrides the configuration file loaded by [cosmiconfig](https://github.com/davidtheclark/cosmiconfig)** +### You can pass params from the command line + +```sh +$ create-component-app --path path/destionation +``` + +**Passing a param via the CLI overrides the configuration file loaded by [cosmiconfig](https://github.com/davidtheclark/cosmiconfig)** + ### You can use your own custom templates Simple steps to create your own templates [docs/custom-templates](https://github.com/CVarisco/create-component-app/blob/master/docs/CUSTOM-TEMPLATES.md)