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,309 +1,392 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _got = _interopRequireDefault(require("got"));
9
-
10
- var _path = require("path");
11
-
12
- var _gulpIf = _interopRequireDefault(require("gulp-if"));
13
-
14
- var _dateFns = require("date-fns");
15
-
16
- var _fs = _interopRequireDefault(require("../util/fs"));
17
-
18
- var _gulpPrettier = _interopRequireDefault(require("gulp-prettier"));
19
-
20
- var _jsonfile = require("jsonfile");
21
-
22
- var _yeomanStylelint = _interopRequireDefault(require("yeoman-stylelint"));
23
-
24
- var _spdxLicenseIds = _interopRequireDefault(require("spdx-license-ids"));
25
-
26
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
-
28
- _spdxLicenseIds.default.push('SEE LICENSE IN LICENSE');
29
-
30
- _spdxLicenseIds.default.sort(); // we cannot use ES6 imports on this object, as it directly exports a class to
31
- // module.exports - no default export nor a named export is present for us to use
32
-
33
-
34
- const Generator = require('yeoman-generator');
35
-
36
- const src = (...paths) => (0, _path.join)('src', ...paths);
37
-
38
- const getPrettierConfig = () => (0, _jsonfile.readFileSync)((0, _path.join)(__dirname, '..', '..', '.prettierrc'));
39
-
40
- const styleFrameworks = [{
41
- value: null,
42
- name: 'None'
43
- }, {
44
- value: 'bootstrap',
45
- name: 'Bootstrap'
46
- }, {
47
- value: 'bulma',
48
- name: 'Bulma'
49
- }, {
50
- value: 'foundation',
51
- name: 'Foundation'
52
- }, {
53
- value: 'materialize',
54
- name: 'Materialize'
55
- }, {
56
- value: 'uikit',
57
- name: 'UIKit'
58
- }, {
59
- value: 'materialUi',
60
- name: 'Material-UI'
61
- }];
62
- const packages = {
63
- fontAwesome: ['@fortawesome/fontawesome-svg-core', '@fortawesome/free-solid-svg-icons', '@fortawesome/react-fontawesome'],
64
- bootstrap: ['bootstrap'],
65
- uikit: ['uikit', 'uikit-react'],
66
- foundation: ['foundation-sites'],
67
- materialize: ['materialize-css'],
68
- bulma: ['bulma'],
69
- materialUi: ['@material-ui/core'],
70
- lintStaged: ['husky', 'lint-staged'],
71
- redux: ['redux', 'react-redux', 'redux-saga'],
72
- reduxJest: ['redux-mock-store'],
73
- core: ['@babel/runtime', 'core-js', 'normalize-scss', 'prop-types', 'react', 'react-dom', 'react-router-dom', 'reselect', 'classnames'],
74
- storybook: ['@storybook/react', '@storybook/addons', '@storybook/addon-knobs'],
75
- esdoc: ['esdoc', 'esdoc-ecmascript-proposal-plugin', 'esdoc-jsx-plugin', 'esdoc-standard-plugin', 'opener'],
76
- jest: ['babel-jest', 'eslint-plugin-jest', 'jest', 'react-test-renderer', 'opener'],
77
- dev: ['@babel/core', '@babel/eslint-parser', '@babel/plugin-proposal-class-properties', '@babel/plugin-proposal-object-rest-spread', '@babel/plugin-transform-regenerator', '@babel/plugin-transform-runtime', '@babel/preset-env', '@babel/preset-react', '@babel/register', 'autoprefixer', 'babel-loader', 'clean-webpack-plugin', 'cross-env', 'css-loader', 'css-minimizer-webpack-plugin', 'eslint-config-prettier', 'eslint-import-resolver-webpack', 'eslint-plugin-import', 'eslint-plugin-jsx-a11y', 'eslint-plugin-prettier', 'eslint-plugin-react-hooks', 'eslint-plugin-react', 'eslint-webpack-plugin', 'eslint', 'html-loader', 'html-webpack-plugin', 'mini-css-extract-plugin', 'postcss-flexbugs-fixes', 'postcss-loader', 'prettier-eslint', 'prettier-stylelint', 'prettier', 'sass-loader', 'sass', 'style-loader', 'stylelint-a11y', 'stylelint-config-recommended', 'stylelint-webpack-plugin', 'stylelint', 'terser-webpack-plugin', 'webpack-cli', 'webpack', 'webpack-dev-server']
78
- };
79
- const files = {
80
- core: ['.babelrc', '.prettierrc', '.stylelintrc', '.editorconfig', 'jsconfig.json', '.browserslistrc', src('utils', 'index.js')],
81
- templated: ['.eslintrc.js', 'package.json', src('index.js'), src('index.html'), src('index.scss'), 'webpack.config.babel.js'],
82
- esdoc: ['.esdoc.json'],
83
- jest: ['jest.config.js'],
84
- lintStaged: ['.lintstagedrc'],
85
- fontAwesome: [src('icons.js')]
86
- };
87
- const directories = {
88
- redux: [src('reducers'), src('sagas'), src('selectors')],
89
- core: [src('components'), src('utils')]
90
- };
91
- const scripts = {
92
- esdoc: {
93
- 'build:documentation': 'esdoc',
94
- 'view:documentation': 'opener ./docs/index.html'
95
- },
96
- jest: {
97
- test: 'jest',
98
- 'view:coverage': 'opener ./coverage/index.html'
99
- }
100
- };
101
-
102
- class _default extends Generator {
103
- constructor(...args) {
104
- super(...args);
105
- this.env.adapter.promptModule.registerPrompt('autocomplete', require('inquirer-autocomplete-prompt'));
106
- this.sourceRoot((0, _path.join)(__dirname, '..', '..', 'templates', 'app'));
107
- this.answers = {};
108
- this.fileSystem = (0, _fs.default)(this);
109
- this.registerTransformStream((0, _gulpIf.default)(/\.js$/, (0, _gulpPrettier.default)(getPrettierConfig())));
110
- this.registerTransformStream((0, _gulpIf.default)(/\.scss$/, (0, _yeomanStylelint.default)({
111
- configFile: (0, _path.join)(__dirname, '..', '..', '.stylelintrc')
112
- })));
113
- }
114
-
115
- async prompting() {
116
- const {
117
- name,
118
- email
119
- } = this.user.git;
120
- this.answers = await this.prompt([{
121
- type: 'input',
122
- name: 'package.name',
123
- message: 'Package name',
124
- default: this.appname.replace(/\s+/g, '-')
125
- }, {
126
- type: 'input',
127
- name: 'package.version',
128
- message: 'Package version',
129
- default: '0.1.0'
130
- }, {
131
- type: 'autocomplete',
132
- name: 'package.license',
133
- message: 'Package license',
134
- source: (_, input) => {
135
- const pattern = new RegExp(`.*${input}.*`, 'i');
136
- return new Promise(resolve => {
137
- resolve(_spdxLicenseIds.default.filter(identifier => pattern.test(identifier)));
138
- });
139
- }
140
- }, {
141
- type: 'input',
142
- name: 'package.description',
143
- message: 'Package description'
144
- }, {
145
- type: 'input',
146
- name: 'author.name',
147
- message: 'Author name',
148
- default: name()
149
- }, {
150
- type: 'input',
151
- name: 'author.email',
152
- message: 'Author email address',
153
- default: email()
154
- }, {
155
- type: 'list',
156
- name: 'styleFramework',
157
- message: 'What CSS framework would you like to use?',
158
- choices: styleFrameworks
159
- }, {
160
- type: 'confirm',
161
- name: 'flags.addLintStaged',
162
- message: 'Force linting before commits?',
163
- default: true
164
- }, {
165
- type: 'confirm',
166
- name: 'flags.addFontAwesome',
167
- message: 'Add Font Awesome?',
168
- default: true
169
- }, {
170
- type: 'confirm',
171
- name: 'flags.addRedux',
172
- message: 'Add Redux?',
173
- default: true
174
- }, {
175
- type: 'confirm',
176
- name: 'flags.addJest',
177
- message: 'Add Jest?',
178
- default: true
179
- }, {
180
- type: 'confirm',
181
- name: 'flags.addStorybook',
182
- message: 'Add Storybook?',
183
- default: false
184
- }, {
185
- type: 'confirm',
186
- name: 'flags.addESDoc',
187
- message: 'Add ESDoc?',
188
- default: false
189
- }]);
190
- }
191
-
192
- async writing() {
193
- const {
194
- flags,
195
- package: {
196
- license
197
- },
198
- author: {
199
- name,
200
- email
201
- }
202
- } = this.answers;
203
- let licenseText = 'Place your license here.\n';
204
-
205
- if (license !== 'SEE LICENSE IN LICENSE') {
206
- this.log(`Downloading ${license} license from spdx/license-list-data...`);
207
- const {
208
- body: rawLicense
209
- } = await (0, _got.default)(`https://raw.githubusercontent.com/spdx/license-list-data/master/text/${license}.txt`);
210
- licenseText = rawLicense.replace('<year>', (0, _dateFns.format)(new Date(), 'yyyy')).replace('<copyright holders>', `${name} <${email}>`);
211
- }
212
-
213
- this.fileSystem.createFile('LICENSE', licenseText); // copy files and directories
214
-
215
- files.core.forEach(this.fileSystem.copy);
216
- files.templated.forEach(this.fileSystem.copyTemplateInPlace);
217
- directories.core.forEach(this.fileSystem.copyDirectory); // this is a workaround for npm not packaging up .gitignore files
218
-
219
- this.fileSystem.copyTo('gitignore', '.gitignore');
220
-
221
- if (flags.addRedux) {
222
- directories.redux.forEach(this.fileSystem.copyDirectory);
223
- }
224
-
225
- if (flags.addJest) {
226
- files.jest.forEach(this.fileSystem.copy);
227
- this.fs.append(this.destinationPath('.gitignore'), 'coverage/');
228
- this.fs.extendJSON(this.destinationPath('package.json'), {
229
- scripts: { ...scripts.jest
230
- }
231
- });
232
- }
233
-
234
- if (flags.addESDoc) {
235
- files.esdoc.forEach(this.fileSystem.copy);
236
- this.fs.append(this.destinationPath('.gitignore'), 'docs/');
237
- this.fs.extendJSON(this.destinationPath('package.json'), {
238
- scripts: { ...scripts.esdoc
239
- }
240
- });
241
- }
242
-
243
- if (flags.addLintStaged) {
244
- files.lintStaged.forEach(this.fileSystem.copy);
245
- }
246
-
247
- if (flags.addFontAwesome) {
248
- files.fontAwesome.forEach(this.fileSystem.copy);
249
- }
250
- }
251
-
252
- install() {
253
- const main = [];
254
- const dev = [];
255
- const {
256
- flags,
257
- styleFramework
258
- } = this.answers;
259
- this.log('Building a list of packages to install');
260
- main.push.apply(main, packages.core);
261
- dev.push.apply(dev, packages.dev);
262
-
263
- if (styleFramework !== null) {
264
- main.push.apply(main, packages[styleFramework]);
265
- }
266
-
267
- if (flags.addLintStaged) {
268
- dev.push.apply(dev, packages.lintStaged);
269
- }
270
-
271
- if (flags.addFontAwesome) {
272
- main.push.apply(main, packages.fontAwesome);
273
- }
274
-
275
- if (flags.addRedux) {
276
- main.push.apply(main, packages.redux);
277
- }
278
-
279
- if (flags.addJest) {
280
- dev.push.apply(dev, packages.jest);
281
- }
282
-
283
- if (flags.addRedux && flags.addJest) {
284
- dev.push.apply(dev, packages.reduxJest);
285
- }
286
-
287
- if (flags.addStorybook) {
288
- dev.push.apply(dev, packages.storybook);
289
- }
290
-
291
- if (flags.addESDoc) {
292
- main.push.apply(main, packages.esdoc);
293
- }
294
-
295
- this.log(`Getting ready to install ${main.length} dependencies and ${dev.length} dev dependencies.`);
296
- this.npmInstall(main, {
297
- save: true
298
- });
299
- this.npmInstall(dev, {
300
- 'save-dev': true
301
- });
302
- this.spawnCommandSync('git', ['init']);
303
- this.spawnCommandSync('npx', ['husky', 'install']);
304
- this.spawnCommandSync('npx', ['husky', 'add', '.husky/pre-commit', 'npx lint-staged']);
305
- }
306
-
307
- }
308
-
309
- exports.default = _default;
1
+ import { got } from 'got';
2
+ import { join } from 'path';
3
+ import gulpIf from 'gulp-if';
4
+ import jsonfile from 'jsonfile';
5
+ import { format } from 'date-fns';
6
+ import prettier from 'gulp-prettier';
7
+ import { createRequire } from 'module';
8
+ import stylelint from 'yeoman-stylelint';
9
+ import inquirerPrompt from 'inquirer-autocomplete-prompt';
10
+ import spdxIdentifiers from 'spdx-license-ids' assert { type: 'json' };
11
+
12
+ import fileSystem from '../util/fs.js';
13
+
14
+ spdxIdentifiers.push('SEE LICENSE IN LICENSE');
15
+ spdxIdentifiers.sort();
16
+
17
+ const { readFileSync } = jsonfile;
18
+
19
+ // we cannot use ES6 imports on this object, as it directly exports a class to
20
+ // module.exports - no default export nor a named export is present for us to use
21
+ const require = createRequire(import.meta.url);
22
+ const Generator = require('yeoman-generator');
23
+
24
+ const src = (...paths) => join('src', ...paths);
25
+
26
+ const styleFrameworks = [
27
+ { value: null, name: 'None' },
28
+ { value: 'bootstrap', name: 'Bootstrap' },
29
+ { value: 'bulma', name: 'Bulma' },
30
+ { value: 'foundation', name: 'Foundation' },
31
+ { value: 'materialize', name: 'Materialize' },
32
+ { value: 'uikit', name: 'UIKit' },
33
+ { value: 'materialUi', name: 'Material-UI' }
34
+ ];
35
+ const packages = {
36
+ fontAwesome: [
37
+ '@fortawesome/fontawesome-svg-core',
38
+ '@fortawesome/free-solid-svg-icons',
39
+ '@fortawesome/react-fontawesome'
40
+ ],
41
+ bootstrap: ['bootstrap', 'react-bootstrap'],
42
+ uikit: ['uikit', 'uikit-react'],
43
+ foundation: ['foundation-sites'],
44
+ materialize: ['materialize-css'],
45
+ bulma: ['bulma'],
46
+ materialUi: ['@material-ui/core'],
47
+ lintStaged: ['husky', 'lint-staged'],
48
+ redux: ['redux', 'react-redux', 'redux-saga'],
49
+ reduxJest: ['redux-mock-store'],
50
+ core: [
51
+ '@babel/runtime-corejs3',
52
+ 'core-js@3',
53
+ 'normalize-scss',
54
+ 'prop-types',
55
+ 'react',
56
+ 'react-dom',
57
+ 'react-router-dom',
58
+ 'reselect',
59
+ 'classnames'
60
+ ],
61
+ storybook: [
62
+ '@storybook/react',
63
+ '@storybook/builder-webpack5',
64
+ '@storybook/manager-webpack5'
65
+ ],
66
+ esdoc: [
67
+ 'esdoc',
68
+ 'esdoc-ecmascript-proposal-plugin',
69
+ 'esdoc-jsx-plugin',
70
+ 'esdoc-standard-plugin',
71
+ 'opener'
72
+ ],
73
+ jest: [
74
+ 'babel-jest',
75
+ 'eslint-plugin-jest',
76
+ 'jest',
77
+ 'react-test-renderer',
78
+ 'opener'
79
+ ],
80
+ dev: [
81
+ '@babel/core',
82
+ '@babel/eslint-parser',
83
+ '@babel/plugin-transform-runtime',
84
+ '@babel/preset-env',
85
+ '@babel/preset-react',
86
+ '@babel/register',
87
+ 'autoprefixer',
88
+ 'babel-loader',
89
+ 'clean-webpack-plugin',
90
+ 'cross-env',
91
+ 'css-loader',
92
+ 'css-minimizer-webpack-plugin',
93
+ 'eslint-config-prettier',
94
+ 'eslint-import-resolver-webpack',
95
+ 'eslint-plugin-import',
96
+ 'eslint-plugin-jsx-a11y',
97
+ 'eslint-plugin-prettier',
98
+ 'eslint-plugin-react-hooks',
99
+ 'eslint-plugin-react',
100
+ 'eslint-webpack-plugin',
101
+ 'eslint',
102
+ 'html-loader',
103
+ 'html-webpack-plugin',
104
+ 'mini-css-extract-plugin',
105
+ 'postcss-flexbugs-fixes',
106
+ 'postcss-loader',
107
+ 'postcss-scss',
108
+ 'prettier',
109
+ 'sass-loader',
110
+ 'sass',
111
+ 'style-loader',
112
+ 'stylelint-config-recommended',
113
+ 'stylelint-webpack-plugin',
114
+ 'stylelint',
115
+ 'terser-webpack-plugin',
116
+ 'webpack-cli',
117
+ 'webpack',
118
+ 'webpack-dev-server'
119
+ ]
120
+ };
121
+ const files = {
122
+ core: [
123
+ '.babelrc',
124
+ '.prettierrc',
125
+ '.stylelintrc',
126
+ '.editorconfig',
127
+ 'jsconfig.json',
128
+ '.browserslistrc',
129
+ src('utils', 'index.js')
130
+ ],
131
+ templated: [
132
+ '.eslintrc.js',
133
+ 'package.json',
134
+ src('index.js'),
135
+ src('index.html'),
136
+ src('index.scss'),
137
+ 'webpack.config.babel.js'
138
+ ],
139
+ esdoc: ['.esdoc.json'],
140
+ jest: ['jest.config.js'],
141
+ lintStaged: ['.lintstagedrc']
142
+ };
143
+ const directories = {
144
+ redux: [src('reducers'), src('sagas'), src('selectors')],
145
+ core: [src('components'), src('utils')]
146
+ };
147
+ const scripts = {
148
+ esdoc: {
149
+ 'build:documentation': 'esdoc',
150
+ 'view:documentation': 'opener ./docs/index.html'
151
+ },
152
+ jest: {
153
+ test: 'jest',
154
+ 'view:coverage': 'opener ./coverage/index.html'
155
+ }
156
+ };
157
+
158
+ export default class extends Generator {
159
+ constructor(...args) {
160
+ super(...args);
161
+
162
+ this.env.adapter.promptModule.registerPrompt(
163
+ 'autocomplete',
164
+ inquirerPrompt
165
+ );
166
+
167
+ this.answers = {};
168
+ this.fileSystem = fileSystem(this);
169
+ this.sourceRoot(this.fileSystem.resolve('templates', 'app'));
170
+ this.registerTransformStream(
171
+ gulpIf(
172
+ /\.js$/,
173
+ prettier(readFileSync(this.fileSystem.resolve('.prettierrc')))
174
+ )
175
+ );
176
+ this.registerTransformStream(
177
+ gulpIf(
178
+ /\.scss$/,
179
+ stylelint({
180
+ configFile: this.fileSystem.resolve('.stylelintrc')
181
+ })
182
+ )
183
+ );
184
+ }
185
+
186
+ async prompting() {
187
+ const { name, email } = this.user.git;
188
+
189
+ this.answers = await this.prompt([
190
+ {
191
+ type: 'input',
192
+ name: 'package.name',
193
+ message: 'Package name',
194
+ default: this.appname.replace(/\s+/g, '-')
195
+ },
196
+ {
197
+ type: 'input',
198
+ name: 'package.version',
199
+ message: 'Package version',
200
+ default: '0.1.0'
201
+ },
202
+ {
203
+ type: 'autocomplete',
204
+ name: 'package.license',
205
+ message: 'Package license',
206
+ source: (_, input) => {
207
+ const pattern = new RegExp(`.*${input}.*`, 'i');
208
+
209
+ return new Promise((resolve) => {
210
+ resolve(
211
+ spdxIdentifiers.filter((identifier) => pattern.test(identifier))
212
+ );
213
+ });
214
+ }
215
+ },
216
+ {
217
+ type: 'input',
218
+ name: 'package.description',
219
+ message: 'Package description'
220
+ },
221
+ {
222
+ type: 'input',
223
+ name: 'author.name',
224
+ message: 'Author name',
225
+ default: name()
226
+ },
227
+ {
228
+ type: 'input',
229
+ name: 'author.email',
230
+ message: 'Author email address',
231
+ default: email()
232
+ },
233
+ {
234
+ type: 'list',
235
+ name: 'styleFramework',
236
+ message: 'What CSS framework would you like to use?',
237
+ choices: styleFrameworks
238
+ },
239
+ {
240
+ type: 'confirm',
241
+ name: 'flags.addLintStaged',
242
+ message: 'Force linting before commits?',
243
+ default: true
244
+ },
245
+ {
246
+ type: 'confirm',
247
+ name: 'flags.addFontAwesome',
248
+ message: 'Add Font Awesome?',
249
+ default: true
250
+ },
251
+ {
252
+ type: 'confirm',
253
+ name: 'flags.addRedux',
254
+ message: 'Add Redux?',
255
+ default: true
256
+ },
257
+ {
258
+ type: 'confirm',
259
+ name: 'flags.addJest',
260
+ message: 'Add Jest?',
261
+ default: true
262
+ },
263
+ {
264
+ type: 'confirm',
265
+ name: 'flags.addStorybook',
266
+ message: 'Add Storybook?',
267
+ default: false
268
+ },
269
+ {
270
+ type: 'confirm',
271
+ name: 'flags.addESDoc',
272
+ message: 'Add ESDoc?',
273
+ default: false
274
+ }
275
+ ]);
276
+ }
277
+
278
+ async writing() {
279
+ const {
280
+ flags,
281
+ package: { license },
282
+ author: { name, email }
283
+ } = this.answers;
284
+
285
+ let licenseText = 'Place your license here.\n';
286
+
287
+ if (license !== 'SEE LICENSE IN LICENSE') {
288
+ this.log(`Downloading ${license} license from spdx/license-list-data...`);
289
+ const { body: rawLicense } = await got(
290
+ `https://raw.githubusercontent.com/spdx/license-list-data/master/text/${license}.txt`
291
+ );
292
+
293
+ licenseText = rawLicense
294
+ .replace('<year>', format(new Date(), 'yyyy'))
295
+ .replace('<copyright holders>', `${name} <${email}>`);
296
+ }
297
+ this.fileSystem.createFile('LICENSE', licenseText);
298
+
299
+ // copy files and directories
300
+ files.core.forEach(this.fileSystem.copy);
301
+ files.templated.forEach(this.fileSystem.copyTemplateInPlace);
302
+ directories.core.forEach(this.fileSystem.copyDirectory);
303
+
304
+ // this is a workaround for npm not packaging up .gitignore files
305
+ this.fileSystem.copyTo('gitignore', '.gitignore');
306
+
307
+ if (flags.addRedux) {
308
+ directories.redux.forEach(this.fileSystem.copyDirectory);
309
+ }
310
+
311
+ if (flags.addJest) {
312
+ files.jest.forEach(this.fileSystem.copy);
313
+ this.fs.append(this.destinationPath('.gitignore'), 'coverage/');
314
+ this.fs.extendJSON(this.destinationPath('package.json'), {
315
+ scripts: {
316
+ ...scripts.jest
317
+ }
318
+ });
319
+ }
320
+
321
+ if (flags.addESDoc) {
322
+ files.esdoc.forEach(this.fileSystem.copy);
323
+ this.fs.append(this.destinationPath('.gitignore'), 'docs/');
324
+ this.fs.extendJSON(this.destinationPath('package.json'), {
325
+ scripts: {
326
+ ...scripts.esdoc
327
+ }
328
+ });
329
+ }
330
+
331
+ if (flags.addLintStaged) {
332
+ files.lintStaged.forEach(this.fileSystem.copy);
333
+ }
334
+ }
335
+
336
+ install() {
337
+ const main = [];
338
+ const dev = [];
339
+ const { flags, styleFramework } = this.answers;
340
+
341
+ this.log('Building a list of packages to install');
342
+
343
+ main.push.apply(main, packages.core);
344
+ dev.push.apply(dev, packages.dev);
345
+
346
+ if (styleFramework !== null) {
347
+ main.push.apply(main, packages[styleFramework]);
348
+ }
349
+
350
+ if (flags.addLintStaged) {
351
+ dev.push.apply(dev, packages.lintStaged);
352
+ }
353
+
354
+ if (flags.addFontAwesome) {
355
+ main.push.apply(main, packages.fontAwesome);
356
+ }
357
+
358
+ if (flags.addRedux) {
359
+ main.push.apply(main, packages.redux);
360
+ }
361
+
362
+ if (flags.addJest) {
363
+ dev.push.apply(dev, packages.jest);
364
+ }
365
+
366
+ if (flags.addRedux && flags.addJest) {
367
+ dev.push.apply(dev, packages.reduxJest);
368
+ }
369
+
370
+ if (flags.addStorybook) {
371
+ dev.push.apply(dev, packages.storybook);
372
+ }
373
+
374
+ if (flags.addESDoc) {
375
+ main.push.apply(main, packages.esdoc);
376
+ }
377
+
378
+ this.log(
379
+ `Getting ready to install ${main.length} dependencies and ${dev.length} dev dependencies.`
380
+ );
381
+ this.log(`Dependencies: ${main.join(' ')}
382
+ Dev dependencies: ${dev.join(' ')}`);
383
+ this.npmInstall(main, { save: true });
384
+ this.npmInstall(dev, { 'save-dev': true });
385
+ this.spawnCommandSync('git', ['init']);
386
+ this.spawnCommandSync('npx', ['husky', 'init']);
387
+ this.spawnCommandSync('bash', [
388
+ '-c',
389
+ 'echo "npx lint-staged" > .husky/pre-commit'
390
+ ]);
391
+ }
392
+ }