generator-folklore 3.0.3 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/generators/app/index.js +3 -51
- package/lib/generators/babel/index.js +28 -101
- package/lib/generators/babel/templates/config.js +16 -0
- package/lib/generators/browserslist/index.js +4 -9
- package/lib/generators/build/index.js +40 -29
- package/lib/generators/cli/index.js +92 -0
- package/lib/generators/cli/templates/cli.js +22 -0
- package/lib/generators/cli/templates/commands/default.js +16 -0
- package/lib/generators/docs/index.js +1 -2
- package/lib/generators/editorconfig/index.js +12 -22
- package/lib/generators/eslint/index.js +12 -13
- package/lib/generators/{html → html-project}/index.js +60 -73
- package/lib/generators/{html → html-project}/templates/folklore.png +0 -0
- package/lib/generators/{html → html-project}/templates/gitignore +0 -0
- package/lib/generators/{html → html-project}/templates/index.html.ejs +4 -1
- package/lib/generators/laravel/index.js +5 -5
- package/lib/generators/lerna-package/index.js +1 -3
- package/lib/generators/lerna-repository/index.js +1 -3
- package/lib/generators/node-project/index.js +164 -0
- package/lib/generators/{js/templates/src/lib/.gitkeep → node-project/templates/index.js} +0 -0
- package/lib/generators/npm-package/index.js +3 -5
- package/lib/generators/prettier/index.js +19 -6
- package/lib/generators/prettier/templates/prettierrc.json +3 -1
- package/lib/generators/{js → react-app}/index.js +22 -52
- package/lib/generators/{js → react-app}/templates/_package.json +0 -0
- package/lib/generators/react-app/templates/index.js +22 -0
- package/lib/generators/react-app/templates/src/components/App.jsx +42 -0
- package/lib/generators/react-app/templates/src/components/Routes.jsx +43 -0
- package/lib/generators/{js → react-app}/templates/src/components/buttons/Button.jsx +4 -18
- package/lib/generators/react-app/templates/src/components/layouts/Main.jsx +27 -0
- package/lib/generators/react-app/templates/src/components/menus/Menu.jsx +62 -0
- package/lib/generators/{js → react-app}/templates/src/components/pages/Error.jsx +8 -12
- package/lib/generators/react-app/templates/src/components/pages/Home.jsx +32 -0
- package/lib/generators/{js → react-app}/templates/src/components/partials/PageMeta.jsx +11 -11
- package/lib/generators/{js → react-app}/templates/src/contexts/KeysContext.jsx +0 -0
- package/lib/generators/{js/templates/styles → react-app/templates/src/lib}/.gitkeep +0 -0
- package/lib/generators/{js → react-app}/templates/src/lib/PropTypes.js +0 -0
- package/lib/generators/{js → react-app}/templates/src/lib/utils.js +0 -0
- package/lib/generators/react-app/templates/src/polyfills/index.js +6 -0
- package/lib/generators/react-app/templates/src/polyfills/intl-en.js +2 -0
- package/lib/generators/react-app/templates/src/polyfills/intl-fr.js +2 -0
- package/lib/generators/react-app/templates/src/polyfills/should.js +14 -0
- package/lib/generators/react-app/templates/styles/.gitkeep +0 -0
- package/lib/generators/{js/templates/styles/buttons/button.scss → react-app/templates/styles/buttons/button.module.scss} +1 -0
- package/lib/generators/{js/templates/styles/layouts/main.scss → react-app/templates/styles/layouts/main.module.scss} +0 -0
- package/lib/generators/{js/templates/styles/menus/menu.scss → react-app/templates/styles/menus/menu.module.scss} +0 -0
- package/lib/generators/{js/templates/styles/pages/error.scss → react-app/templates/styles/pages/error.module.scss} +0 -0
- package/lib/generators/{js/templates/styles/pages/home.scss → react-app/templates/styles/pages/home.module.scss} +0 -0
- package/lib/generators/rollup/index.js +54 -0
- package/lib/generators/rollup/templates/config.js +47 -0
- package/lib/generators/scss/index.js +3 -16
- package/lib/generators/scss/templates/{main.scss → styles.scss} +0 -0
- package/lib/generators/server/index.js +81 -0
- package/lib/generators/server/templates/server.js +59 -0
- package/lib/generators/storybook/index.js +1 -7
- package/lib/generators/stylelint/index.js +13 -14
- package/lib/lib/utils.js +17 -0
- package/package.json +2 -2
- package/lib/generators/babel/templates/babel-preset-react.js +0 -7
- package/lib/generators/babel/templates/babel-preset.js +0 -57
- package/lib/generators/babel/templates/babelrc +0 -5
- package/lib/generators/babel/templates/utils/processScss.js +0 -10
- package/lib/generators/babel/templates/utils/transformRequireIgnore.js +0 -80
- package/lib/generators/html/templates/index.js +0 -9
- package/lib/generators/html/templates/root.js +0 -23
- package/lib/generators/html/templates/utils.js +0 -7
- package/lib/generators/js/templates/browserslistrc +0 -9
- package/lib/generators/js/templates/config.js +0 -33
- package/lib/generators/js/templates/index.js +0 -41
- package/lib/generators/js/templates/src/actions/LayoutActions.js +0 -12
- package/lib/generators/js/templates/src/actions/SiteActions.js +0 -22
- package/lib/generators/js/templates/src/components/App.jsx +0 -52
- package/lib/generators/js/templates/src/components/Root.jsx +0 -70
- package/lib/generators/js/templates/src/components/layouts/Main.jsx +0 -52
- package/lib/generators/js/templates/src/components/menus/Menu.jsx +0 -60
- package/lib/generators/js/templates/src/components/messages/Success.jsx +0 -36
- package/lib/generators/js/templates/src/components/pages/Home.jsx +0 -32
- package/lib/generators/js/templates/src/components/partials/Label.jsx +0 -32
- package/lib/generators/js/templates/src/reducers/LayoutReducer.js +0 -32
- package/lib/generators/js/templates/src/reducers/SiteReducer.js +0 -36
- package/lib/generators/js/templates/src/reducers/index.js +0 -7
- package/lib/generators/js/templates/src/vendor/polyfills/intl-en.js +0 -2
- package/lib/generators/js/templates/src/vendor/polyfills/intl-fr.js +0 -2
@@ -52,58 +52,10 @@ module.exports = class AppGenerator extends _generator.default {
|
|
52
52
|
message: 'What type of project?',
|
53
53
|
choices: [{
|
54
54
|
name: 'HTML',
|
55
|
-
value: 'html'
|
55
|
+
value: 'html-project'
|
56
56
|
}, {
|
57
|
-
name: '
|
58
|
-
value: '
|
59
|
-
}, {
|
60
|
-
name: 'Javascript',
|
61
|
-
value: 'js'
|
62
|
-
}, {
|
63
|
-
name: 'SCSS',
|
64
|
-
value: 'scss'
|
65
|
-
}, {
|
66
|
-
name: 'NPM Package',
|
67
|
-
value: 'npm-package'
|
68
|
-
}, {
|
69
|
-
name: 'React Package',
|
70
|
-
value: 'react-package'
|
71
|
-
}, {
|
72
|
-
name: 'Laravel Package',
|
73
|
-
value: 'laravel-package'
|
74
|
-
}, {
|
75
|
-
name: 'Lerna repository',
|
76
|
-
value: 'lerna-repository'
|
77
|
-
}, {
|
78
|
-
name: 'Lerna package',
|
79
|
-
value: 'lerna-package'
|
80
|
-
}, {
|
81
|
-
name: 'Build tools',
|
82
|
-
value: 'build'
|
83
|
-
}, {
|
84
|
-
name: 'Babel',
|
85
|
-
value: 'babel'
|
86
|
-
}, {
|
87
|
-
name: 'Eslint',
|
88
|
-
value: 'eslint'
|
89
|
-
}, {
|
90
|
-
name: 'Stylelint',
|
91
|
-
value: 'stylelint'
|
92
|
-
}, {
|
93
|
-
name: 'SASS Lint',
|
94
|
-
value: 'sass-lint'
|
95
|
-
}, {
|
96
|
-
name: 'Test',
|
97
|
-
value: 'test'
|
98
|
-
}, {
|
99
|
-
name: 'Storybook',
|
100
|
-
value: 'storybook'
|
101
|
-
}, {
|
102
|
-
name: 'Editorconfig',
|
103
|
-
value: 'editorconfig'
|
104
|
-
}, {
|
105
|
-
name: 'Documentation',
|
106
|
-
value: 'docs'
|
57
|
+
name: 'Node',
|
58
|
+
value: 'node-project'
|
107
59
|
}]
|
108
60
|
});
|
109
61
|
}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _path = _interopRequireDefault(require("path"));
|
4
|
-
|
5
3
|
var _chalk = _interopRequireDefault(require("chalk"));
|
6
4
|
|
5
|
+
var _path = _interopRequireDefault(require("path"));
|
6
|
+
|
7
7
|
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
8
8
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -11,12 +11,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
11
11
|
module.exports = class BabelGenerator extends _generator.default {
|
12
12
|
constructor(...args) {
|
13
13
|
super(...args);
|
14
|
-
this.option('
|
15
|
-
type: String,
|
16
|
-
required: false,
|
17
|
-
defaults: './build'
|
18
|
-
});
|
19
|
-
this.option('react-app', {
|
14
|
+
this.option('react', {
|
20
15
|
type: Boolean,
|
21
16
|
required: false,
|
22
17
|
defaults: false
|
@@ -26,121 +21,53 @@ module.exports = class BabelGenerator extends _generator.default {
|
|
26
21
|
required: false,
|
27
22
|
defaults: false
|
28
23
|
});
|
29
|
-
this.option('compile', {
|
30
|
-
type: Boolean,
|
31
|
-
required: false,
|
32
|
-
defaults: false
|
33
|
-
});
|
34
24
|
this.option('react-intl', {
|
35
25
|
type: Boolean,
|
36
26
|
required: false,
|
37
27
|
defaults: false
|
38
28
|
});
|
39
|
-
|
40
|
-
this.buildPath = filePath => this.destinationPath(_path.default.join(this.options['build-path'], filePath));
|
41
29
|
}
|
42
30
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
return;
|
48
|
-
}
|
49
|
-
|
50
|
-
console.log(_chalk.default.yellow('\n----------------------'));
|
51
|
-
console.log('Babel Generator');
|
52
|
-
console.log(_chalk.default.yellow('----------------------\n'));
|
53
|
-
}
|
31
|
+
prompting() {
|
32
|
+
if (this.options.quiet) {
|
33
|
+
return;
|
34
|
+
}
|
54
35
|
|
55
|
-
|
36
|
+
console.log(_chalk.default.yellow('\n----------------------'));
|
37
|
+
console.log('Babel Generator');
|
38
|
+
console.log(_chalk.default.yellow('----------------------\n'));
|
56
39
|
}
|
57
40
|
|
58
41
|
get writing() {
|
59
42
|
return {
|
60
|
-
|
61
|
-
const
|
62
|
-
|
63
|
-
|
64
|
-
|
43
|
+
config() {
|
44
|
+
const {
|
45
|
+
react,
|
46
|
+
'transform-runtime': transformRuntime,
|
47
|
+
'react-intl': reactIntl
|
48
|
+
} = this.options;
|
49
|
+
const srcPath = this.templatePath('config');
|
50
|
+
const destPath = this.destinationPath('babel.config.js');
|
65
51
|
this.fs.copyTpl(srcPath, destPath, {
|
66
|
-
|
52
|
+
react,
|
53
|
+
transformRuntime,
|
54
|
+
reactIntl
|
67
55
|
});
|
68
56
|
},
|
69
57
|
|
70
|
-
|
71
|
-
|
72
|
-
const destPath = this.buildPath('babel-preset.js');
|
73
|
-
this.fs.copyTpl(srcPath, destPath, {
|
74
|
-
hasTransformRuntime: this.options['transform-runtime'],
|
75
|
-
hasReactIntl: this.options['react-intl'],
|
76
|
-
hasCompile: this.options.compile
|
77
|
-
});
|
78
|
-
},
|
79
|
-
|
80
|
-
utils() {
|
81
|
-
if (!this.options.compile) {
|
82
|
-
return;
|
83
|
-
}
|
84
|
-
|
85
|
-
const srcPath = this.templatePath('utils');
|
86
|
-
const destPath = this.buildPath('utils');
|
87
|
-
this.fs.copyTpl(srcPath, destPath, {});
|
88
|
-
},
|
89
|
-
|
90
|
-
getLocalIdent() {
|
91
|
-
if (!this.options.compile) {
|
92
|
-
return;
|
93
|
-
}
|
94
|
-
|
95
|
-
const destPath = this.buildPath('utils/getLocalIdent.js');
|
96
|
-
|
97
|
-
if (this.fs.exists(destPath)) {
|
98
|
-
return;
|
99
|
-
}
|
100
|
-
|
101
|
-
const srcPath = _path.default.join(this.templatePath(), '../../build/templates/utils/getLocalIdent.js');
|
102
|
-
|
103
|
-
this.fs.copy(srcPath, destPath);
|
58
|
+
dependencies() {
|
59
|
+
this.addDevDependencies(['@babel/cli', '@babel/core', '@babel/node', '@babel/plugin-transform-runtime', '@babel/preset-env', '@babel/preset-react']);
|
104
60
|
}
|
105
61
|
|
106
62
|
};
|
107
63
|
}
|
108
64
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
return;
|
114
|
-
}
|
65
|
+
async install() {
|
66
|
+
if (this.options['skip-install']) {
|
67
|
+
return;
|
68
|
+
}
|
115
69
|
|
116
|
-
|
117
|
-
const devDependencies = this.options['react-app'] ? ['@babel/cli@latest', '@babel/core@latest', '@babel/polyfill@latest', '@babel/register@latest', 'babel-preset-react-app@latest'] : ['@babel/cli@latest', '@babel/core@latest', '@babel/polyfill@latest', '@babel/register@latest', 'babel-plugin-dynamic-import-node@latest', '@babel/plugin-syntax-dynamic-import@latest', '@babel/plugin-proposal-object-rest-spread@latest', 'babel-plugin-css-modules-transform@latest', '@babel/preset-env@latest', '@babel/preset-react@latest'];
|
118
|
-
|
119
|
-
if (this.options['transform-runtime']) {
|
120
|
-
dependencies.push('@babel/runtime@latest');
|
121
|
-
devDependencies.push('@babel/plugin-transform-runtime@latest');
|
122
|
-
}
|
123
|
-
|
124
|
-
if (this.options['react-intl']) {
|
125
|
-
devDependencies.push('babel-plugin-react-intl@latest');
|
126
|
-
}
|
127
|
-
|
128
|
-
if (this.options.compile) {
|
129
|
-
devDependencies.push('node-sass@latest');
|
130
|
-
}
|
131
|
-
|
132
|
-
if (dependencies.length > 0) {
|
133
|
-
this.addDependencies(dependencies, {
|
134
|
-
save: true
|
135
|
-
});
|
136
|
-
}
|
137
|
-
|
138
|
-
if (devDependencies.length > 0) {
|
139
|
-
this.addDevDependencies(devDependencies);
|
140
|
-
}
|
141
|
-
}
|
142
|
-
|
143
|
-
};
|
70
|
+
await this.spawnCommand('npm', ['install']);
|
144
71
|
}
|
145
72
|
|
146
73
|
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module.exports = {
|
2
|
+
presets: [
|
3
|
+
[
|
4
|
+
require.resolve('@babel/preset-env'),
|
5
|
+
{
|
6
|
+
useBuiltIns: false
|
7
|
+
},
|
8
|
+
],
|
9
|
+
],
|
10
|
+
|
11
|
+
plugins: [
|
12
|
+
<% if (transformRuntime) { %>
|
13
|
+
[require.resolve('@babel/plugin-transform-runtime'), {}],
|
14
|
+
<% } %>
|
15
|
+
],
|
16
|
+
};
|
@@ -22,15 +22,10 @@ module.exports = class BrowsersListGenerator extends _generator.default {
|
|
22
22
|
};
|
23
23
|
}
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
const destPath = this.destinationPath('.browserslistrc');
|
30
|
-
this.fs.copy(srcPath, destPath);
|
31
|
-
}
|
32
|
-
|
33
|
-
};
|
25
|
+
writing() {
|
26
|
+
const srcPath = this.templatePath('browserslistrc');
|
27
|
+
const destPath = this.destinationPath('.browserslistrc');
|
28
|
+
this.fs.copy(srcPath, destPath);
|
34
29
|
}
|
35
30
|
|
36
31
|
};
|
@@ -1,13 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _path = _interopRequireDefault(require("path"));
|
4
|
-
|
5
3
|
var _chalk = _interopRequireDefault(require("chalk"));
|
6
4
|
|
7
5
|
var _isArray = _interopRequireDefault(require("lodash/isArray"));
|
8
6
|
|
7
|
+
var _path = _interopRequireDefault(require("path"));
|
8
|
+
|
9
9
|
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
10
10
|
|
11
|
+
var _utils = require("../../lib/utils");
|
12
|
+
|
11
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
14
|
|
13
15
|
module.exports = class AppGenerator extends _generator.default {
|
@@ -44,7 +46,7 @@ module.exports = class AppGenerator extends _generator.default {
|
|
44
46
|
defaults: true
|
45
47
|
});
|
46
48
|
|
47
|
-
this.
|
49
|
+
this.ensureLeadingDotSlash = filePath => !_path.default.isAbsolute(filePath) && filePath.match(/^\./) === null ? `./${filePath}` : filePath;
|
48
50
|
}
|
49
51
|
|
50
52
|
prompting() {
|
@@ -57,34 +59,43 @@ module.exports = class AppGenerator extends _generator.default {
|
|
57
59
|
console.log(_chalk.default.yellow('----------------------\n'));
|
58
60
|
}
|
59
61
|
|
60
|
-
writing() {
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
62
|
+
get writing() {
|
63
|
+
return {
|
64
|
+
packageJSON() {
|
65
|
+
const {
|
66
|
+
'entry-path': entryPath,
|
67
|
+
'src-path': srcPath,
|
68
|
+
'build-path': buildPath,
|
69
|
+
'public-path': publicPath,
|
70
|
+
'html-path': htmlPath,
|
71
|
+
server
|
72
|
+
} = this.options;
|
73
|
+
const scripts = {
|
74
|
+
build: `flklr build --load-env ${(0, _utils.ensureLeadingDotSlash)(entryPath)}`
|
75
|
+
};
|
72
76
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
+
if (server) {
|
78
|
+
scripts.server = `flklr serve --load-env ${(0, _utils.ensureLeadingDotSlash)(entryPath)}`;
|
79
|
+
scripts.start = 'npm run server';
|
80
|
+
}
|
81
|
+
|
82
|
+
this.packageJson.merge({
|
83
|
+
scripts,
|
84
|
+
build: {
|
85
|
+
outputPath: (0, _utils.ensureLeadingDotSlash)(buildPath),
|
86
|
+
srcPath: (0, _utils.ensureLeadingDotSlash)(srcPath),
|
87
|
+
htmlPath: (0, _utils.ensureLeadingDotSlash)(htmlPath),
|
88
|
+
publicPath: (0, _utils.ensureLeadingDotSlash)(publicPath),
|
89
|
+
disableImageOptimization: true
|
90
|
+
}
|
91
|
+
});
|
92
|
+
},
|
77
93
|
|
78
|
-
|
79
|
-
|
80
|
-
build: {
|
81
|
-
outputPath: buildPath,
|
82
|
-
srcPath,
|
83
|
-
htmlPath,
|
84
|
-
publicPath,
|
85
|
-
disableImageOptimization: true
|
94
|
+
dependencies() {
|
95
|
+
this.addDevDependencies(['@folklore/cli']);
|
86
96
|
}
|
87
|
-
|
97
|
+
|
98
|
+
};
|
88
99
|
}
|
89
100
|
|
90
101
|
async install() {
|
@@ -92,7 +103,7 @@ module.exports = class AppGenerator extends _generator.default {
|
|
92
103
|
return;
|
93
104
|
}
|
94
105
|
|
95
|
-
await this.
|
106
|
+
await this.spawnCommand('npm', ['install']);
|
96
107
|
}
|
97
108
|
|
98
109
|
};
|
@@ -0,0 +1,92 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
4
|
+
|
5
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
6
|
+
|
7
|
+
var _path = _interopRequireDefault(require("path"));
|
8
|
+
|
9
|
+
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
10
|
+
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
|
+
|
13
|
+
module.exports = class CliGenerator extends _generator.default {
|
14
|
+
// The name `constructor` is important here
|
15
|
+
constructor(...args) {
|
16
|
+
super(...args);
|
17
|
+
this.option('path', {
|
18
|
+
type: String,
|
19
|
+
defaults: 'src'
|
20
|
+
});
|
21
|
+
this.option('filename', {
|
22
|
+
type: String,
|
23
|
+
defaults: 'cli.js'
|
24
|
+
});
|
25
|
+
this.option('commands', {
|
26
|
+
type: Boolean,
|
27
|
+
defaults: false
|
28
|
+
});
|
29
|
+
this.option('commands-path', {
|
30
|
+
type: String,
|
31
|
+
defaults: './commands'
|
32
|
+
});
|
33
|
+
}
|
34
|
+
|
35
|
+
get prompting() {
|
36
|
+
return {
|
37
|
+
welcome() {
|
38
|
+
if (this.options.quiet) {
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
|
42
|
+
console.log(_chalk.default.yellow('\n----------------------'));
|
43
|
+
console.log('CLI Generator');
|
44
|
+
console.log(_chalk.default.yellow('----------------------\n'));
|
45
|
+
}
|
46
|
+
|
47
|
+
};
|
48
|
+
}
|
49
|
+
|
50
|
+
get writing() {
|
51
|
+
return {
|
52
|
+
index() {
|
53
|
+
const {
|
54
|
+
filename,
|
55
|
+
path: cliPath,
|
56
|
+
commands
|
57
|
+
} = this.options;
|
58
|
+
this.fs.copyTpl(this.templatePath('cli.js'), this.destinationPath(_path.default.join(cliPath, filename)), {
|
59
|
+
commands
|
60
|
+
});
|
61
|
+
},
|
62
|
+
|
63
|
+
commands() {
|
64
|
+
if (!this.options.commands) {
|
65
|
+
return;
|
66
|
+
}
|
67
|
+
|
68
|
+
const templateData = {};
|
69
|
+
|
70
|
+
const commandsPath = this.options['commands-path'] || _path.default.join(this.options.path, 'commands');
|
71
|
+
|
72
|
+
const srcPath = this.templatePath('commands');
|
73
|
+
const destPath = this.destinationPath(commandsPath);
|
74
|
+
this.fs.copyTpl(srcPath, destPath, templateData);
|
75
|
+
},
|
76
|
+
|
77
|
+
dependencies() {
|
78
|
+
this.addDependencies(['commander', 'debug']);
|
79
|
+
}
|
80
|
+
|
81
|
+
};
|
82
|
+
}
|
83
|
+
|
84
|
+
async install() {
|
85
|
+
if (this.options['skip-install']) {
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
|
89
|
+
await this.spawnCommand('npm', ['install']);
|
90
|
+
}
|
91
|
+
|
92
|
+
};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { program } from 'commander';<% if (commands) { %>
|
2
|
+
|
3
|
+
import defaultCommand from './commands/default';
|
4
|
+
|
5
|
+
program
|
6
|
+
.description('Description')
|
7
|
+
.addCommand(defaultCommand, {
|
8
|
+
isDefault: true,
|
9
|
+
});<% } else { %>
|
10
|
+
|
11
|
+
program
|
12
|
+
.description('Description')
|
13
|
+
.option('-t, --test', 'Test option', 'test')
|
14
|
+
|
15
|
+
<% } %>
|
16
|
+
|
17
|
+
program.parse();<% if(!commands) { %>
|
18
|
+
|
19
|
+
const { test } = program.opts();
|
20
|
+
|
21
|
+
console.log(test);
|
22
|
+
<% } %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { Command } from 'commander';
|
2
|
+
|
3
|
+
const command = new Command('default');
|
4
|
+
|
5
|
+
command
|
6
|
+
.description('Description of default command')
|
7
|
+
.argument('<arg>', 'Argument 1')
|
8
|
+
.option('-t, --test', 'Test option', 'test')
|
9
|
+
.action(async (arg) => {
|
10
|
+
const { test } = program.opts();
|
11
|
+
console.log('This is default command');
|
12
|
+
console.log(`Argument: ${arg}`);
|
13
|
+
console.log(`Option: ${test}`);
|
14
|
+
});
|
15
|
+
|
16
|
+
export default command;
|
@@ -126,10 +126,9 @@ module.exports = class DocsGenerator extends _generator.default {
|
|
126
126
|
'docs:serve': 'npm run docs:prepare && npm run docs:api && gitbook serve',
|
127
127
|
'build:docs': 'npm run docs:prepare && npm run docs:api'
|
128
128
|
};
|
129
|
-
const destPath = this.destinationPath('package.json');
|
130
129
|
const packageJSON = this.fs.exists(destPath) ? this.fs.readJSON(destPath) : {};
|
131
130
|
packageJSON.scripts = _objectSpread(_objectSpread({}, packageJSON.scripts), scripts);
|
132
|
-
this.
|
131
|
+
this.packageJson.merge(packageJSON);
|
133
132
|
}
|
134
133
|
|
135
134
|
};
|
@@ -7,30 +7,20 @@ var _generator = _interopRequireDefault(require("../../lib/generator"));
|
|
7
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
8
|
|
9
9
|
module.exports = class EditorConfigGenerator extends _generator.default {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
console.log('Editor Config Generator');
|
19
|
-
console.log(_chalk.default.yellow('----------------------\n'));
|
20
|
-
}
|
21
|
-
|
22
|
-
};
|
10
|
+
prompting() {
|
11
|
+
if (this.options.quiet) {
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
|
15
|
+
console.log(_chalk.default.yellow('\n----------------------'));
|
16
|
+
console.log('Editor Config Generator');
|
17
|
+
console.log(_chalk.default.yellow('----------------------\n'));
|
23
18
|
}
|
24
19
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
const destPath = this.destinationPath('.editorconfig');
|
30
|
-
this.fs.copy(srcPath, destPath);
|
31
|
-
}
|
32
|
-
|
33
|
-
};
|
20
|
+
writing() {
|
21
|
+
const srcPath = this.templatePath('editorconfig');
|
22
|
+
const destPath = this.destinationPath('.editorconfig');
|
23
|
+
this.fs.copy(srcPath, destPath);
|
34
24
|
}
|
35
25
|
|
36
26
|
};
|
@@ -7,19 +7,14 @@ var _generator = _interopRequireDefault(require("../../lib/generator"));
|
|
7
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
8
|
|
9
9
|
module.exports = class EslintGenerator extends _generator.default {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return;
|
15
|
-
}
|
16
|
-
|
17
|
-
console.log(_chalk.default.yellow('\n----------------------'));
|
18
|
-
console.log('Eslint Generator');
|
19
|
-
console.log(_chalk.default.yellow('----------------------\n'));
|
20
|
-
}
|
10
|
+
prompting() {
|
11
|
+
if (this.options.quiet) {
|
12
|
+
return;
|
13
|
+
}
|
21
14
|
|
22
|
-
|
15
|
+
console.log(_chalk.default.yellow('\n----------------------'));
|
16
|
+
console.log('Eslint Generator');
|
17
|
+
console.log(_chalk.default.yellow('----------------------\n'));
|
23
18
|
}
|
24
19
|
|
25
20
|
get writing() {
|
@@ -34,6 +29,10 @@ module.exports = class EslintGenerator extends _generator.default {
|
|
34
29
|
const srcPath = this.templatePath('eslintignore');
|
35
30
|
const destPath = this.destinationPath('.eslintignore');
|
36
31
|
this.fs.copy(srcPath, destPath);
|
32
|
+
},
|
33
|
+
|
34
|
+
dependencies() {
|
35
|
+
this.addDevDependencies(['babel-preset-airbnb', '@babel/eslint-parser', 'eslint', 'eslint-config-airbnb', 'eslint-config-prettier', 'eslint-plugin-prettier', 'eslint-plugin-import', 'eslint-plugin-jsx-a11y', 'eslint-plugin-react', 'eslint-plugin-formatjs']);
|
37
36
|
}
|
38
37
|
|
39
38
|
};
|
@@ -44,7 +43,7 @@ module.exports = class EslintGenerator extends _generator.default {
|
|
44
43
|
return;
|
45
44
|
}
|
46
45
|
|
47
|
-
await this.
|
46
|
+
await this.spawnCommand('npm', ['install']);
|
48
47
|
}
|
49
48
|
|
50
49
|
};
|