generator-reackt 0.3.3 → 0.6.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.
@@ -1,56 +1,51 @@
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', 'component'));
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: 'component.name',
32
- message: 'Component name'
33
- }, {
34
- type: 'confirm',
35
- name: 'flags.addRedux',
36
- message: 'Connect this component to the Redux store?',
37
- default: false
38
- }]);
39
- }
40
-
41
- async writing() {
42
- const {
43
- component: {
44
- name
45
- }
46
- } = this.answers;
47
- const fileName = src('components', `${name}.js`);
48
- const testName = src('components', `${name}.test.js`);
49
- this.log(`Creating ${name} component`);
50
- await this.fileSystem.copyTemplate('index.js', fileName);
51
- await this.fileSystem.copyTemplate('index.test.js', testName);
52
- }
53
-
54
- }
55
-
56
- exports.default = _default;
1
+ import { join } from 'path';
2
+ import { createRequire } from 'module';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ import fileSystem from '../util/fs.js';
6
+
7
+ // we cannot use ES6 imports on this object, as it directly exports a class to
8
+ // module.exports - no default export nor a named export is present for us to use
9
+ const require = createRequire(import.meta.url);
10
+ const __dirname = fileURLToPath(import.meta.url);
11
+ const Generator = require('yeoman-generator');
12
+
13
+ const src = (...paths) => join('src', ...paths);
14
+
15
+ export default class extends Generator {
16
+ constructor(...args) {
17
+ super(...args);
18
+
19
+ this.sourceRoot(join(__dirname, '..', '..', 'templates', 'component'));
20
+ this.answers = {};
21
+ this.fileSystem = fileSystem(this);
22
+ }
23
+
24
+ async prompting() {
25
+ this.answers = await this.prompt([
26
+ {
27
+ type: 'input',
28
+ name: 'component.name',
29
+ message: 'Component name'
30
+ },
31
+ {
32
+ type: 'confirm',
33
+ name: 'flags.addRedux',
34
+ message: 'Connect this component to the Redux store?',
35
+ default: false
36
+ }
37
+ ]);
38
+ }
39
+
40
+ async writing() {
41
+ const {
42
+ component: { name }
43
+ } = this.answers;
44
+ const fileName = src('components', `${name}.js`);
45
+ const testName = src('components', `${name}.test.js`);
46
+
47
+ this.log(`Creating ${name} component`);
48
+ await this.fileSystem.copyTemplate('index.js', fileName);
49
+ await this.fileSystem.copyTemplate('index.test.js', testName);
50
+ }
51
+ }
@@ -1,117 +1,127 @@
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
+ import { join, dirname } from 'path';
2
+ import { createRequire } from 'module';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ import fileSystem from '../util/fs.js';
6
+
7
+ // we cannot use ES6 imports on this object, as it directly exports a class to
8
+ // module.exports - no default export nor a named export is present for us to use
9
+ const require = createRequire(import.meta.url);
10
+ const __dirname = fileURLToPath(import.meta.url);
11
+ const Generator = require('yeoman-generator');
12
+
13
+ const src = (...paths) => join('src', ...paths);
14
+
15
+ export default class extends Generator {
16
+ constructor(...args) {
17
+ super(...args);
18
+
19
+ this.sourceRoot(join(__dirname, '..', '..', 'templates', 'module'));
20
+ this.answers = {};
21
+ this.fileSystem = fileSystem(this);
22
+ }
23
+
24
+ async prompting() {
25
+ this.answers = await this.prompt([
26
+ {
27
+ type: 'input',
28
+ name: 'module.name',
29
+ message: 'Module name'
30
+ },
31
+ {
32
+ type: 'list',
33
+ name: 'directoryMode',
34
+ message: 'Choose a way of structuring the module.',
35
+ choices: [
36
+ {
37
+ name: 'Create a directory with the module name and an index.js file inside that.',
38
+ value: 'dir',
39
+ short: 'Directory'
40
+ },
41
+ {
42
+ name: 'Create a file with the module name.',
43
+ value: 'file',
44
+ short: 'File'
45
+ }
46
+ ]
47
+ },
48
+ {
49
+ type: 'confirm',
50
+ name: 'flags.createReducer',
51
+ message: 'Generate a reducer?',
52
+ default: true
53
+ },
54
+ {
55
+ type: 'confirm',
56
+ name: 'flags.createSaga',
57
+ message: 'Generate a saga?',
58
+ default: true
59
+ },
60
+ {
61
+ type: 'confirm',
62
+ name: 'flags.createSelector',
63
+ message: 'Generate a selector?',
64
+ default: true
65
+ },
66
+ {
67
+ type: 'confirm',
68
+ name: 'flags.addJest',
69
+ message: 'Generate test files?',
70
+ default: true
71
+ }
72
+ ]);
73
+ }
74
+
75
+ async writing() {
76
+ const {
77
+ directoryMode,
78
+ module: { name },
79
+ flags
80
+ } = this.answers;
81
+
82
+ this.log(`Creating module ${name}`);
83
+
84
+ const buildPaths = (ext) => {
85
+ const namePath = `${name}${ext}`;
86
+ const indexPath = `index${ext}`;
87
+ const destPath = [];
88
+
89
+ switch (directoryMode) {
90
+ default:
91
+ case 'file':
92
+ destPath.push(namePath);
93
+ break;
94
+ case 'dir':
95
+ destPath.push(name, indexPath);
96
+ break;
97
+ }
98
+
99
+ if (flags.createReducer) {
100
+ this.fileSystem.copyTemplate(
101
+ join('reducer', indexPath),
102
+ src('reducers', ...destPath)
103
+ );
104
+ }
105
+
106
+ if (flags.createSaga) {
107
+ this.fileSystem.copyTemplate(
108
+ join('saga', indexPath),
109
+ src('sagas', ...destPath)
110
+ );
111
+ }
112
+
113
+ if (flags.createSelector) {
114
+ this.fileSystem.copyTemplate(
115
+ join('selector', indexPath),
116
+ src('selectors', ...destPath)
117
+ );
118
+ }
119
+ };
120
+
121
+ buildPaths('.js');
122
+
123
+ if (flags.addJest) {
124
+ buildPaths('.test.js');
125
+ }
126
+ }
127
+ }
@@ -1,22 +1,34 @@
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 => gen.fs.copy(gen.templatePath(file), gen.destinationPath(file)),
14
- copyTo: (src, dst) => gen.fs.copy(gen.templatePath(src), gen.destinationPath(dst)),
15
- copyDirectory: dir => gen.fs.copyTpl(gen.templatePath(`${dir}/**/*`), gen.destinationPath(dir), gen.answers),
16
- copyTemplate: (source, destination) => gen.fs.copyTpl(gen.templatePath(source), gen.destinationPath(destination), gen.answers),
17
- copyTemplateInPlace: file => gen.fs.copyTpl(gen.templatePath(file), gen.destinationPath(file), gen.answers),
18
- createFile: (file, contents) => gen.fs.write(gen.destinationPath(file), contents),
19
- makeDirectory: _mkdirp.default
20
- });
21
-
22
- exports.default = _default;
1
+ import { mkdirp } from 'mkdirp';
2
+ import { join } from 'path';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ const __dirname = fileURLToPath(import.meta.url);
6
+
7
+ export default (gen) => ({
8
+ copy: (file) =>
9
+ gen.fs.copy(gen.templatePath(file), gen.destinationPath(file)),
10
+ copyTo: (src, dst) =>
11
+ gen.fs.copy(gen.templatePath(src), gen.destinationPath(dst)),
12
+ copyDirectory: (dir) =>
13
+ gen.fs.copyTpl(
14
+ gen.templatePath(`${dir}/**/*`),
15
+ gen.destinationPath(dir),
16
+ gen.answers
17
+ ),
18
+ copyTemplate: (source, destination) =>
19
+ gen.fs.copyTpl(
20
+ gen.templatePath(source),
21
+ gen.destinationPath(destination),
22
+ gen.answers
23
+ ),
24
+ copyTemplateInPlace: (file) =>
25
+ gen.fs.copyTpl(
26
+ gen.templatePath(file),
27
+ gen.destinationPath(file),
28
+ gen.answers
29
+ ),
30
+ createFile: (file, contents) =>
31
+ gen.fs.write(gen.destinationPath(file), contents),
32
+ makeDirectory: mkdirp,
33
+ resolve: (...paths) => join(__dirname, '..', '..', '..', ...paths)
34
+ });
package/package.json CHANGED
@@ -1,66 +1,63 @@
1
- {
2
- "name": "generator-reackt",
3
- "version": "0.3.3",
4
- "description": "Create an opinionated React-based web applcication",
5
- "files": [
6
- "generators",
7
- "templates",
8
- ".prettierrc",
9
- ".stylelintrc"
10
- ],
11
- "repository": {
12
- "type": "git",
13
- "url": "ssh://git@git.codecube.xyz:7999/web/generator-reackt.git"
14
- },
15
- "keywords": [
16
- "yeoman-generator",
17
- "generator",
18
- "scaffold",
19
- "frontend",
20
- "reactjs",
21
- "webpack",
22
- "redux"
23
- ],
24
- "scripts": {
25
- "build": "gulp",
26
- "watch": "gulp watch",
27
- "prepublishOnly": "gulp",
28
- "version": "auto-changelog -l false -p --hide-credit && git add CHANGELOG.md"
29
- },
30
- "engines": {
31
- "node": ">=12"
32
- },
33
- "author": "ayan4m1 <andrew@bulletlogic.com>",
34
- "license": "MIT",
35
- "dependencies": {
36
- "chalk": "^4.1.2",
37
- "date-fns": "^2.23.0",
38
- "got": "^6.7.1",
39
- "gulp-if": "^3.0.0",
40
- "gulp-prettier": "^3.0.0",
41
- "inquirer-autocomplete-prompt": "^1.4.0",
42
- "jsonfile": "^6.1.0",
43
- "mkdirp": "^1.0.4",
44
- "spdx-license-ids": "^3.0.10",
45
- "yeoman-generator": "^4.13.0",
46
- "yeoman-stylelint": "^0.1.3"
47
- },
48
- "devDependencies": {
49
- "@babel/core": "^7.15.0",
50
- "@babel/eslint-parser": "^7.15.0",
51
- "@babel/preset-env": "^7.15.0",
52
- "@babel/register": "^7.15.3",
53
- "auto-changelog": "^2.3.0",
54
- "del": "^6.0.0",
55
- "eslint": "^7.32.0",
56
- "eslint-config-prettier": "^8.3.0",
57
- "eslint-plugin-prettier": "^3.4.1",
58
- "gulp": "^4.0.2",
59
- "gulp-babel": "^8.0.0",
60
- "gulp-eslint": "^6.0.0",
61
- "husky": "^7.0.2",
62
- "lint-staged": "^11.1.2",
63
- "prettier": "^2.3.2",
64
- "prettier-eslint": "^13.0.0"
65
- }
66
- }
1
+ {
2
+ "name": "generator-reackt",
3
+ "version": "0.6.0",
4
+ "description": "Create an opinionated React-based web applcication",
5
+ "type": "module",
6
+ "files": [
7
+ "generators",
8
+ "templates",
9
+ ".prettierrc",
10
+ ".stylelintrc"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "ssh://git@git.codecube.xyz:7999/web/generator-reackt.git"
15
+ },
16
+ "keywords": [
17
+ "yeoman-generator",
18
+ "generator",
19
+ "scaffold",
20
+ "frontend",
21
+ "reactjs",
22
+ "webpack",
23
+ "redux"
24
+ ],
25
+ "scripts": {
26
+ "version": "auto-changelog -l false -p --hide-credit && git add CHANGELOG.md",
27
+ "prepare": "husky"
28
+ },
29
+ "engines": {
30
+ "node": ">=16"
31
+ },
32
+ "author": "ayan4m1 <andrew@bulletlogic.com>",
33
+ "license": "MIT",
34
+ "dependencies": {
35
+ "chalk": "^5.3.0",
36
+ "date-fns": "^3.6.0",
37
+ "got": "^14.4.1",
38
+ "gulp-if": "^3.0.0",
39
+ "gulp-prettier": "^6.0.0",
40
+ "inquirer": "9.3.5",
41
+ "inquirer-autocomplete-prompt": "^3.0.1",
42
+ "jsonfile": "^6.1.0",
43
+ "mkdirp": "^3.0.1",
44
+ "spdx-license-ids": "^3.0.18",
45
+ "yeoman-generator": "^4.13.0",
46
+ "yeoman-stylelint": "^1.0.0"
47
+ },
48
+ "devDependencies": {
49
+ "@babel/eslint-parser": "^7.24.7",
50
+ "@babel/plugin-syntax-import-assertions": "^7.24.7",
51
+ "auto-changelog": "^2.4.0",
52
+ "eslint": "8.57.0",
53
+ "eslint-config-prettier": "^9.1.0",
54
+ "eslint-plugin-prettier": "^5.1.3",
55
+ "husky": "^9.0.11",
56
+ "lint-staged": "^15.2.7",
57
+ "postcss": "^8.4.39",
58
+ "postcss-scss": "^4.0.9",
59
+ "prettier": "^3.3.2",
60
+ "stylelint": "^16.6.1",
61
+ "stylelint-config-recommended": "^14.0.1"
62
+ }
63
+ }
@@ -1,9 +1,4 @@
1
1
  {
2
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
- ]
3
+ "plugins": ["@babel/plugin-transform-runtime"]
9
4
  }