generator-folklore 2.2.55 → 3.0.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.
- package/lib/generators/app/index.js +2 -2
- package/lib/generators/babel/index.js +2 -4
- package/lib/generators/browserslist/index.js +36 -0
- package/lib/generators/browserslist/templates/browserslistrc +9 -0
- package/lib/generators/build/index.js +45 -243
- package/lib/generators/docs/index.js +4 -8
- package/lib/generators/eslint/index.js +2 -10
- package/lib/generators/eslint/templates/eslintrc +29 -3
- package/lib/generators/js/index.js +2 -6
- package/lib/generators/laravel/index.js +2 -2
- package/lib/generators/laravel-panneau/index.js +1 -3
- package/lib/generators/lerna-repository/index.js +1 -3
- package/lib/generators/npm-package/index.js +2 -6
- package/lib/generators/prettier/index.js +35 -0
- package/lib/generators/{eslint → prettier}/templates/prettierrc.json +0 -0
- package/lib/generators/react-package/index.js +2 -6
- package/lib/generators/storybook/index.js +1 -3
- package/lib/generators/stylelint/index.js +2 -4
- package/lib/generators/stylelint/templates/stylelintrc +6 -2
- package/lib/generators/test/index.js +1 -3
- package/package.json +9 -9
- package/lib/generators/build/templates/config.js +0 -78
- package/lib/generators/build/templates/env.js +0 -90
- package/lib/generators/build/templates/paths.js +0 -92
- package/lib/generators/build/templates/polyfills.js +0 -25
- package/lib/generators/build/templates/postcss.config.js +0 -12
- package/lib/generators/build/templates/scripts/build.js +0 -158
- package/lib/generators/build/templates/scripts/imagemin.js +0 -59
- package/lib/generators/build/templates/scripts/modernizr.js +0 -22
- package/lib/generators/build/templates/scripts/server.js +0 -176
- package/lib/generators/build/templates/utils/getConfigValue.js +0 -5
- package/lib/generators/build/templates/utils/getLocalIdent.js +0 -11
- package/lib/generators/build/templates/webpack.config.dev.js +0 -394
- package/lib/generators/build/templates/webpack.config.prod.js +0 -571
- package/lib/generators/build/templates/webpackDevServer.config.js +0 -109
@@ -6,9 +6,9 @@ var _generator = _interopRequireDefault(require("../../lib/generator"));
|
|
6
6
|
|
7
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
8
|
|
9
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
10
10
|
|
11
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
11
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
12
12
|
|
13
13
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
14
14
|
|
@@ -130,15 +130,13 @@ module.exports = class BabelGenerator extends _generator.default {
|
|
130
130
|
}
|
131
131
|
|
132
132
|
if (dependencies.length > 0) {
|
133
|
-
this.
|
133
|
+
this.addDependencies(dependencies, {
|
134
134
|
save: true
|
135
135
|
});
|
136
136
|
}
|
137
137
|
|
138
138
|
if (devDependencies.length > 0) {
|
139
|
-
this.
|
140
|
-
'save-dev': true
|
141
|
-
});
|
139
|
+
this.addDevDependencies(devDependencies);
|
142
140
|
}
|
143
141
|
}
|
144
142
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
4
|
+
|
5
|
+
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
6
|
+
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
|
+
|
9
|
+
module.exports = class BrowsersListGenerator extends _generator.default {
|
10
|
+
get prompting() {
|
11
|
+
return {
|
12
|
+
welcome() {
|
13
|
+
if (this.options.quiet) {
|
14
|
+
return;
|
15
|
+
}
|
16
|
+
|
17
|
+
console.log(_chalk.default.yellow('\n----------------------'));
|
18
|
+
console.log('Browsers list Generator');
|
19
|
+
console.log(_chalk.default.yellow('----------------------\n'));
|
20
|
+
}
|
21
|
+
|
22
|
+
};
|
23
|
+
}
|
24
|
+
|
25
|
+
get writing() {
|
26
|
+
return {
|
27
|
+
editorconfig() {
|
28
|
+
const srcPath = this.templatePath('browserslistrc');
|
29
|
+
const destPath = this.destinationPath('.browserslistrc');
|
30
|
+
this.fs.copy(srcPath, destPath);
|
31
|
+
}
|
32
|
+
|
33
|
+
};
|
34
|
+
}
|
35
|
+
|
36
|
+
};
|
@@ -10,24 +10,22 @@ var _generator = _interopRequireDefault(require("../../lib/generator"));
|
|
10
10
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
12
|
|
13
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
14
|
-
|
15
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
16
|
-
|
17
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
18
|
-
|
19
13
|
module.exports = class AppGenerator extends _generator.default {
|
20
14
|
// The name `constructor` is important here
|
21
15
|
constructor(...args) {
|
22
16
|
super(...args);
|
23
|
-
this.option('path', {
|
17
|
+
this.option('scripts-path', {
|
24
18
|
type: String,
|
25
|
-
defaults: './
|
19
|
+
defaults: './scripts/'
|
26
20
|
});
|
27
21
|
this.option('src-path', {
|
28
22
|
type: String,
|
29
23
|
defaults: './src/'
|
30
24
|
});
|
25
|
+
this.option('entry-path', {
|
26
|
+
type: String,
|
27
|
+
defaults: './src/index.js'
|
28
|
+
});
|
31
29
|
this.option('build-path', {
|
32
30
|
type: String,
|
33
31
|
defaults: './dist/'
|
@@ -38,10 +36,6 @@ module.exports = class AppGenerator extends _generator.default {
|
|
38
36
|
this.option('empty-path', {
|
39
37
|
type: String
|
40
38
|
});
|
41
|
-
this.option('entry-path', {
|
42
|
-
type: String,
|
43
|
-
defaults: './src/index.js'
|
44
|
-
});
|
45
39
|
this.option('html-path', {
|
46
40
|
type: String
|
47
41
|
});
|
@@ -49,248 +43,56 @@ module.exports = class AppGenerator extends _generator.default {
|
|
49
43
|
type: Boolean,
|
50
44
|
defaults: true
|
51
45
|
});
|
52
|
-
this.option('watch-path', {
|
53
|
-
type: String
|
54
|
-
});
|
55
|
-
this.option('server-proxy', {
|
56
|
-
type: Boolean,
|
57
|
-
defaults: false
|
58
|
-
});
|
59
|
-
this.option('server-proxy-host', {
|
60
|
-
type: String
|
61
|
-
});
|
62
|
-
this.option('server-browser-host', {
|
63
|
-
type: String
|
64
|
-
});
|
65
|
-
this.option('modernizr', {
|
66
|
-
type: Boolean,
|
67
|
-
defaults: false
|
68
|
-
});
|
69
|
-
this.option('modernizr-output-path', {
|
70
|
-
type: String,
|
71
|
-
defaults: './dist/modernizr.js'
|
72
|
-
});
|
73
|
-
this.option('imagemin', {
|
74
|
-
type: Boolean,
|
75
|
-
defaults: false
|
76
|
-
});
|
77
|
-
this.option('imagemin-files', {
|
78
|
-
type: String,
|
79
|
-
defaults: './src/img/**/*.{jpg,png,jpeg,gif,svg}'
|
80
|
-
});
|
81
|
-
this.option('imagemin-output-path', {
|
82
|
-
type: String,
|
83
|
-
defaults: './dist/img/'
|
84
|
-
});
|
85
|
-
this.option('copy', {
|
86
|
-
type: Boolean,
|
87
|
-
defaults: false
|
88
|
-
});
|
89
|
-
this.option('copy-path', {
|
90
|
-
type: String
|
91
|
-
});
|
92
46
|
|
93
|
-
this.
|
47
|
+
this.scriptsPath = filePath => this.destinationPath(_path.default.join(this.options.scriptsPath, filePath));
|
94
48
|
}
|
95
49
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
return;
|
101
|
-
}
|
50
|
+
prompting() {
|
51
|
+
if (this.options.quiet) {
|
52
|
+
return;
|
53
|
+
}
|
102
54
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
}
|
107
|
-
|
108
|
-
};
|
55
|
+
console.log(_chalk.default.yellow('\n----------------------'));
|
56
|
+
console.log('Build tools Generator');
|
57
|
+
console.log(_chalk.default.yellow('----------------------\n'));
|
109
58
|
}
|
110
59
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
};
|
124
|
-
const srcPath = this.templatePath('config.js');
|
125
|
-
const destPath = this.buildPath('config.js');
|
126
|
-
this.fs.copyTpl(srcPath, destPath, templateData);
|
127
|
-
},
|
128
|
-
|
129
|
-
env() {
|
130
|
-
const srcPath = this.templatePath('env.js');
|
131
|
-
const destPath = this.buildPath('env.js');
|
132
|
-
this.fs.copy(srcPath, destPath);
|
133
|
-
},
|
134
|
-
|
135
|
-
polyfills() {
|
136
|
-
const srcPath = this.templatePath('polyfills.js');
|
137
|
-
const destPath = this.buildPath('polyfills.js');
|
138
|
-
this.fs.copy(srcPath, destPath);
|
139
|
-
},
|
140
|
-
|
141
|
-
paths() {
|
142
|
-
const templateData = {
|
143
|
-
entryPath: this.options['entry-path'] || null,
|
144
|
-
buildPath: this.options['build-path'] || null,
|
145
|
-
publicPath: this.options['public-path'] || this.options['build-path'] || null,
|
146
|
-
srcPath: this.options['src-path'] || null,
|
147
|
-
htmlPath: this.options['html-path'] || null,
|
148
|
-
watchPaths: (this.options['watch-path'] || null) !== null && !(0, _isArray.default)(this.options['watch-path']) ? [...this.options['watch-path'].split(',')] : this.options['watch-path'],
|
149
|
-
emptyPaths: (this.options['empty-path'] || null) !== null && !(0, _isArray.default)(this.options['empty-path']) ? [...this.options['empty-path'].split(',')] : this.options['empty-path'],
|
150
|
-
copyPaths: (this.options['copy-path'] || null) !== null && !(0, _isArray.default)(this.options['copy-path']) ? [...this.options['copy-path'].split(',')] : this.options['copy-path']
|
151
|
-
};
|
152
|
-
const srcPath = this.templatePath('paths.js');
|
153
|
-
const destPath = this.buildPath('paths.js');
|
154
|
-
this.fs.copyTpl(srcPath, destPath, templateData);
|
155
|
-
},
|
156
|
-
|
157
|
-
utils() {
|
158
|
-
const srcPath = this.templatePath('utils');
|
159
|
-
const destPath = this.buildPath('utils');
|
160
|
-
this.fs.copy(srcPath, destPath);
|
161
|
-
},
|
162
|
-
|
163
|
-
webpack() {
|
164
|
-
const templateData = {};
|
165
|
-
const devSrcPath = this.templatePath('webpack.config.dev.js');
|
166
|
-
const devDestPath = this.buildPath('webpack.config.dev.js');
|
167
|
-
this.fs.copyTpl(devSrcPath, devDestPath, templateData);
|
168
|
-
const prodSrcPath = this.templatePath('webpack.config.prod.js');
|
169
|
-
const prodDestPath = this.buildPath('webpack.config.prod.js');
|
170
|
-
this.fs.copyTpl(prodSrcPath, prodDestPath, templateData);
|
171
|
-
},
|
172
|
-
|
173
|
-
webpackDevServer() {
|
174
|
-
if (!this.options.server) {
|
175
|
-
return;
|
176
|
-
}
|
177
|
-
|
178
|
-
const templateData = {};
|
179
|
-
const srcPath = this.templatePath('webpackDevServer.config.js');
|
180
|
-
const destPath = this.buildPath('webpackDevServer.config.js');
|
181
|
-
this.fs.copyTpl(srcPath, destPath, templateData);
|
182
|
-
},
|
183
|
-
|
184
|
-
postcssConfig() {
|
185
|
-
const templateData = {};
|
186
|
-
const srcPath = this.templatePath('postcss.config.js');
|
187
|
-
const destPath = this.buildPath('postcss.config.js');
|
188
|
-
this.fs.copyTpl(srcPath, destPath, templateData);
|
189
|
-
},
|
190
|
-
|
191
|
-
imagemin() {
|
192
|
-
if (!this.options.imagemin) {
|
193
|
-
return;
|
194
|
-
}
|
195
|
-
|
196
|
-
const templateData = {};
|
197
|
-
const srcPath = this.templatePath('scripts/imagemin.js');
|
198
|
-
const destPath = this.buildPath('scripts/imagemin.js');
|
199
|
-
this.fs.copyTpl(srcPath, destPath, templateData);
|
200
|
-
},
|
201
|
-
|
202
|
-
modernizr() {
|
203
|
-
if (!this.options.modernizr) {
|
204
|
-
return;
|
205
|
-
}
|
206
|
-
|
207
|
-
const templateData = {
|
208
|
-
outputPath: this.options['modernizr-output-path'] || null
|
209
|
-
};
|
210
|
-
const srcPath = this.templatePath('scripts/modernizr.js');
|
211
|
-
const destPath = this.buildPath('scripts/modernizr.js');
|
212
|
-
this.fs.copyTpl(srcPath, destPath, templateData);
|
213
|
-
},
|
214
|
-
|
215
|
-
build() {
|
216
|
-
const templateData = {};
|
217
|
-
const srcPath = this.templatePath('scripts/build.js');
|
218
|
-
const destPath = this.buildPath('scripts/build.js');
|
219
|
-
this.fs.copyTpl(srcPath, destPath, templateData);
|
220
|
-
},
|
221
|
-
|
222
|
-
server() {
|
223
|
-
if (!this.options.server) {
|
224
|
-
return;
|
225
|
-
}
|
226
|
-
|
227
|
-
const templateData = {};
|
228
|
-
const srcPath = this.templatePath('scripts/server.js');
|
229
|
-
const destPath = this.buildPath('scripts/server.js');
|
230
|
-
this.fs.copyTpl(srcPath, destPath, templateData);
|
231
|
-
},
|
232
|
-
|
233
|
-
packageJSON() {
|
234
|
-
const prodWebpackPath = _path.default.join(this.options.path, 'webpack.config.prod.js');
|
235
|
-
|
236
|
-
const scripts = {
|
237
|
-
build: `node ./build/scripts/build.js --config ${prodWebpackPath}`
|
238
|
-
};
|
239
|
-
|
240
|
-
if (this.options.server) {
|
241
|
-
const devWebpackPath = _path.default.join(this.options.path, 'webpack.config.dev.js');
|
242
|
-
|
243
|
-
scripts.server = `node ./build/scripts/server.js --config ${devWebpackPath}`;
|
244
|
-
scripts.start = 'npm run server';
|
245
|
-
}
|
246
|
-
|
247
|
-
const destPath = this.destinationPath('package.json');
|
248
|
-
const currentData = this.fs.exists(destPath) ? this.fs.readJSON(destPath) : {};
|
249
|
-
|
250
|
-
const newData = _objectSpread(_objectSpread({}, currentData), {}, {
|
251
|
-
scripts: _objectSpread(_objectSpread({}, currentData.scripts || null), scripts)
|
252
|
-
});
|
60
|
+
writing() {
|
61
|
+
const {
|
62
|
+
'entry-path': entryPath,
|
63
|
+
'src-path': srcPath,
|
64
|
+
'build-path': buildPath,
|
65
|
+
'public-path': publicPath,
|
66
|
+
'html-path': htmlPath,
|
67
|
+
server
|
68
|
+
} = this.options;
|
69
|
+
const scripts = {
|
70
|
+
build: `flklr build --load-env ${entryPath}`
|
71
|
+
};
|
253
72
|
|
254
|
-
|
73
|
+
if (server) {
|
74
|
+
scripts.server = `flklr serve --load-env ${entryPath}`;
|
75
|
+
scripts.start = 'npm run server';
|
76
|
+
}
|
77
|
+
|
78
|
+
this.packageJson.merge({
|
79
|
+
scripts,
|
80
|
+
build: {
|
81
|
+
outputPath: buildPath,
|
82
|
+
srcPath,
|
83
|
+
htmlPath,
|
84
|
+
publicPath,
|
85
|
+
disableImageOptimization: true
|
255
86
|
}
|
256
|
-
|
257
|
-
};
|
87
|
+
});
|
258
88
|
}
|
259
89
|
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
return;
|
265
|
-
}
|
266
|
-
|
267
|
-
const devDependencies = [// Loaders
|
268
|
-
'babel-loader@latest', 'css-loader@latest', 'eslint-loader@latest', 'file-loader@latest', 'postcss-loader@latest', 'sass-loader@latest', 'style-loader@latest', 'url-loader@latest', // Plugins
|
269
|
-
'html-webpack-plugin@^4.0.0-alpha.2', 'webpack-manifest-plugin@latest', 'case-sensitive-paths-webpack-plugin@latest', 'postcss-preset-env@latest', 'postcss-safe-parser@latest', 'postcss-flexbugs-fixes@latest', 'pnp-webpack-plugin@latest', 'babel-preset-react-app@^6.1.0', 'babel-plugin-named-asset-import@latest', 'terser-webpack-plugin@latest', 'mini-css-extract-plugin@latest', 'optimize-css-assets-webpack-plugin@latest', 'workbox-webpack-plugin@latest', // Others
|
270
|
-
'autoprefixer@latest', 'cssnano@latest', 'chalk@latest', 'dotenv@latest', 'dotenv-expand@latest', 'node-sass@latest', 'fs-extra@latest', 'glob@latest', 'pretty-bytes@latest', 'react-dev-utils@^10.0.0', 'webpack@^4.0' // TODO: update webpack 4
|
271
|
-
];
|
272
|
-
const dependencies = ['whatwg-fetch', 'core-js@^2.4.0', 'promise', 'raf', 'lodash@latest', 'object-assign'];
|
273
|
-
|
274
|
-
if (this.options.server) {
|
275
|
-
devDependencies.push('webpack-dev-server@^3.1');
|
276
|
-
}
|
90
|
+
async install() {
|
91
|
+
if (this.options['skip-install']) {
|
92
|
+
return;
|
93
|
+
}
|
277
94
|
|
278
|
-
|
279
|
-
devDependencies.push('imagemin@latest');
|
280
|
-
devDependencies.push('imagemin-mozjpeg@latest');
|
281
|
-
devDependencies.push('imagemin-svgo@latest');
|
282
|
-
devDependencies.push('imagemin-pngquant@latest');
|
283
|
-
}
|
284
|
-
|
285
|
-
this.npmInstall(dependencies, {
|
286
|
-
save: true
|
287
|
-
});
|
288
|
-
this.npmInstall(devDependencies, {
|
289
|
-
'save-dev': true
|
290
|
-
});
|
291
|
-
}
|
292
|
-
|
293
|
-
};
|
95
|
+
await this.addDevDependencies(['@folklore/cli']);
|
294
96
|
}
|
295
97
|
|
296
98
|
};
|
@@ -10,9 +10,9 @@ var _generator = _interopRequireDefault(require("../../lib/generator"));
|
|
10
10
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
12
|
|
13
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
14
14
|
|
15
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
16
16
|
|
17
17
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
18
18
|
|
@@ -142,14 +142,10 @@ module.exports = class DocsGenerator extends _generator.default {
|
|
142
142
|
return;
|
143
143
|
}
|
144
144
|
|
145
|
-
this.
|
146
|
-
'save-dev': true
|
147
|
-
});
|
145
|
+
this.addDevDependencies(['gitbook-cli@latest']);
|
148
146
|
|
149
147
|
if (this.options.language === 'js') {
|
150
|
-
this.
|
151
|
-
'save-dev': true
|
152
|
-
});
|
148
|
+
this.addDevDependencies(['jsdoc@latest', 'jsdoc-babel@latest']);
|
153
149
|
}
|
154
150
|
}
|
155
151
|
|
@@ -34,25 +34,17 @@ module.exports = class EslintGenerator extends _generator.default {
|
|
34
34
|
const srcPath = this.templatePath('eslintignore');
|
35
35
|
const destPath = this.destinationPath('.eslintignore');
|
36
36
|
this.fs.copy(srcPath, destPath);
|
37
|
-
},
|
38
|
-
|
39
|
-
prettierrc() {
|
40
|
-
const srcPath = this.templatePath('prettierrc.json');
|
41
|
-
const destPath = this.destinationPath('.prettierrc.json');
|
42
|
-
this.fs.copy(srcPath, destPath);
|
43
37
|
}
|
44
38
|
|
45
39
|
};
|
46
40
|
}
|
47
41
|
|
48
|
-
install() {
|
42
|
+
async install() {
|
49
43
|
if (this.options['skip-install']) {
|
50
44
|
return;
|
51
45
|
}
|
52
46
|
|
53
|
-
this.
|
54
|
-
'save-dev': true
|
55
|
-
});
|
47
|
+
await 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']);
|
56
48
|
}
|
57
49
|
|
58
50
|
};
|
@@ -1,6 +1,14 @@
|
|
1
1
|
{
|
2
|
-
"extends": ["airbnb", "prettier"
|
3
|
-
"
|
2
|
+
"extends": ["airbnb", "prettier"],
|
3
|
+
"plugins": ["formatjs"],
|
4
|
+
"parser": "@babel/eslint-parser",
|
5
|
+
"parserOptions": {
|
6
|
+
"ecmaVersion": "latest",
|
7
|
+
"requireConfigFile": false,
|
8
|
+
"babelOptions": {
|
9
|
+
"presets": ["@babel/preset-react"]
|
10
|
+
}
|
11
|
+
},
|
4
12
|
"env": {
|
5
13
|
"browser": true,
|
6
14
|
"node": true,
|
@@ -10,7 +18,25 @@
|
|
10
18
|
"rules": {
|
11
19
|
"react/jsx-indent": ["error", 4],
|
12
20
|
"react/jsx-indent-props": ["error", 4],
|
13
|
-
"
|
21
|
+
"react/function-component-definition": [
|
22
|
+
"error",
|
23
|
+
{
|
24
|
+
"namedComponents": [
|
25
|
+
"arrow-function",
|
26
|
+
"function-declaration",
|
27
|
+
"function-expression"
|
28
|
+
],
|
29
|
+
"unnamedComponents": "function-expression"
|
30
|
+
}
|
31
|
+
],
|
32
|
+
"no-console": [
|
33
|
+
"error",
|
34
|
+
{
|
35
|
+
"allow": ["warn", "error"]
|
36
|
+
}
|
37
|
+
],
|
38
|
+
"formatjs/enforce-default-message": ["error", "literal"],
|
39
|
+
"formatjs/no-camel-case": ["error"]
|
14
40
|
},
|
15
41
|
"globals": {
|
16
42
|
"__DEV__": true
|
@@ -149,12 +149,8 @@ module.exports = class JsGenerator extends _generator.default {
|
|
149
149
|
|
150
150
|
const dependencies = ['domready@latest', 'fastclick@latest', 'keymirror@latest', 'lodash@latest', 'react@latest', 'prop-types@latest', 'react-dom@latest', 'react-redux@latest', 'react-intl@latest', 'react-router@^5.0.1', 'react-router-dom@latest', 'connected-react-router@latest', 'react-helmet@latest', 'node-polyglot@latest', 'classnames@latest', '@folklore/react-container@latest', '@folklore/fonts@latest', '@folklore/forms@latest', '@folklore/tracking@latest', 'react-loadable@latest', 'webfontloader@latest', 'intl@latest'];
|
151
151
|
const devDependencies = ['html-webpack-plugin@latest'];
|
152
|
-
this.
|
153
|
-
|
154
|
-
});
|
155
|
-
this.npmInstall(devDependencies, {
|
156
|
-
'save-dev': true
|
157
|
-
});
|
152
|
+
this.addDependencies(dependencies);
|
153
|
+
this.addDevDependencies(devDependencies);
|
158
154
|
}
|
159
155
|
|
160
156
|
};
|
@@ -16,9 +16,9 @@ var _generator = _interopRequireDefault(require("../../lib/generator"));
|
|
16
16
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18
18
|
|
19
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
19
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
20
20
|
|
21
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
22
22
|
|
23
23
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
24
24
|
|
@@ -219,9 +219,7 @@ module.exports = class LernaRepositoryGenerator extends _generator.default {
|
|
219
219
|
return;
|
220
220
|
}
|
221
221
|
|
222
|
-
this.
|
223
|
-
'save-dev': true
|
224
|
-
});
|
222
|
+
this.addDevDependencies(['lerna@latest', 'glob@latest', 'mkdirp@latest', '@babel/runtime@latest']);
|
225
223
|
},
|
226
224
|
|
227
225
|
bootstrap() {
|
@@ -242,12 +242,8 @@ module.exports = class NpmPackageGenerator extends _generator.default {
|
|
242
242
|
return;
|
243
243
|
}
|
244
244
|
|
245
|
-
this.
|
246
|
-
|
247
|
-
});
|
248
|
-
this.npmInstall(['jest@latest'], {
|
249
|
-
'save-dev': true
|
250
|
-
});
|
245
|
+
this.addDependencies(['@babel/runtime@latest']);
|
246
|
+
this.addDevDependencies(['jest@latest']);
|
251
247
|
}
|
252
248
|
|
253
249
|
};
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
4
|
+
|
5
|
+
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
6
|
+
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
|
+
|
9
|
+
module.exports = class PrettierGenerator extends _generator.default {
|
10
|
+
get prompting() {
|
11
|
+
return {
|
12
|
+
welcome() {
|
13
|
+
if (this.options.quiet) {
|
14
|
+
return;
|
15
|
+
}
|
16
|
+
|
17
|
+
console.log(_chalk.default.yellow('\n----------------------'));
|
18
|
+
console.log('Prettier Generator');
|
19
|
+
console.log(_chalk.default.yellow('----------------------\n'));
|
20
|
+
}
|
21
|
+
|
22
|
+
};
|
23
|
+
}
|
24
|
+
|
25
|
+
writing() {
|
26
|
+
const srcPath = this.templatePath('prettierrc.json');
|
27
|
+
const destPath = this.destinationPath('.prettierrc.json');
|
28
|
+
this.fs.copy(srcPath, destPath);
|
29
|
+
}
|
30
|
+
|
31
|
+
install() {
|
32
|
+
this.addDevDependencies(['prettier', '@prettier/plugin-php']);
|
33
|
+
}
|
34
|
+
|
35
|
+
};
|
File without changes
|
@@ -184,9 +184,7 @@ module.exports = class ReactPackageGenerator extends _generator.default {
|
|
184
184
|
return;
|
185
185
|
}
|
186
186
|
|
187
|
-
this.
|
188
|
-
save: true
|
189
|
-
});
|
187
|
+
this.addDependencies(['react@latest', 'prop-types@latest', 'react-dom@latest']);
|
190
188
|
},
|
191
189
|
|
192
190
|
npmInstallDev() {
|
@@ -194,9 +192,7 @@ module.exports = class ReactPackageGenerator extends _generator.default {
|
|
194
192
|
return;
|
195
193
|
}
|
196
194
|
|
197
|
-
this.
|
198
|
-
'save-dev': true
|
199
|
-
});
|
195
|
+
this.addDevDependencies(['domready@latest', 'jquery@latest', 'enzyme@latest', 'react-test-renderer@latest', '@storybook/react@latest', '@storybook/addon-actions@latest', 'extract-text-webpack-plugin@latest', 'html-webpack-plugin@latest']);
|
200
196
|
}
|
201
197
|
|
202
198
|
};
|
@@ -85,9 +85,7 @@ module.exports = class StorybookGenerator extends _generator.default {
|
|
85
85
|
return;
|
86
86
|
}
|
87
87
|
|
88
|
-
this.
|
89
|
-
'save-dev': true
|
90
|
-
});
|
88
|
+
this.addDevDependencies(['@storybook/addon-actions@latest', '@storybook/addon-info@latest', '@storybook/addon-storyshots@latest', '@storybook/addons@latest', '@storybook/react@latest', '@storybook/storybook-deployer@latest', 'glob-loader@latest']);
|
91
89
|
}
|
92
90
|
|
93
91
|
};
|