generate-react-cli 7.1.1 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/readme.md +6 -5
- package/src/utils/generateComponentUtils.js +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generate-react-cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "A simple React CLI to generate components instantly and more.",
|
|
5
5
|
"repository": "https://github.com/arminbro/generate-react-cli",
|
|
6
6
|
"bugs": "https://github.com/arminbro/generate-react-cli/issues",
|
package/readme.md
CHANGED
|
@@ -235,11 +235,12 @@ The keys represent the type of file, and the values are the paths that point to
|
|
|
235
235
|
|
|
236
236
|
You can also use the following keywords, which will be replaced with their corresponding formatted component name:
|
|
237
237
|
|
|
238
|
-
| Keyword | Replacement
|
|
239
|
-
|
|
240
|
-
| `templateName` | component name in camelCase
|
|
241
|
-
| `template-name` | component name in kebab-case
|
|
242
|
-
| `template_name` | component name in snake_case
|
|
238
|
+
| Keyword | Replacement |
|
|
239
|
+
|-----------------|----------------------------------------|
|
|
240
|
+
| `templateName` | component name in camelCase |
|
|
241
|
+
| `template-name` | component name in kebab-case |
|
|
242
|
+
| `template_name` | component name in snake_case |
|
|
243
|
+
| `TEMPLATE_NAME` | component name in uppercase SNAKE_CASE |
|
|
243
244
|
|
|
244
245
|
#### Example of using the `customTemplates` object within your generate-react-cli.json config file:
|
|
245
246
|
|
|
@@ -389,6 +389,14 @@ function generateComponent(componentName, cmd, cliConfigFile) {
|
|
|
389
389
|
recursive: false,
|
|
390
390
|
silent: true,
|
|
391
391
|
});
|
|
392
|
+
|
|
393
|
+
replace({
|
|
394
|
+
regex: 'TEMPLATE_NAME',
|
|
395
|
+
replacement: snakeCase(componentName).toUpperCase(),
|
|
396
|
+
paths: [componentPath],
|
|
397
|
+
recursive: false,
|
|
398
|
+
silent: true,
|
|
399
|
+
});
|
|
392
400
|
}
|
|
393
401
|
|
|
394
402
|
console.log(chalk.green(`${filename} was successfully created at ${componentPath}`));
|