generate-react-cli 7.0.0 → 7.0.5

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,26 @@
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.5](https://github.com/arminbro/generate-react-cli/compare/v7.0.4...v7.0.5) (2022-01-17)
6
+
7
+ ### [7.0.4](https://github.com/arminbro/generate-react-cli/compare/v7.0.3...v7.0.4) (2021-08-07)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **story:** use storybook codemod's preferred way ([b694f76](https://github.com/arminbro/generate-react-cli/commit/b694f767d5619b2880f3d8aa143b7e9f2550ff11))
13
+
14
+ ### [7.0.3](https://github.com/arminbro/generate-react-cli/compare/v7.0.2...v7.0.3) (2021-06-12)
15
+
16
+ ### [7.0.2](https://github.com/arminbro/generate-react-cli/compare/v7.0.1...v7.0.2) (2021-06-12)
17
+
18
+ ### [7.0.1](https://github.com/arminbro/generate-react-cli/compare/v7.0.0...v7.0.1) (2021-06-12)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * remove camelCase from componentTestTemplateGenerator, it's handled in generateComponent ([7885d22](https://github.com/arminbro/generate-react-cli/commit/7885d22b816de7a60e2adcb3d977c1b541db1ae9)), closes [#43](https://github.com/arminbro/generate-react-cli/issues/43)
24
+
5
25
  ## [7.0.0](https://github.com/arminbro/generate-react-cli/compare/v6.0.2...v7.0.0) (2021-05-06)
6
26
 
7
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generate-react-cli",
3
- "version": "7.0.0",
3
+ "version": "7.0.5",
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": "^8.1.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,7 @@ 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.
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. You can also use the keyword `templateName`, which will be replaced with your component name in camelCase.
225
227
 
226
228
  #### Example of using the `customTemplates` object within your generate-react-cli.json config file:
227
229
 
@@ -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: React.FC = () => (
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>
@@ -194,7 +194,7 @@ function componentTestTemplateGenerator({ cliConfigFile, cmd, componentName }) {
194
194
 
195
195
  template = componentTestEnzymeTemplate;
196
196
  } else if (testLibrary === 'Testing Library') {
197
- template = componentTestTestingLibraryTemplate.replace(/#|templateName/g, camelCase(componentName));
197
+ template = componentTestTestingLibraryTemplate;
198
198
  } else {
199
199
  template = componentTestDefaultTemplate;
200
200
  }
@@ -365,6 +365,14 @@ function generateComponent(componentName, cmd, cliConfigFile) {
365
365
  silent: true,
366
366
  });
367
367
 
368
+ replace({
369
+ regex: 'templateName',
370
+ replacement: camelCase(componentName),
371
+ paths: [componentPath],
372
+ recursive: false,
373
+ silent: true,
374
+ });
375
+
368
376
  console.log(chalk.green(`${filename} was successfully created at ${componentPath}`));
369
377
  } catch (error) {
370
378
  console.error(chalk.red(`${filename} failed and was not created.`));