add-component
Advanced tools
Comparing version 2.4.1 to 2.5.0
@@ -59,3 +59,4 @@ const path = require('path') | ||
}, | ||
directory: './' | ||
directory: './', | ||
componentDirectory: true | ||
} |
@@ -33,2 +33,4 @@ #!/usr/bin/env node | ||
customConfig = require(path.resolve(customConfigPath)) | ||
} else if (fs.existsSync(path.resolve('./.add-component/config.js'))) { | ||
customConfig = require(path.resolve('./.add-component/config.js')) | ||
} | ||
@@ -126,3 +128,3 @@ | ||
function createComponent (name) { | ||
const rootDirectory = path.join(path.resolve(config.directory), name) | ||
const rootDirectory = config.componentDirectory ? path.join(path.resolve(config.directory), name) : path.resolve(config.directory) | ||
const createStore = program.store | ||
@@ -129,0 +131,0 @@ |
{ | ||
"name": "add-component", | ||
"version": "2.4.1", | ||
"version": "2.5.0", | ||
"description": "Create React Component CLI", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -148,5 +148,9 @@ # add-component | ||
If you store your configuration file by `.add-component/config.js` path, you do not need any additional parameter. Just | ||
Run the command as usual. | ||
If you want your configuration file to have another name or be in another folder, tell the command where it is: | ||
``` | ||
# Run with configuration | ||
$ add-react-component --config .add-component/config.js Example | ||
$ add-react-component --config configs/addcomponent-config.js Example | ||
@@ -204,4 +208,22 @@ # Example of configuration | ||
##### Path configuration | ||
You can define a directory for your components. By default it is the root of your project. | ||
``` | ||
module.exports = { | ||
directory: './src' | ||
} | ||
``` | ||
You can choose not to have a directory for every component but put the files for all the components into the same source | ||
folder. In this case, also configure the naming schemas for all the technologies so that all the files for different | ||
components contain the component name and do not overwrite each other. | ||
``` | ||
module.exports = { | ||
componentDirectory: false | ||
} | ||
``` | ||
## License | ||
MIT © [Jack Hanford](http://jackhanford.com) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17877
411
228
13