generator-folklore 3.0.0-alpha.0 → 3.0.0-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. package/lib/generators/babel/index.js +2 -4
  2. package/lib/generators/browserslist/templates/browserslistrc +8 -8
  3. package/lib/generators/build/index.js +45 -243
  4. package/lib/generators/docs/index.js +2 -6
  5. package/lib/generators/eslint/index.js +2 -10
  6. package/lib/generators/js/index.js +2 -6
  7. package/lib/generators/laravel-panneau/index.js +1 -3
  8. package/lib/generators/lerna-repository/index.js +1 -3
  9. package/lib/generators/npm-package/index.js +2 -6
  10. package/lib/generators/prettier/index.js +35 -0
  11. package/lib/generators/{eslint → prettier}/templates/prettierrc.json +0 -0
  12. package/lib/generators/react-package/index.js +2 -6
  13. package/lib/generators/storybook/index.js +1 -3
  14. package/lib/generators/stylelint/index.js +2 -4
  15. package/lib/generators/test/index.js +1 -3
  16. package/package.json +2 -2
  17. package/lib/generators/build/templates/config.js +0 -78
  18. package/lib/generators/build/templates/env.js +0 -90
  19. package/lib/generators/build/templates/paths.js +0 -92
  20. package/lib/generators/build/templates/polyfills.js +0 -25
  21. package/lib/generators/build/templates/postcss.config.js +0 -12
  22. package/lib/generators/build/templates/scripts/build.js +0 -158
  23. package/lib/generators/build/templates/scripts/imagemin.js +0 -59
  24. package/lib/generators/build/templates/scripts/modernizr.js +0 -22
  25. package/lib/generators/build/templates/scripts/server.js +0 -176
  26. package/lib/generators/build/templates/utils/getConfigValue.js +0 -5
  27. package/lib/generators/build/templates/utils/getLocalIdent.js +0 -11
  28. package/lib/generators/build/templates/webpack.config.dev.js +0 -394
  29. package/lib/generators/build/templates/webpack.config.prod.js +0 -571
  30. package/lib/generators/build/templates/webpackDevServer.config.js +0 -109
@@ -130,15 +130,13 @@ module.exports = class BabelGenerator extends _generator.default {
130
130
  }
131
131
 
132
132
  if (dependencies.length > 0) {
133
- this.npmInstall(dependencies, {
133
+ this.addDependencies(dependencies, {
134
134
  save: true
135
135
  });
136
136
  }
137
137
 
138
138
  if (devDependencies.length > 0) {
139
- this.npmInstall(devDependencies, {
140
- 'save-dev': true
141
- });
139
+ this.addDevDependencies(devDependencies);
142
140
  }
143
141
  }
144
142
 
@@ -1,9 +1,9 @@
1
- root = true
1
+ [production]
2
+ last 20 versions
3
+ > 1%
4
+ ie >= 10
2
5
 
3
- [*]
4
- charset = utf-8
5
- end_of_line = lf
6
- indent_size = 4
7
- indent_style = space
8
- insert_final_newline = true
9
- trim_trailing_whitespace = true
6
+ [development]
7
+ last 10 versions
8
+ > 1%
9
+ ie >= 10
@@ -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); 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 = 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
-
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: './build/'
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.buildPath = filePath => this.destinationPath(_path.default.join(this.options.path, filePath));
47
+ this.scriptsPath = filePath => this.destinationPath(_path.default.join(this.options.scriptsPath, filePath));
94
48
  }
95
49
 
96
- get prompting() {
97
- return {
98
- welcome() {
99
- if (this.options.quiet) {
100
- return;
101
- }
50
+ prompting() {
51
+ if (this.options.quiet) {
52
+ return;
53
+ }
102
54
 
103
- console.log(_chalk.default.yellow('\n----------------------'));
104
- console.log('Build tools Generator');
105
- console.log(_chalk.default.yellow('----------------------\n'));
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
- get writing() {
112
- return {
113
- config() {
114
- const templateData = {
115
- hasHtml: (this.options['html-path'] || null) !== null,
116
- hasServer: this.options.server || false,
117
- hasServerProxy: this.options['server-proxy'] || false,
118
- serverProxyHost: this.options['server-proxy-host'] || null,
119
- serverBrowserHost: this.options['server-browser-host'] || null,
120
- hasImagemin: this.options.imagemin,
121
- imageminFiles: (this.options['imagemin-files'] || null) !== null && !(0, _isArray.default)(this.options['imagemin-files']) ? [this.options['imagemin-files']] : this.options['imagemin-files'],
122
- imageminOutputPath: this.options['imagemin-output-path'] || null
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
- this.fs.writeJSON(destPath, newData);
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
- get install() {
261
- return {
262
- npm() {
263
- if (this.options['skip-install']) {
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
- if (this.options.imagemin) {
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
  };
@@ -142,14 +142,10 @@ module.exports = class DocsGenerator extends _generator.default {
142
142
  return;
143
143
  }
144
144
 
145
- this.npmInstall(['gitbook-cli@latest'], {
146
- 'save-dev': true
147
- });
145
+ this.addDevDependencies(['gitbook-cli@latest']);
148
146
 
149
147
  if (this.options.language === 'js') {
150
- this.npmInstall(['jsdoc@latest', 'jsdoc-babel@latest'], {
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.npmInstall(['babel-preset-airbnb@latest', '@babel/eslint-parser@latest', 'eslint@latest', 'eslint-config-airbnb@latest', 'eslint-config-prettier@latest', 'eslint-plugin-prettier@latest', 'eslint-plugin-import', 'eslint-plugin-jsx-a11y', 'eslint-plugin-react', 'eslint-plugin-formatjs'], {
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
  };
@@ -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.npmInstall(dependencies, {
153
- save: true
154
- });
155
- this.npmInstall(devDependencies, {
156
- 'save-dev': true
157
- });
152
+ this.addDependencies(dependencies);
153
+ this.addDevDependencies(devDependencies);
158
154
  }
159
155
 
160
156
  };
@@ -142,9 +142,7 @@ module.exports = class LaravelPanneauGenerator extends _generator.default {
142
142
  return;
143
143
  }
144
144
 
145
- this.npmInstall(['panneau@^0.6.53'], {
146
- save: true
147
- });
145
+ this.addDependencies(['panneau@^0.6.53']);
148
146
  }
149
147
 
150
148
  };
@@ -219,9 +219,7 @@ module.exports = class LernaRepositoryGenerator extends _generator.default {
219
219
  return;
220
220
  }
221
221
 
222
- this.npmInstall(['lerna@latest', 'glob@latest', 'mkdirp@latest', '@babel/runtime@latest'], {
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.npmInstall(['@babel/runtime@latest'], {
246
- save: true
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
+ };
@@ -184,9 +184,7 @@ module.exports = class ReactPackageGenerator extends _generator.default {
184
184
  return;
185
185
  }
186
186
 
187
- this.npmInstall(['react@latest', 'prop-types@latest', 'react-dom@latest'], {
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.npmInstall(['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'], {
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.npmInstall(['@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'], {
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
  };
@@ -44,14 +44,12 @@ module.exports = class StylelintGenerator extends _generator.default {
44
44
  };
45
45
  }
46
46
 
47
- install() {
47
+ async install() {
48
48
  if (this.options['skip-install']) {
49
49
  return;
50
50
  }
51
51
 
52
- this.npmInstall(['stylelint', 'stylelint-config-standard-scss', 'stylelint-config-idiomatic-order', 'stylelint-config-prettier'], {
53
- 'save-dev': true
54
- });
52
+ await this.addDevDependencies(['stylelint', 'stylelint-config-standard-scss', 'stylelint-config-idiomatic-order', 'stylelint-config-prettier']);
55
53
  }
56
54
 
57
55
  };
@@ -67,9 +67,7 @@ module.exports = class TestGenerator extends _generator.default {
67
67
  return;
68
68
  }
69
69
 
70
- this.npmInstall(['babel-jest@latest', 'enzyme@latest', 'enzyme-adapter-react-16@latest', 'eslint-plugin-jest@latest', 'jest@latest', 'jsdom@latest', 'react-test-renderer@latest', 'sinon@latest'], {
71
- 'save-dev': true
72
- });
70
+ this.addDevDependencies(['babel-jest@latest', 'enzyme@latest', 'enzyme-adapter-react-16@latest', 'eslint-plugin-jest@latest', 'jest@latest', 'jsdom@latest', 'react-test-renderer@latest', 'sinon@latest']);
73
71
  }
74
72
 
75
73
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-folklore",
3
- "version": "3.0.0-alpha.0",
3
+ "version": "3.0.0-alpha.1",
4
4
  "description": "Yeoman generator for projects at Folklore",
5
5
  "keywords": [
6
6
  "yeoman-generator"
@@ -39,5 +39,5 @@
39
39
  "yeoman-generator": "^5.6.1",
40
40
  "yeoman-remote": "^1.0.1"
41
41
  },
42
- "gitHead": "5bdcf501c865ab0ec3bb655d7d1cf88dab6ff5b6"
42
+ "gitHead": "5f74c1ecec6fcc42f26e76d14955ac4e7ea48cb0"
43
43
  }
@@ -1,78 +0,0 @@
1
- /* eslint-disable no-console, global-require */
2
- /* eslint-disable import/no-extraneous-dependencies, import/no-dynamic-require, import/order */
3
- module.exports = {
4
- /**
5
- * Webpack
6
- */
7
- webpack: {
8
- filename: <% if (hasHtml) { %>() => 'js/main-[hash:8].js'<% } else { %>() => 'js/main.js'<% } %>,
9
- chunkFilename: () => 'js/[name]-[hash:8].chunk.js',
10
- publicPath: '/',
11
-
12
- cssRegex: /\.global\.css$/,
13
- cssModuleRegex: /\.css$/,
14
- sassRegex: /\.global\.(scss|sass)$/,
15
- sassModuleRegex: /\.(scss|sass)$/,
16
-
17
- cssFilename: <% if (hasHtml) { %>() => 'css/[name]-[contenthash:8].css'<% } else { %>() => 'css/[name].css'<% } %>,
18
- cssChunkFilename: () => 'css/[name]-[contenthash:8].chunk.css',
19
- cssLocalIdent: '[name]-[local]',
20
-
21
- imageFilename: () => 'img/[name]-[hash:8].[ext]',
22
- imagePublicPath: '/',
23
-
24
- mediaFilename: () => 'medias/[name]-[hash:8].[ext]',
25
- mediaPublicPath: '/',
26
-
27
- fontFilename: () => 'fonts/[name]-[hash:8].[ext]',
28
- },
29
- <% if (hasServer) { %>
30
- /**
31
- * Webpack Dev Server
32
- */
33
- webpackDevServer: {
34
- <% if (hasServerProxy) {
35
- %> browserHost: '<%= serverBrowserHost %>',
36
- proxy: '<%= serverProxyHost %>',
37
- https: false,<% } %>
38
- },<% } %>
39
-
40
- /**
41
- * PostCSS
42
- */
43
- postcss: {
44
- ident: 'postcss',
45
- plugins: [
46
- require('postcss-flexbugs-fixes'),
47
- require('postcss-preset-env')({
48
- autoprefixer: {
49
- flexbox: 'no-2009',
50
- },
51
- stage: 3,
52
- }),
53
- ],
54
- },
55
-
56
- <% if (hasImagemin) {
57
- %> /**
58
- * Imagemin
59
- */
60
- imagemin: {
61
- files: [<% (imageminFiles || []).forEach((file) => {
62
- %> '<%= file %>',
63
- <% }) %> ],
64
- output: '<%= imageminOutputPath %>',
65
-
66
- pngquant: {
67
- quality: '65-80',
68
- },
69
-
70
- svgo: {
71
- plugins: [
72
- {
73
- removeViewBox: false,
74
- },
75
- ],
76
- },
77
- },<% } %>
78
- };