generator-folklore 3.0.16 → 3.0.17
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 +3 -18
- package/lib/generators/babel/index.js +0 -12
- package/lib/generators/browserslist/index.js +0 -7
- package/lib/generators/build/index.js +0 -17
- package/lib/generators/cli/index.js +0 -18
- package/lib/generators/docs/index.js +3 -32
- package/lib/generators/editorconfig/index.js +0 -6
- package/lib/generators/eslint/index.js +0 -11
- package/lib/generators/html-project/index.js +0 -30
- package/lib/generators/intl/index.js +0 -13
- package/lib/generators/laravel/index.js +3 -75
- package/lib/generators/laravel-auth/index.js +0 -25
- package/lib/generators/laravel-mediatheque/index.js +0 -28
- package/lib/generators/laravel-package/index.js +0 -33
- package/lib/generators/laravel-panneau/index.js +0 -49
- package/lib/generators/laravel-project/index.js +9 -76
- package/lib/generators/lerna-package/index.js +0 -36
- package/lib/generators/lerna-repository/index.js +0 -34
- package/lib/generators/node-project/index.js +0 -28
- package/lib/generators/npm-package/index.js +0 -36
- package/lib/generators/prettier/index.js +0 -11
- package/lib/generators/react-app/index.js +3 -28
- package/lib/generators/react-package/index.js +0 -33
- package/lib/generators/rollup/index.js +0 -13
- package/lib/generators/sass-lint/index.js +0 -9
- package/lib/generators/scss/index.js +0 -16
- package/lib/generators/server/index.js +0 -15
- package/lib/generators/storybook/index.js +0 -16
- package/lib/generators/stylelint/index.js +0 -11
- package/lib/generators/stylelint/templates/stylelintrc +2 -1
- package/lib/generators/test/index.js +0 -16
- package/lib/lib/generator.js +3 -22
- package/lib/lib/mysql.js +0 -10
- package/lib/lib/utils.js +0 -4
- package/package.json +2 -2
@@ -1,15 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _chalk = _interopRequireDefault(require("chalk"));
|
4
|
-
|
5
4
|
var _lodash = _interopRequireDefault(require("lodash"));
|
6
|
-
|
7
5
|
var _path = _interopRequireDefault(require("path"));
|
8
|
-
|
9
6
|
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
10
|
-
|
11
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
|
-
|
13
8
|
module.exports = class LernaRepositoryGenerator extends _generator.default {
|
14
9
|
constructor(...args) {
|
15
10
|
super(...args);
|
@@ -23,22 +18,18 @@ module.exports = class LernaRepositoryGenerator extends _generator.default {
|
|
23
18
|
defaults: 'documentation,storybook'
|
24
19
|
});
|
25
20
|
}
|
26
|
-
|
27
21
|
get prompting() {
|
28
22
|
return {
|
29
23
|
welcome() {
|
30
24
|
if (this.options.quiet) {
|
31
25
|
return;
|
32
26
|
}
|
33
|
-
|
34
27
|
console.log(_chalk.default.yellow('\n----------------------'));
|
35
28
|
console.log('Lerna Repository Generator');
|
36
29
|
console.log(_chalk.default.yellow('----------------------\n'));
|
37
30
|
},
|
38
|
-
|
39
31
|
prompts() {
|
40
32
|
const prompts = [];
|
41
|
-
|
42
33
|
if (!this.options['project-name']) {
|
43
34
|
prompts.push({
|
44
35
|
type: 'input',
|
@@ -50,7 +41,6 @@ module.exports = class LernaRepositoryGenerator extends _generator.default {
|
|
50
41
|
}
|
51
42
|
});
|
52
43
|
}
|
53
|
-
|
54
44
|
prompts.push({
|
55
45
|
type: 'checkbox',
|
56
46
|
name: 'features',
|
@@ -64,25 +54,20 @@ module.exports = class LernaRepositoryGenerator extends _generator.default {
|
|
64
54
|
}],
|
65
55
|
default: () => this.options.features.split(',')
|
66
56
|
});
|
67
|
-
|
68
57
|
if (!prompts.length) {
|
69
58
|
return null;
|
70
59
|
}
|
71
|
-
|
72
60
|
return this.prompt(prompts).then(answers => {
|
73
61
|
if (answers['project-name']) {
|
74
62
|
this.options['project-name'] = answers['project-name'];
|
75
63
|
}
|
76
|
-
|
77
64
|
if (answers.features) {
|
78
65
|
this.options.features = answers.features;
|
79
66
|
}
|
80
67
|
});
|
81
68
|
}
|
82
|
-
|
83
69
|
};
|
84
70
|
}
|
85
|
-
|
86
71
|
configuring() {
|
87
72
|
this.options.features = _lodash.default.isString(this.options.features) ? this.options.features.split(',') : this.options.features;
|
88
73
|
this.composeWith('folklore:eslint', {
|
@@ -124,7 +109,6 @@ module.exports = class LernaRepositoryGenerator extends _generator.default {
|
|
124
109
|
browsersync: false,
|
125
110
|
lerna: true
|
126
111
|
});
|
127
|
-
|
128
112
|
if (this.options.features.indexOf('storybook') !== -1) {
|
129
113
|
this.composeWith('folklore:storybook', {
|
130
114
|
quiet: true,
|
@@ -132,7 +116,6 @@ module.exports = class LernaRepositoryGenerator extends _generator.default {
|
|
132
116
|
pattern: '../packages/*/src/__stories__/*.story.jsx'
|
133
117
|
});
|
134
118
|
}
|
135
|
-
|
136
119
|
if (this.options.features.indexOf('documentation') !== -1) {
|
137
120
|
this.composeWith('folklore:docs', {
|
138
121
|
quiet: true,
|
@@ -141,7 +124,6 @@ module.exports = class LernaRepositoryGenerator extends _generator.default {
|
|
141
124
|
});
|
142
125
|
}
|
143
126
|
}
|
144
|
-
|
145
127
|
get writing() {
|
146
128
|
return {
|
147
129
|
gitignore() {
|
@@ -149,38 +131,32 @@ module.exports = class LernaRepositoryGenerator extends _generator.default {
|
|
149
131
|
const destPath = this.destinationPath('.gitignore');
|
150
132
|
this.fs.copy(srcPath, destPath);
|
151
133
|
},
|
152
|
-
|
153
134
|
npmrc() {
|
154
135
|
const srcPath = this.templatePath('npmrc');
|
155
136
|
const destPath = this.destinationPath('.npmrc');
|
156
137
|
this.fs.copy(srcPath, destPath);
|
157
138
|
},
|
158
|
-
|
159
139
|
lernaJSON() {
|
160
140
|
const srcPath = this.templatePath('_lerna.json');
|
161
141
|
const destPath = this.destinationPath('lerna.json');
|
162
142
|
this.fs.copy(srcPath, destPath);
|
163
143
|
},
|
164
|
-
|
165
144
|
packageJSON() {
|
166
145
|
const srcPath = this.templatePath('_package.json');
|
167
146
|
const packageJSON = this.fs.readJSON(srcPath);
|
168
147
|
packageJSON.name = this.options['project-name'];
|
169
148
|
this.packageJson.merge(packageJSON);
|
170
149
|
},
|
171
|
-
|
172
150
|
jest() {
|
173
151
|
const srcPath = this.templatePath('jest.config.js');
|
174
152
|
const destPath = this.destinationPath('jest.config.js');
|
175
153
|
this.fs.copy(srcPath, destPath);
|
176
154
|
},
|
177
|
-
|
178
155
|
readme() {
|
179
156
|
const srcPath = this.templatePath('Readme.md');
|
180
157
|
const destPath = this.destinationPath('Readme.md');
|
181
158
|
this.fs.copy(srcPath, destPath);
|
182
159
|
},
|
183
|
-
|
184
160
|
buildTranslations() {
|
185
161
|
const srcPath = this.templatePath('build-package-translations.js');
|
186
162
|
const destPath = this.destinationPath('build/build-package-translations.js');
|
@@ -189,34 +165,28 @@ module.exports = class LernaRepositoryGenerator extends _generator.default {
|
|
189
165
|
const allDestPath = this.destinationPath('build/build-all-translations.js');
|
190
166
|
this.fs.copy(allSrcPath, allDestPath);
|
191
167
|
},
|
192
|
-
|
193
168
|
buildUtils() {
|
194
169
|
const srcPath = this.templatePath('utils');
|
195
170
|
const destPath = this.destinationPath('build/utils');
|
196
171
|
this.fs.copy(srcPath, destPath);
|
197
172
|
},
|
198
|
-
|
199
173
|
packages() {
|
200
174
|
const srcPath = this.templatePath('packages/.gitkeep');
|
201
175
|
const destPath = this.destinationPath('packages/.gitkeep');
|
202
176
|
this.fs.copy(srcPath, destPath);
|
203
177
|
},
|
204
|
-
|
205
178
|
storybook() {
|
206
179
|
this.fs.copy(this.templatePath('storybook'), this.destinationPath('.storybook'));
|
207
180
|
this.fs.copy(this.templatePath('storybook-package'), this.destinationPath('.storybook-package'));
|
208
181
|
}
|
209
|
-
|
210
182
|
};
|
211
183
|
}
|
212
|
-
|
213
184
|
get install() {
|
214
185
|
return {
|
215
186
|
npm() {
|
216
187
|
if (this.options['skip-install']) {
|
217
188
|
return;
|
218
189
|
}
|
219
|
-
|
220
190
|
this.addDevDependencies({
|
221
191
|
lerna: 'latest',
|
222
192
|
glob: 'latest',
|
@@ -224,17 +194,13 @@ module.exports = class LernaRepositoryGenerator extends _generator.default {
|
|
224
194
|
'@babel/runtime': 'latest'
|
225
195
|
});
|
226
196
|
},
|
227
|
-
|
228
197
|
bootstrap() {
|
229
198
|
if (this.options['skip-install']) {
|
230
199
|
return;
|
231
200
|
}
|
232
|
-
|
233
201
|
const done = this.async();
|
234
202
|
this.spawnCommand('lerna', ['bootstrap']).on('close', done);
|
235
203
|
}
|
236
|
-
|
237
204
|
};
|
238
205
|
}
|
239
|
-
|
240
206
|
};
|
@@ -1,17 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _chalk = _interopRequireDefault(require("chalk"));
|
4
|
-
|
5
4
|
var _lodash = _interopRequireDefault(require("lodash"));
|
6
|
-
|
7
5
|
var _path = _interopRequireDefault(require("path"));
|
8
|
-
|
9
6
|
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
10
|
-
|
11
7
|
var _utils = require("../../lib/utils");
|
12
|
-
|
13
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
|
-
|
15
9
|
module.exports = class NodeProjectGenerator extends _generator.default {
|
16
10
|
// The name `constructor` is important here
|
17
11
|
constructor(...args) {
|
@@ -45,43 +39,34 @@ module.exports = class NodeProjectGenerator extends _generator.default {
|
|
45
39
|
desc: 'Path for the cli',
|
46
40
|
defaults: ''
|
47
41
|
});
|
48
|
-
|
49
42
|
this.srcPath = filePath => this.destinationPath(_path.default.join(this.options['src-path'], filePath));
|
50
43
|
}
|
51
|
-
|
52
44
|
get prompting() {
|
53
45
|
return {
|
54
46
|
welcome() {
|
55
47
|
if (this.options.quiet) {
|
56
48
|
return;
|
57
49
|
}
|
58
|
-
|
59
50
|
console.log(_chalk.default.yellow('\n----------------------'));
|
60
51
|
console.log('Node Project Generator');
|
61
52
|
console.log(_chalk.default.yellow('----------------------\n'));
|
62
53
|
},
|
63
|
-
|
64
54
|
prompts() {
|
65
55
|
const prompts = [];
|
66
|
-
|
67
56
|
if (!this.options['project-name']) {
|
68
57
|
prompts.push(_generator.default.prompts.project_name);
|
69
58
|
}
|
70
|
-
|
71
59
|
if (!prompts.length) {
|
72
60
|
return null;
|
73
61
|
}
|
74
|
-
|
75
62
|
return this.prompt(prompts).then(answers => {
|
76
63
|
if (answers['project-name']) {
|
77
64
|
this.options['project-name'] = answers['project-name'];
|
78
65
|
}
|
79
66
|
});
|
80
67
|
}
|
81
|
-
|
82
68
|
};
|
83
69
|
}
|
84
|
-
|
85
70
|
configuring() {
|
86
71
|
const {
|
87
72
|
'project-name': projectName,
|
@@ -91,13 +76,9 @@ module.exports = class NodeProjectGenerator extends _generator.default {
|
|
91
76
|
'server-path': serverPath,
|
92
77
|
'cli-path': cliPath
|
93
78
|
} = this.options;
|
94
|
-
|
95
79
|
const htmlSrcPath = _path.default.join(srcPath, htmlPath);
|
96
|
-
|
97
80
|
const serverSrcPath = _path.default.join(srcPath, serverPath);
|
98
|
-
|
99
81
|
const cliSrcPath = _path.default.join(srcPath, cliPath);
|
100
|
-
|
101
82
|
this.composeWith('folklore:html-project', {
|
102
83
|
'skip-install': true,
|
103
84
|
quiet: true,
|
@@ -120,24 +101,19 @@ module.exports = class NodeProjectGenerator extends _generator.default {
|
|
120
101
|
quiet: true
|
121
102
|
});
|
122
103
|
}
|
123
|
-
|
124
104
|
get writing() {
|
125
105
|
return {
|
126
106
|
index() {
|
127
107
|
this.fs.copyTpl(this.templatePath('index.js'), this.srcPath('index.js'));
|
128
108
|
},
|
129
|
-
|
130
109
|
packageJson() {
|
131
110
|
const {
|
132
111
|
'src-path': srcPath,
|
133
112
|
'html-path': htmlPath,
|
134
113
|
'server-path': serverPath
|
135
114
|
} = this.options;
|
136
|
-
|
137
115
|
const webEntryPath = _path.default.join(srcPath, htmlPath, 'index.js');
|
138
|
-
|
139
116
|
const serverEntryPath = _path.default.join(srcPath, serverPath, 'server.js');
|
140
|
-
|
141
117
|
const scripts = {
|
142
118
|
'build:web': `flklr build --load-env ${(0, _utils.ensureLeadingDotSlash)(webEntryPath)}`,
|
143
119
|
'build:rollup': `rollup --config rollup.config.js`,
|
@@ -149,16 +125,12 @@ module.exports = class NodeProjectGenerator extends _generator.default {
|
|
149
125
|
scripts
|
150
126
|
});
|
151
127
|
}
|
152
|
-
|
153
128
|
};
|
154
129
|
}
|
155
|
-
|
156
130
|
async install() {
|
157
131
|
if (this.options['skip-install']) {
|
158
132
|
return;
|
159
133
|
}
|
160
|
-
|
161
134
|
await this.spawnCommand('npm', ['install']);
|
162
135
|
}
|
163
|
-
|
164
136
|
};
|
@@ -1,15 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _chalk = _interopRequireDefault(require("chalk"));
|
4
|
-
|
5
4
|
var _lodash = _interopRequireDefault(require("lodash"));
|
6
|
-
|
7
5
|
var _path = _interopRequireDefault(require("path"));
|
8
|
-
|
9
6
|
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
10
|
-
|
11
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
|
-
|
13
8
|
module.exports = class NpmPackageGenerator extends _generator.default {
|
14
9
|
constructor(...args) {
|
15
10
|
super(...args);
|
@@ -83,22 +78,18 @@ module.exports = class NpmPackageGenerator extends _generator.default {
|
|
83
78
|
defaults: true
|
84
79
|
});
|
85
80
|
}
|
86
|
-
|
87
81
|
get prompting() {
|
88
82
|
return {
|
89
83
|
welcome() {
|
90
84
|
if (this.options.quiet) {
|
91
85
|
return;
|
92
86
|
}
|
93
|
-
|
94
87
|
console.log(_chalk.default.yellow('\n----------------------'));
|
95
88
|
console.log('NPM Package Generator');
|
96
89
|
console.log(_chalk.default.yellow('----------------------\n'));
|
97
90
|
},
|
98
|
-
|
99
91
|
prompts() {
|
100
92
|
const prompts = [];
|
101
|
-
|
102
93
|
if (!this.options['package-name']) {
|
103
94
|
prompts.push({
|
104
95
|
type: 'input',
|
@@ -110,46 +101,30 @@ module.exports = class NpmPackageGenerator extends _generator.default {
|
|
110
101
|
}
|
111
102
|
});
|
112
103
|
}
|
113
|
-
|
114
104
|
if (!prompts.length) {
|
115
105
|
return null;
|
116
106
|
}
|
117
|
-
|
118
107
|
return this.prompt(prompts).then(answers => {
|
119
108
|
if (answers['package-name']) {
|
120
109
|
this.options['package-name'] = answers['package-name'];
|
121
110
|
}
|
122
111
|
});
|
123
112
|
}
|
124
|
-
|
125
113
|
};
|
126
114
|
}
|
127
|
-
|
128
115
|
configuring() {
|
129
116
|
const srcPath = _lodash.default.get(this.options, 'src-path');
|
130
|
-
|
131
117
|
const destPath = _lodash.default.get(this.options, 'dest-path');
|
132
|
-
|
133
118
|
const tmpPath = _lodash.default.get(this.options, 'tmp-path');
|
134
|
-
|
135
119
|
const buildPath = _lodash.default.get(this.options, 'build-path');
|
136
|
-
|
137
120
|
const skipInstall = _lodash.default.get(this.options, 'skip-install', false);
|
138
|
-
|
139
121
|
const hotReload = _lodash.default.get(this.options, 'hot-reload', false);
|
140
|
-
|
141
122
|
const webpackConfigBase = _lodash.default.get(this.options, 'webpack-config-base', false);
|
142
|
-
|
143
123
|
const webpackConfigDev = _lodash.default.get(this.options, 'webpack-config-dev', false);
|
144
|
-
|
145
124
|
const webpackHtml = _lodash.default.get(this.options, 'webpack-html', false);
|
146
|
-
|
147
125
|
const webpackDevContext = _lodash.default.get(this.options, 'webpack-dev-context', null);
|
148
|
-
|
149
126
|
const webpackDevEntries = _lodash.default.get(this.options, 'webpack-dev-entries', null);
|
150
|
-
|
151
127
|
const webpackDistEntries = _lodash.default.get(this.options, 'webpack-dist-entries', null);
|
152
|
-
|
153
128
|
const webpackEntries = webpackDevEntries !== null && webpackDistEntries !== null ? null : {
|
154
129
|
[this.options['package-name']]: './index'
|
155
130
|
};
|
@@ -196,50 +171,41 @@ module.exports = class NpmPackageGenerator extends _generator.default {
|
|
196
171
|
quiet: true
|
197
172
|
});
|
198
173
|
}
|
199
|
-
|
200
174
|
get writing() {
|
201
175
|
return {
|
202
176
|
src() {
|
203
177
|
if (!this.options.src) {
|
204
178
|
return;
|
205
179
|
}
|
206
|
-
|
207
180
|
const srcPath = this.templatePath('src');
|
208
181
|
const destPath = this.destinationPath('src');
|
209
182
|
/* this.directory */
|
210
|
-
|
211
183
|
this.fs.copyTpl(srcPath, destPath, this);
|
212
184
|
},
|
213
|
-
|
214
185
|
gitignore() {
|
215
186
|
const srcPath = this.templatePath('gitignore');
|
216
187
|
const destPath = this.destinationPath('.gitignore');
|
217
188
|
this.fs.copy(srcPath, destPath);
|
218
189
|
},
|
219
|
-
|
220
190
|
readme() {
|
221
191
|
const srcPath = this.templatePath('Readme.md');
|
222
192
|
const destPath = this.destinationPath('Readme.md');
|
223
193
|
this.fs.copy(srcPath, destPath);
|
224
194
|
},
|
225
|
-
|
226
195
|
packageJSON() {
|
227
196
|
const srcPath = this.templatePath('_package.json');
|
228
197
|
const packageJSON = this.fs.readJSON(srcPath);
|
229
198
|
packageJSON.name = this.options['package-name'];
|
230
199
|
this.packageJson.merge(packageJSON);
|
231
200
|
}
|
232
|
-
|
233
201
|
};
|
234
202
|
}
|
235
|
-
|
236
203
|
get install() {
|
237
204
|
return {
|
238
205
|
npm() {
|
239
206
|
if (this.options['skip-install']) {
|
240
207
|
return;
|
241
208
|
}
|
242
|
-
|
243
209
|
this.addDependencies({
|
244
210
|
'@babel/runtime': 'latest'
|
245
211
|
});
|
@@ -247,8 +213,6 @@ module.exports = class NpmPackageGenerator extends _generator.default {
|
|
247
213
|
jest: 'latest'
|
248
214
|
});
|
249
215
|
}
|
250
|
-
|
251
216
|
};
|
252
217
|
}
|
253
|
-
|
254
218
|
};
|
@@ -1,11 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _chalk = _interopRequireDefault(require("chalk"));
|
4
|
-
|
5
4
|
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
6
|
-
|
7
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
|
-
|
9
6
|
module.exports = class PrettierGenerator extends _generator.default {
|
10
7
|
get prompting() {
|
11
8
|
return {
|
@@ -13,15 +10,12 @@ module.exports = class PrettierGenerator extends _generator.default {
|
|
13
10
|
if (this.options.quiet) {
|
14
11
|
return;
|
15
12
|
}
|
16
|
-
|
17
13
|
console.log(_chalk.default.yellow('\n----------------------'));
|
18
14
|
console.log('Prettier Generator');
|
19
15
|
console.log(_chalk.default.yellow('----------------------\n'));
|
20
16
|
}
|
21
|
-
|
22
17
|
};
|
23
18
|
}
|
24
|
-
|
25
19
|
get writing() {
|
26
20
|
return {
|
27
21
|
prettierrc() {
|
@@ -29,7 +23,6 @@ module.exports = class PrettierGenerator extends _generator.default {
|
|
29
23
|
const destPath = this.destinationPath('.prettierrc.json');
|
30
24
|
this.fs.copy(srcPath, destPath);
|
31
25
|
},
|
32
|
-
|
33
26
|
dependencies() {
|
34
27
|
this.addDevDependencies({
|
35
28
|
prettier: '^2.8.4',
|
@@ -37,16 +30,12 @@ module.exports = class PrettierGenerator extends _generator.default {
|
|
37
30
|
'@trivago/prettier-plugin-sort-imports': '^4.1.1'
|
38
31
|
});
|
39
32
|
}
|
40
|
-
|
41
33
|
};
|
42
34
|
}
|
43
|
-
|
44
35
|
async install() {
|
45
36
|
if (this.options['skip-install']) {
|
46
37
|
return;
|
47
38
|
}
|
48
|
-
|
49
39
|
await this.spawnCommand('npm', ['install']);
|
50
40
|
}
|
51
|
-
|
52
41
|
};
|
@@ -1,21 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _chalk = _interopRequireDefault(require("chalk"));
|
4
|
-
|
5
4
|
var _lodash = _interopRequireDefault(require("lodash"));
|
6
|
-
|
7
5
|
var _path = _interopRequireDefault(require("path"));
|
8
|
-
|
9
6
|
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
10
|
-
|
11
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
|
-
|
13
8
|
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
9
|
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
|
18
|
-
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
12
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
19
13
|
module.exports = class ReactAppGenerator extends _generator.default {
|
20
14
|
// The name `constructor` is important here
|
21
15
|
constructor(...args) {
|
@@ -32,44 +26,35 @@ module.exports = class ReactAppGenerator extends _generator.default {
|
|
32
26
|
type: String
|
33
27
|
});
|
34
28
|
}
|
35
|
-
|
36
29
|
initializing() {
|
37
30
|
this.react_features = [];
|
38
31
|
}
|
39
|
-
|
40
32
|
get prompting() {
|
41
33
|
return {
|
42
34
|
welcome() {
|
43
35
|
if (this.options.quiet) {
|
44
36
|
return;
|
45
37
|
}
|
46
|
-
|
47
38
|
console.log(_chalk.default.yellow('\n----------------------'));
|
48
39
|
console.log('React App Generator');
|
49
40
|
console.log(_chalk.default.yellow('----------------------\n'));
|
50
41
|
},
|
51
|
-
|
52
42
|
prompts() {
|
53
43
|
const prompts = [];
|
54
|
-
|
55
44
|
if (!this.options['project-name']) {
|
56
45
|
prompts.push(_generator.default.prompts.project_name);
|
57
46
|
}
|
58
|
-
|
59
47
|
if (!prompts.length) {
|
60
48
|
return null;
|
61
49
|
}
|
62
|
-
|
63
50
|
return this.prompt(prompts).then(answers => {
|
64
51
|
if (answers['project-name']) {
|
65
52
|
this.options['project-name'] = answers['project-name'];
|
66
53
|
}
|
67
54
|
});
|
68
55
|
}
|
69
|
-
|
70
56
|
};
|
71
57
|
}
|
72
|
-
|
73
58
|
get writing() {
|
74
59
|
return {
|
75
60
|
directory() {
|
@@ -82,22 +67,17 @@ module.exports = class ReactAppGenerator extends _generator.default {
|
|
82
67
|
const srcPath = this.templatePath('src');
|
83
68
|
this.fs.copyTpl(srcPath, destPath, templateData);
|
84
69
|
},
|
85
|
-
|
86
70
|
index() {
|
87
71
|
const jsPath = this.options.path;
|
88
72
|
this.fs.copyTpl(this.templatePath('index.js'), this.destinationPath(_path.default.join(jsPath, 'index.js')));
|
89
73
|
},
|
90
|
-
|
91
74
|
styles() {
|
92
75
|
const templateData = {};
|
93
|
-
|
94
76
|
const stylesPath = this.options['styles-path'] || _path.default.join(this.options.path, 'styles');
|
95
|
-
|
96
77
|
const srcPath = this.templatePath('styles');
|
97
78
|
const destPath = this.destinationPath(stylesPath);
|
98
79
|
this.fs.copyTpl(srcPath, destPath, templateData);
|
99
80
|
},
|
100
|
-
|
101
81
|
packageJSON() {
|
102
82
|
const srcPath = this.templatePath('_package.json');
|
103
83
|
const destPath = this.destinationPath('package.json');
|
@@ -106,7 +86,6 @@ module.exports = class ReactAppGenerator extends _generator.default {
|
|
106
86
|
name: this.options['project-name']
|
107
87
|
}));
|
108
88
|
},
|
109
|
-
|
110
89
|
dependencies() {
|
111
90
|
this.addDependencies({
|
112
91
|
react: '^18.0.0',
|
@@ -131,16 +110,12 @@ module.exports = class ReactAppGenerator extends _generator.default {
|
|
131
110
|
'resize-observer-polyfill': '^1.5.1'
|
132
111
|
});
|
133
112
|
}
|
134
|
-
|
135
113
|
};
|
136
114
|
}
|
137
|
-
|
138
115
|
async install() {
|
139
116
|
if (this.options['skip-install']) {
|
140
117
|
return;
|
141
118
|
}
|
142
|
-
|
143
119
|
await this.spawnCommand('npm', ['install']);
|
144
120
|
}
|
145
|
-
|
146
121
|
};
|