generator-reackt 0.3.2 → 0.5.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.
Files changed (44) hide show
  1. package/.prettierrc +4 -4
  2. package/.stylelintrc +104 -0
  3. package/LICENSE +9 -7
  4. package/README.md +18 -18
  5. package/generators/app/index.js +1 -307
  6. package/generators/component/index.js +1 -56
  7. package/generators/es.regexp.flags-ccfbed60.js +1 -0
  8. package/generators/module/index.js +1 -117
  9. package/generators/util/fs.js +1 -31
  10. package/package.json +33 -29
  11. package/templates/app/.babelrc +9 -9
  12. package/templates/app/.browserslistrc +3 -3
  13. package/templates/app/.editorconfig +11 -11
  14. package/templates/app/.esdoc.json +23 -23
  15. package/templates/app/.eslintrc.js +5 -13
  16. package/templates/app/.lintstagedrc +4 -4
  17. package/templates/app/.prettierrc +4 -4
  18. package/templates/app/.storybook/addons.js +1 -1
  19. package/templates/app/.storybook/config.js +14 -14
  20. package/templates/app/.storybook/webpack.config.babel.js +7 -7
  21. package/templates/app/.stylelintrc +271 -277
  22. package/templates/app/gitignore +2 -0
  23. package/templates/app/jest.config.js +15 -15
  24. package/templates/app/jsconfig.json +8 -8
  25. package/templates/app/package.json +18 -18
  26. package/templates/app/src/components/App.js +14 -0
  27. package/templates/app/src/icons.js +3 -3
  28. package/templates/app/src/index.html +10 -10
  29. package/templates/app/src/index.js +50 -54
  30. package/templates/app/src/index.scss +16 -17
  31. package/templates/app/src/reducers/application.js +21 -21
  32. package/templates/app/src/reducers/index.js +7 -7
  33. package/templates/app/src/sagas/application.js +9 -9
  34. package/templates/app/src/sagas/index.js +7 -7
  35. package/templates/app/src/selectors/application.js +1 -1
  36. package/templates/app/src/selectors/application.test.js +13 -13
  37. package/templates/app/src/utils/index.js +36 -32
  38. package/templates/app/webpack.config.babel.js +103 -109
  39. package/templates/component/index.js +19 -19
  40. package/templates/component/index.test.js +14 -14
  41. package/templates/module/reducer/index.js +20 -20
  42. package/templates/module/saga/index.js +9 -9
  43. package/CHANGELOG.md +0 -227
  44. package/templates/app/src/components/App/App.js +0 -19
@@ -1,117 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _path = require("path");
9
-
10
- var _fs = _interopRequireDefault(require("../util/fs"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- // we cannot use ES6 imports on this object, as it directly exports a class to
15
- // module.exports - no default export nor a named export is present for us to use
16
- const Generator = require('yeoman-generator');
17
-
18
- const src = (...paths) => (0, _path.join)('src', ...paths);
19
-
20
- class _default extends Generator {
21
- constructor(...args) {
22
- super(...args);
23
- this.sourceRoot((0, _path.join)(__dirname, '..', '..', 'templates', 'module'));
24
- this.answers = {};
25
- this.fileSystem = (0, _fs.default)(this);
26
- }
27
-
28
- async prompting() {
29
- this.answers = await this.prompt([{
30
- type: 'input',
31
- name: 'module.name',
32
- message: 'Module name'
33
- }, {
34
- type: 'list',
35
- name: 'directoryMode',
36
- message: 'Choose a way of structuring the module.',
37
- choices: [{
38
- name: 'Create a directory with the module name and an index.js file inside that.',
39
- value: 'dir',
40
- short: 'Directory'
41
- }, {
42
- name: 'Create a file with the module name.',
43
- value: 'file',
44
- short: 'File'
45
- }]
46
- }, {
47
- type: 'confirm',
48
- name: 'flags.createReducer',
49
- message: 'Generate a reducer?',
50
- default: true
51
- }, {
52
- type: 'confirm',
53
- name: 'flags.createSaga',
54
- message: 'Generate a saga?',
55
- default: true
56
- }, {
57
- type: 'confirm',
58
- name: 'flags.createSelector',
59
- message: 'Generate a selector?',
60
- default: true
61
- }, {
62
- type: 'confirm',
63
- name: 'flags.addJest',
64
- message: 'Generate test files?',
65
- default: true
66
- }]);
67
- }
68
-
69
- async writing() {
70
- const {
71
- directoryMode,
72
- module: {
73
- name
74
- },
75
- flags
76
- } = this.answers;
77
- this.log(`Creating module ${name}`);
78
-
79
- const buildPaths = ext => {
80
- const namePath = `${name}${ext}`;
81
- const indexPath = `index${ext}`;
82
- const destPath = [];
83
-
84
- switch (directoryMode) {
85
- default:
86
- case 'file':
87
- destPath.push(namePath);
88
- break;
89
-
90
- case 'dir':
91
- destPath.push(name, indexPath);
92
- break;
93
- }
94
-
95
- if (flags.createReducer) {
96
- this.fileSystem.copyTemplate((0, _path.join)('reducer', indexPath), src('reducers', ...destPath));
97
- }
98
-
99
- if (flags.createSaga) {
100
- this.fileSystem.copyTemplate((0, _path.join)('saga', indexPath), src('sagas', ...destPath));
101
- }
102
-
103
- if (flags.createSelector) {
104
- this.fileSystem.copyTemplate((0, _path.join)('selector', indexPath), src('selectors', ...destPath));
105
- }
106
- };
107
-
108
- buildPaths('.js');
109
-
110
- if (flags.addJest) {
111
- buildPaths('.test.js');
112
- }
113
- }
114
-
115
- }
116
-
117
- exports.default = _default;
1
+ "use strict";var e=require("path"),t=require("../util/fs.js");require("mkdirp");const a=require("yeoman-generator"),s=(...t)=>e.join("src",...t);module.exports=class extends a{constructor(...a){super(...a),this.sourceRoot(e.join(__dirname,"..","..","templates","module")),this.answers={},this.fileSystem=t(this)}async prompting(){this.answers=await this.prompt([{type:"input",name:"module.name",message:"Module name"},{type:"list",name:"directoryMode",message:"Choose a way of structuring the module.",choices:[{name:"Create a directory with the module name and an index.js file inside that.",value:"dir",short:"Directory"},{name:"Create a file with the module name.",value:"file",short:"File"}]},{type:"confirm",name:"flags.createReducer",message:"Generate a reducer?",default:!0},{type:"confirm",name:"flags.createSaga",message:"Generate a saga?",default:!0},{type:"confirm",name:"flags.createSelector",message:"Generate a selector?",default:!0},{type:"confirm",name:"flags.addJest",message:"Generate test files?",default:!0}])}async writing(){const{directoryMode:t,module:{name:a},flags:r}=this.answers;this.log(`Creating module ${a}`);const i=i=>{const o=`${a}${i}`,n=`index${i}`,c=[];switch(t){default:case"file":c.push(o);break;case"dir":c.push(a,n)}r.createReducer&&this.fileSystem.copyTemplate(e.join("reducer",n),s("reducers",...c)),r.createSaga&&this.fileSystem.copyTemplate(e.join("saga",n),s("sagas",...c)),r.createSelector&&this.fileSystem.copyTemplate(e.join("selector",n),s("selectors",...c))};i(".js"),r.addJest&&i(".test.js")}};
@@ -1,31 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _mkdirp = _interopRequireDefault(require("mkdirp"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- var _default = gen => ({
13
- copy: file => {
14
- gen.fs.copy(gen.templatePath(file), gen.destinationPath(file));
15
- },
16
- copyDirectory: async dir => {
17
- gen.fs.copyTpl(gen.templatePath(`${dir}/**/*`), gen.destinationPath(dir), gen.answers);
18
- },
19
- copyTemplate: (source, destination) => {
20
- gen.fs.copyTpl(gen.templatePath(source), gen.destinationPath(destination), gen.answers);
21
- },
22
- copyTemplateInPlace: file => {
23
- gen.fs.copyTpl(gen.templatePath(file), gen.destinationPath(file), gen.answers);
24
- },
25
- createFile: (file, contents) => {
26
- gen.fs.write(gen.destinationPath(file), contents);
27
- },
28
- makeDirectory: _mkdirp.default
29
- });
30
-
31
- exports.default = _default;
1
+ "use strict";var t=require("mkdirp");module.exports=e=>({copy:t=>e.fs.copy(e.templatePath(t),e.destinationPath(t)),copyTo:(t,a)=>e.fs.copy(e.templatePath(t),e.destinationPath(a)),copyDirectory:t=>e.fs.copyTpl(e.templatePath(`${t}/**/*`),e.destinationPath(t),e.answers),copyTemplate:(t,a)=>e.fs.copyTpl(e.templatePath(t),e.destinationPath(a),e.answers),copyTemplateInPlace:t=>e.fs.copyTpl(e.templatePath(t),e.destinationPath(t),e.answers),createFile:(t,a)=>e.fs.write(e.destinationPath(t),a),makeDirectory:t});
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "generator-reackt",
3
- "version": "0.3.2",
4
- "description": "Create an opinionated React-based web applcication",
3
+ "version": "0.5.0",
4
+ "description": "Create an opinionated React-based web application",
5
5
  "files": [
6
6
  "generators",
7
7
  "templates",
8
- ".prettierrc"
8
+ ".prettierrc",
9
+ ".stylelintrc"
9
10
  ],
10
11
  "repository": {
11
12
  "type": "git",
@@ -21,45 +22,48 @@
21
22
  "redux"
22
23
  ],
23
24
  "scripts": {
24
- "build": "gulp",
25
- "watch": "gulp watch",
26
- "prepublishOnly": "gulp",
25
+ "build": "rollup -c",
26
+ "watch": "rollup -c -w",
27
+ "prepublishOnly": "rollup -c",
27
28
  "version": "auto-changelog -l false -p --hide-credit && git add CHANGELOG.md"
28
29
  },
29
30
  "engines": {
30
- "node": ">=12"
31
+ "node": ">=16"
31
32
  },
32
33
  "author": "ayan4m1 <andrew@bulletlogic.com>",
33
34
  "license": "MIT",
34
35
  "dependencies": {
35
- "chalk": "^4.1.2",
36
- "date-fns": "^2.23.0",
37
- "got": "^6.7.1",
36
+ "chalk": "^5.2.0",
37
+ "date-fns": "^2.30.0",
38
+ "got": "^11.8.3",
38
39
  "gulp-if": "^3.0.0",
39
- "gulp-prettier": "^3.0.0",
40
+ "gulp-prettier": "^4.0.0",
41
+ "inquirer": "8.x",
40
42
  "inquirer-autocomplete-prompt": "^1.4.0",
41
43
  "jsonfile": "^6.1.0",
42
- "mkdirp": "^1.0.4",
43
- "spdx-license-ids": "^3.0.9",
44
+ "mkdirp": "^3.0.1",
45
+ "spdx-license-ids": "^3.0.13",
44
46
  "yeoman-generator": "^4.13.0",
45
47
  "yeoman-stylelint": "^0.1.3"
46
48
  },
47
49
  "devDependencies": {
48
- "@babel/core": "^7.14.8",
49
- "@babel/eslint-parser": "^7.14.7",
50
- "@babel/preset-env": "^7.14.8",
51
- "@babel/register": "^7.14.5",
52
- "auto-changelog": "^2.3.0",
53
- "del": "^6.0.0",
54
- "eslint": "^7.31.0",
55
- "eslint-config-prettier": "^8.3.0",
56
- "eslint-plugin-prettier": "^3.4.0",
57
- "gulp": "^4.0.2",
58
- "gulp-babel": "^8.0.0",
59
- "gulp-eslint": "^6.0.0",
60
- "husky": "^7.0.1",
61
- "lint-staged": "^11.1.1",
62
- "prettier": "^2.3.2",
63
- "prettier-eslint": "^13.0.0"
50
+ "@babel/core": "^7.21.8",
51
+ "@babel/eslint-parser": "^7.21.8",
52
+ "@babel/preset-env": "^7.21.5",
53
+ "@babel/register": "^7.21.0",
54
+ "@rollup/plugin-babel": "^6.0.3",
55
+ "@rollup/plugin-eslint": "^9.0.4",
56
+ "@rollup/plugin-node-resolve": "^15.0.2",
57
+ "@rollup/plugin-terser": "^0.4.1",
58
+ "auto-changelog": "^2.4.0",
59
+ "eslint": "^8.40.0",
60
+ "eslint-config-prettier": "^8.8.0",
61
+ "eslint-plugin-prettier": "^4.2.1",
62
+ "husky": "^8.0.3",
63
+ "lint-staged": "^13.2.2",
64
+ "prettier": "^2.8.8",
65
+ "rollup": "^3.21.7",
66
+ "rollup-plugin-auto-external": "^2.0.0",
67
+ "rollup-plugin-multi-input": "^1.4.1"
64
68
  }
65
69
  }
@@ -1,9 +1,9 @@
1
- {
2
- "presets": ["@babel/preset-env", "@babel/preset-react"],
3
- "plugins": [
4
- "@babel/plugin-proposal-class-properties",
5
- "@babel/plugin-proposal-object-rest-spread",
6
- "@babel/plugin-transform-runtime",
7
- "@babel/plugin-transform-regenerator"
8
- ]
9
- }
1
+ {
2
+ "presets": ["@babel/preset-env", ["@babel/preset-react", { "runtime": "automatic" }]],
3
+ "plugins": [
4
+ "@babel/plugin-proposal-class-properties",
5
+ "@babel/plugin-proposal-object-rest-spread",
6
+ "@babel/plugin-transform-runtime",
7
+ "@babel/plugin-transform-regenerator"
8
+ ]
9
+ }
@@ -1,3 +1,3 @@
1
- last 2 versions
2
- not dead
3
- > 1%
1
+ last 2 versions
2
+ not dead
3
+ > 1%
@@ -1,11 +1,11 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = space
5
- indent_size = 2
6
- charset = utf-8
7
- trim_trailing_whitespace = true
8
- insert_final_newline = true
9
-
10
- [{*.md,*.snap}]
11
- trim_trailing_whitespace = false
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ charset = utf-8
7
+ trim_trailing_whitespace = true
8
+ insert_final_newline = true
9
+
10
+ [{*.md,*.snap}]
11
+ trim_trailing_whitespace = false
@@ -1,23 +1,23 @@
1
- {
2
- "source": "./src",
3
- "destination": "./docs",
4
- "plugins": [
5
- {
6
- "name": "esdoc-standard-plugin",
7
- "option": {
8
- "test": {
9
- "source": "./src/",
10
- "interfaces": ["describe", "it", "context", "suite", "test"],
11
- "includes": ["test\\.js$"]
12
- }
13
- }
14
- },
15
- { "name": "esdoc-jsx-plugin" },
16
- {
17
- "name": "esdoc-ecmascript-proposal-plugin",
18
- "option": {
19
- "all": true
20
- }
21
- }
22
- ]
23
- }
1
+ {
2
+ "source": "./src",
3
+ "destination": "./docs",
4
+ "plugins": [
5
+ {
6
+ "name": "esdoc-standard-plugin",
7
+ "option": {
8
+ "test": {
9
+ "source": "./src/",
10
+ "interfaces": ["describe", "it", "context", "suite", "test"],
11
+ "includes": ["test\\.js$"]
12
+ }
13
+ }
14
+ },
15
+ { "name": "esdoc-jsx-plugin" },
16
+ {
17
+ "name": "esdoc-ecmascript-proposal-plugin",
18
+ "option": {
19
+ "all": true
20
+ }
21
+ }
22
+ ]
23
+ }
@@ -3,28 +3,18 @@ const path = require('path');
3
3
  module.exports = {
4
4
  "env": {
5
5
  "browser": true,
6
- "commonjs": true,
7
- "es6": true,
6
+ "es2020": true,
8
7
  <% if (flags.addJest) { %>
9
8
  "jest": true,
10
9
  <% } %>
11
10
  "node": true
12
11
  },
13
- "plugins": [
14
- "import",
15
- "react",
16
- "prettier",
17
- <% if (flags.addJest) { %>
18
- "jest",
19
- <% } %>
20
- "jsx-a11y"
21
- ],
22
12
  "extends": [
23
13
  "eslint:recommended",
24
14
  "plugin:react/recommended",
25
15
  "plugin:prettier/recommended",
26
16
  "plugin:jsx-a11y/recommended",
27
- "plugin:import/errors",
17
+ "plugin:import/recommended",
28
18
  "plugin:react-hooks/recommended",
29
19
  <% if (flags.addJest) { %>
30
20
  "plugin:jest/recommended"
@@ -178,7 +168,9 @@ module.exports = {
178
168
  "no-console": 2,
179
169
  "no-debugger": 2,
180
170
  "prettier/prettier": 2,
181
- "jsx-a11y/label-has-for": 0
171
+ "jsx-a11y/label-has-for": 0,
172
+ "react/jsx-uses-react": 0,
173
+ "react/react-in-jsx-scope": 0
182
174
  },
183
175
  "settings": {
184
176
  "react": {
@@ -1,4 +1,4 @@
1
- {
2
- "*.js": "eslint",
3
- "*.scss": "stylelint"
4
- }
1
+ {
2
+ "*.js": "eslint",
3
+ "*.scss": "stylelint"
4
+ }
@@ -1,5 +1,5 @@
1
- {
2
- "singleQuote": true,
3
- "trailingComma": "none",
4
- "endOfLine": "auto"
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "none",
4
+ "endOfLine": "auto"
5
5
  }
@@ -1 +1 @@
1
- import '@storybook/addon-knobs/register';
1
+ import '@storybook/addon-knobs/register';
@@ -1,14 +1,14 @@
1
- import { withKnobs } from '@storybook/addon-knobs';
2
- import { configure, addDecorator } from '@storybook/react';
3
-
4
- import '../src/index.scss';
5
-
6
- function loadStories() {
7
- const req = require.context('../src/components', true, /\.stories\.js$/);
8
-
9
- req.keys().forEach(filename => req(filename));
10
- }
11
-
12
- addDecorator(withKnobs);
13
-
14
- configure(loadStories, module);
1
+ import { withKnobs } from '@storybook/addon-knobs';
2
+ import { configure, addDecorator } from '@storybook/react';
3
+
4
+ import '../src/index.scss';
5
+
6
+ function loadStories() {
7
+ const req = require.context('../src/components', true, /\.stories\.js$/);
8
+
9
+ req.keys().forEach(filename => req(filename));
10
+ }
11
+
12
+ addDecorator(withKnobs);
13
+
14
+ configure(loadStories, module);
@@ -1,7 +1,7 @@
1
- import webpack from '../webpack.config.babel';
2
-
3
- export default async ({ config }) => ({
4
- ...config,
5
- module: webpack.module,
6
- resolve: webpack.resolve
7
- });
1
+ import webpack from '../webpack.config.babel';
2
+
3
+ export default async ({ config }) => ({
4
+ ...config,
5
+ module: webpack.module,
6
+ resolve: webpack.resolve
7
+ });