generator-folklore 3.0.15 → 3.0.17
Sign up to get free protection for your applications and to get access to all the features.
- 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/laravel-project/templates/laravel/config/app.php +1 -0
- package/lib/generators/laravel-project/templates/laravel/lang/en/auth.php +18 -0
- package/lib/generators/laravel-project/templates/laravel/lang/en/pagination.php +17 -0
- package/lib/generators/laravel-project/templates/laravel/lang/en/passwords.php +20 -0
- package/lib/generators/laravel-project/templates/laravel/lang/en/validation.php +167 -0
- 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,19 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _lodash = _interopRequireDefault(require("lodash"));
|
4
|
-
|
5
4
|
var _path = _interopRequireDefault(require("path"));
|
6
|
-
|
7
5
|
var _chalk = _interopRequireDefault(require("chalk"));
|
8
|
-
|
9
6
|
var _get = _interopRequireDefault(require("lodash/get"));
|
10
|
-
|
11
7
|
var _changeCase = require("change-case");
|
12
|
-
|
13
8
|
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
14
|
-
|
15
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
|
-
|
17
10
|
module.exports = class LernaPackageGenerator extends _generator.default {
|
18
11
|
constructor(...args) {
|
19
12
|
super(...args);
|
@@ -37,28 +30,23 @@ module.exports = class LernaPackageGenerator extends _generator.default {
|
|
37
30
|
type: String,
|
38
31
|
required: false
|
39
32
|
});
|
40
|
-
|
41
33
|
this.packagePath = destPath => {
|
42
34
|
const nameParts = this.options['package-name'].split('/');
|
43
35
|
return this.destinationPath(_path.default.join(this.options['package-folder'], nameParts[nameParts.length - 1], destPath || ''));
|
44
36
|
};
|
45
37
|
}
|
46
|
-
|
47
38
|
get prompting() {
|
48
39
|
return {
|
49
40
|
welcome() {
|
50
41
|
if (this.options.quiet) {
|
51
42
|
return;
|
52
43
|
}
|
53
|
-
|
54
44
|
console.log(_chalk.default.yellow('\n----------------------'));
|
55
45
|
console.log('Lerna Package Generator');
|
56
46
|
console.log(_chalk.default.yellow('----------------------\n'));
|
57
47
|
},
|
58
|
-
|
59
48
|
prompts() {
|
60
49
|
const prompts = [];
|
61
|
-
|
62
50
|
if (!this.options['package-name']) {
|
63
51
|
prompts.push({
|
64
52
|
type: 'input',
|
@@ -70,7 +58,6 @@ module.exports = class LernaPackageGenerator extends _generator.default {
|
|
70
58
|
}
|
71
59
|
});
|
72
60
|
}
|
73
|
-
|
74
61
|
if (this.packageFolders.length > 1) {
|
75
62
|
prompts.push({
|
76
63
|
type: 'list',
|
@@ -79,7 +66,6 @@ module.exports = class LernaPackageGenerator extends _generator.default {
|
|
79
66
|
choices: this.packageFolders
|
80
67
|
});
|
81
68
|
}
|
82
|
-
|
83
69
|
if (!this.options.type) {
|
84
70
|
prompts.push({
|
85
71
|
type: 'list',
|
@@ -94,7 +80,6 @@ module.exports = class LernaPackageGenerator extends _generator.default {
|
|
94
80
|
}]
|
95
81
|
});
|
96
82
|
}
|
97
|
-
|
98
83
|
prompts.push({
|
99
84
|
type: 'input',
|
100
85
|
name: 'component-name',
|
@@ -106,24 +91,19 @@ module.exports = class LernaPackageGenerator extends _generator.default {
|
|
106
91
|
return (0, _changeCase.pascal)(`${parts[parts.length - 1]}-component`);
|
107
92
|
}
|
108
93
|
});
|
109
|
-
|
110
94
|
if (!prompts.length) {
|
111
95
|
return null;
|
112
96
|
}
|
113
|
-
|
114
97
|
return this.prompt(prompts).then(answers => {
|
115
98
|
if (answers['package-name']) {
|
116
99
|
this.options['package-name'] = answers['package-name'];
|
117
100
|
}
|
118
|
-
|
119
101
|
if (answers.type) {
|
120
102
|
this.options.type = answers.type;
|
121
103
|
}
|
122
|
-
|
123
104
|
if (answers['component-name']) {
|
124
105
|
this.options['component-name'] = answers['component-name'];
|
125
106
|
}
|
126
|
-
|
127
107
|
if (answers['package-folder']) {
|
128
108
|
this.options['package-folder'] = answers['package-folder'];
|
129
109
|
} else {
|
@@ -131,10 +111,8 @@ module.exports = class LernaPackageGenerator extends _generator.default {
|
|
131
111
|
}
|
132
112
|
});
|
133
113
|
}
|
134
|
-
|
135
114
|
};
|
136
115
|
}
|
137
|
-
|
138
116
|
get writing() {
|
139
117
|
return {
|
140
118
|
gitignore() {
|
@@ -142,19 +120,16 @@ module.exports = class LernaPackageGenerator extends _generator.default {
|
|
142
120
|
const destPath = this.packagePath('.gitignore');
|
143
121
|
this.fs.copy(srcPath, destPath);
|
144
122
|
},
|
145
|
-
|
146
123
|
babelrc() {
|
147
124
|
const srcPath = this.templatePath('babelrc');
|
148
125
|
const destPath = this.packagePath('.babelrc');
|
149
126
|
this.fs.copy(srcPath, destPath);
|
150
127
|
},
|
151
|
-
|
152
128
|
npmrc() {
|
153
129
|
const srcPath = this.templatePath('npmrc');
|
154
130
|
const destPath = this.packagePath('.npmrc');
|
155
131
|
this.fs.copy(srcPath, destPath);
|
156
132
|
},
|
157
|
-
|
158
133
|
packageJSON() {
|
159
134
|
const {
|
160
135
|
type
|
@@ -162,7 +137,6 @@ module.exports = class LernaPackageGenerator extends _generator.default {
|
|
162
137
|
const srcPath = this.templatePath('_package.json');
|
163
138
|
const packageJSON = this.fs.readJSON(srcPath);
|
164
139
|
packageJSON.name = this.options['package-name'];
|
165
|
-
|
166
140
|
if (type === 'react') {
|
167
141
|
packageJSON.dependencies['prop-types'] = '^15.6.0';
|
168
142
|
packageJSON.dependencies['react-intl'] = '^2.4.0';
|
@@ -175,10 +149,8 @@ module.exports = class LernaPackageGenerator extends _generator.default {
|
|
175
149
|
'react-dom': '>=15.0.0 || ^16.0.0'
|
176
150
|
};
|
177
151
|
}
|
178
|
-
|
179
152
|
this.packageJson.merge(packageJSON);
|
180
153
|
},
|
181
|
-
|
182
154
|
webpackConfig() {
|
183
155
|
const srcPath = this.templatePath('webpack.config.js');
|
184
156
|
const destPath = this.packagePath('webpack.config.js');
|
@@ -187,18 +159,15 @@ module.exports = class LernaPackageGenerator extends _generator.default {
|
|
187
159
|
libraryName: (0, _changeCase.pascal)(this.options['package-name'])
|
188
160
|
});
|
189
161
|
},
|
190
|
-
|
191
162
|
readme() {
|
192
163
|
const srcPath = this.templatePath('Readme.md');
|
193
164
|
const destPath = this.packagePath('Readme.md');
|
194
165
|
this.fs.copy(srcPath, destPath);
|
195
166
|
},
|
196
|
-
|
197
167
|
src() {
|
198
168
|
const {
|
199
169
|
type
|
200
170
|
} = this.options;
|
201
|
-
|
202
171
|
if (type === 'react') {
|
203
172
|
const componentName = this.options['component-name'];
|
204
173
|
this.fs.copyTpl(this.templatePath('src/react/Component.jsx'), this.packagePath(`src/${componentName}.jsx`), {
|
@@ -220,22 +189,17 @@ module.exports = class LernaPackageGenerator extends _generator.default {
|
|
220
189
|
this.fs.copy(srcPath, destPath);
|
221
190
|
}
|
222
191
|
}
|
223
|
-
|
224
192
|
};
|
225
193
|
}
|
226
|
-
|
227
194
|
get install() {
|
228
195
|
return {
|
229
196
|
bootstrap() {
|
230
197
|
if (this.options['skip-install']) {
|
231
198
|
return;
|
232
199
|
}
|
233
|
-
|
234
200
|
const done = this.async();
|
235
201
|
this.spawnCommand('lerna', ['bootstrap', '--ignore-scripts']).on('close', done);
|
236
202
|
}
|
237
|
-
|
238
203
|
};
|
239
204
|
}
|
240
|
-
|
241
205
|
};
|
@@ -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
|
};
|