generate-react-cli 7.0.2 → 7.0.6

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/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [7.0.6](https://github.com/arminbro/generate-react-cli/compare/v7.0.5...v7.0.6) (2022-02-21)
6
+
7
+ ### [7.0.5](https://github.com/arminbro/generate-react-cli/compare/v7.0.4...v7.0.5) (2022-01-17)
8
+
9
+ ### [7.0.4](https://github.com/arminbro/generate-react-cli/compare/v7.0.3...v7.0.4) (2021-08-07)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **story:** use storybook codemod's preferred way ([b694f76](https://github.com/arminbro/generate-react-cli/commit/b694f767d5619b2880f3d8aa143b7e9f2550ff11))
15
+
16
+ ### [7.0.3](https://github.com/arminbro/generate-react-cli/compare/v7.0.2...v7.0.3) (2021-06-12)
17
+
5
18
  ### [7.0.2](https://github.com/arminbro/generate-react-cli/compare/v7.0.1...v7.0.2) (2021-06-12)
6
19
 
7
20
  ### [7.0.1](https://github.com/arminbro/generate-react-cli/compare/v7.0.0...v7.0.1) (2021-06-12)
@@ -19,7 +19,7 @@ const isNotValidNodeVersion = () => {
19
19
  return false;
20
20
  };
21
21
 
22
- // --- Check if user is running Node 10 or higher.
22
+ // --- Check if user is running Node 12 or higher.
23
23
 
24
24
  if (isNotValidNodeVersion()) {
25
25
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generate-react-cli",
3
- "version": "7.0.2",
3
+ "version": "7.0.6",
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",
@@ -38,23 +38,23 @@
38
38
  "release": "standard-version"
39
39
  },
40
40
  "dependencies": {
41
- "chalk": "^4.1.0",
42
- "commander": "^7.1.0",
41
+ "chalk": "^4.1.2",
42
+ "commander": "^9.0.0",
43
43
  "deep-keys": "^0.5.0",
44
44
  "fs-extra": "^10.0.0",
45
- "inquirer": "^8.0.0",
45
+ "inquirer": "^8.1.2",
46
46
  "lodash": "^4.17.20",
47
47
  "replace": "^1.2.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "cz-conventional-changelog": "^3.3.0",
51
- "eslint": "^7.20.0",
52
- "eslint-config-airbnb-base": "^14.2.1",
51
+ "eslint": "^8.7.0",
52
+ "eslint-config-airbnb-base": "^15.0.0",
53
53
  "eslint-config-prettier": "^8.3.0",
54
- "eslint-plugin-prettier": "^3.3.1",
55
- "prettier": "2.2.1",
54
+ "eslint-plugin-prettier": "^4.0.0",
55
+ "prettier": "2.5.1",
56
56
  "rimraf": "^3.0.2",
57
- "standard-version": "^9.1.0"
57
+ "standard-version": "^9.3.1"
58
58
  },
59
59
  "config": {
60
60
  "commitizen": {
package/readme.md CHANGED
@@ -13,6 +13,8 @@ To help speed up productivity in React projects and stop copying, pasting, and r
13
13
 
14
14
  A short [article](https://dev.to/arminbro/generate-react-cli-1ooh) that goes a little deeper into why we created GRC if you have the time.
15
15
 
16
+ Suppose you enjoy learning by watching tutorial videos. Here's an excellent [video](https://www.youtube.com/watch?v=NEvnt3MWttY) on how to use GRC by [Eric Murphy](https://www.youtube.com/channel/UC5KDiSAFxrDWhmysBcNqtMA).
17
+
16
18
  **_A few notes:_**
17
19
 
18
20
  - Now supports custom component types ([read more](#custom-component-types)). 🎉
@@ -221,7 +223,15 @@ There is an optional `customTemplates` object that you can pass to the `componen
221
223
  },
222
224
  ```
223
225
 
224
- The keys represent the type of file, and the values are the paths that point to where your custom template lives in your project/system. Please note the `TemplateName` keyword in the template filename. GRC will use this keyword and replace it with your component name as the filename. You can also use the keyword `templateName`, which will be replaced with your component name in camelCase.
226
+ The keys represent the type of file, and the values are the paths that point to where your custom template lives in your project/system. Please note the `TemplateName` keyword in the template filename. GRC will use this keyword and replace it with your component name as the filename.
227
+
228
+ You can also use the following keywords, which will be replaced with their corresponding formatted component name:
229
+
230
+ | Keyword | Replacement |
231
+ |-----------------|------------------------------|
232
+ | `templateName` | component name in camelCase |
233
+ | `template-name` | component name in kebab-case |
234
+ | `template_name` | component name in snake_case |
225
235
 
226
236
  #### Example of using the `customTemplates` object within your generate-react-cli.json config file:
227
237
 
@@ -1,7 +1,13 @@
1
1
  module.exports = `/* eslint-disable */
2
- import React from 'react';
3
- import { storiesOf } from '@storybook/react';
4
2
  import TemplateName from './TemplateName';
5
3
 
6
- storiesOf('TemplateName', module).add('default', () => <TemplateName />);
4
+ export default {
5
+ title: "TemplateName",
6
+ };
7
+
8
+ export const Default = () => <TemplateName />;
9
+
10
+ Default.story = {
11
+ name: 'default',
12
+ };
7
13
  `;
@@ -1,7 +1,9 @@
1
- module.exports = `import React from 'react';
1
+ module.exports = `import React, { FC } from 'react';
2
2
  import styles from './TemplateName.module.css';
3
3
 
4
- const TemplateName = () => (
4
+ interface TemplateNameProps {}
5
+
6
+ const TemplateName: FC<TemplateNameProps> = () => (
5
7
  <div className={styles.TemplateName} data-testid="TemplateName">
6
8
  TemplateName Component
7
9
  </div>
@@ -1,7 +1,7 @@
1
1
  const chalk = require('chalk');
2
2
  const path = require('path');
3
3
  const replace = require('replace');
4
- const { camelCase } = require('lodash');
4
+ const { camelCase, kebabCase, snakeCase } = require('lodash');
5
5
  const { existsSync, outputFileSync, readFileSync } = require('fs-extra');
6
6
 
7
7
  const componentJsTemplate = require('../templates/component/componentJsTemplate');
@@ -373,6 +373,22 @@ function generateComponent(componentName, cmd, cliConfigFile) {
373
373
  silent: true,
374
374
  });
375
375
 
376
+ replace({
377
+ regex: 'template-name',
378
+ replacement: kebabCase(componentName),
379
+ paths: [componentPath],
380
+ recursive: false,
381
+ silent: true,
382
+ });
383
+
384
+ replace({
385
+ regex: 'template_name',
386
+ replacement: snakeCase(componentName),
387
+ paths: [componentPath],
388
+ recursive: false,
389
+ silent: true,
390
+ });
391
+
376
392
  console.log(chalk.green(`${filename} was successfully created at ${componentPath}`));
377
393
  } catch (error) {
378
394
  console.error(chalk.red(`${filename} failed and was not created.`));