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,17 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _chalk = _interopRequireDefault(require("chalk"));
|
4
|
-
|
5
4
|
var _changeCase = require("change-case");
|
6
|
-
|
7
5
|
var _lodash = _interopRequireDefault(require("lodash"));
|
8
|
-
|
9
6
|
var _path = _interopRequireDefault(require("path"));
|
10
|
-
|
11
7
|
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
12
|
-
|
13
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
|
-
|
15
9
|
module.exports = class ReactPackageGenerator extends _generator.default {
|
16
10
|
constructor(...args) {
|
17
11
|
super(...args);
|
@@ -49,22 +43,18 @@ module.exports = class ReactPackageGenerator extends _generator.default {
|
|
49
43
|
defaults: './examples'
|
50
44
|
});
|
51
45
|
}
|
52
|
-
|
53
46
|
get prompting() {
|
54
47
|
return {
|
55
48
|
welcome() {
|
56
49
|
if (this.options.quiet) {
|
57
50
|
return;
|
58
51
|
}
|
59
|
-
|
60
52
|
console.log(_chalk.default.yellow('\n----------------------'));
|
61
53
|
console.log('React Package Generator');
|
62
54
|
console.log(_chalk.default.yellow('----------------------\n'));
|
63
55
|
},
|
64
|
-
|
65
56
|
prompts() {
|
66
57
|
const prompts = [];
|
67
|
-
|
68
58
|
if (!this.options['package-name']) {
|
69
59
|
prompts.push({
|
70
60
|
type: 'input',
|
@@ -76,7 +66,6 @@ module.exports = class ReactPackageGenerator extends _generator.default {
|
|
76
66
|
}
|
77
67
|
});
|
78
68
|
}
|
79
|
-
|
80
69
|
if (!this.options['component-name']) {
|
81
70
|
prompts.push({
|
82
71
|
type: 'input',
|
@@ -88,38 +77,27 @@ module.exports = class ReactPackageGenerator extends _generator.default {
|
|
88
77
|
}
|
89
78
|
});
|
90
79
|
}
|
91
|
-
|
92
80
|
if (!prompts.length) {
|
93
81
|
return null;
|
94
82
|
}
|
95
|
-
|
96
83
|
return this.prompt(prompts).then(answers => {
|
97
84
|
if (answers['package-name']) {
|
98
85
|
this.options['package-name'] = answers['package-name'];
|
99
86
|
}
|
100
|
-
|
101
87
|
if (answers['component-name']) {
|
102
88
|
this.options['component-name'] = answers['component-name'];
|
103
89
|
}
|
104
90
|
});
|
105
91
|
}
|
106
|
-
|
107
92
|
};
|
108
93
|
}
|
109
|
-
|
110
94
|
configuring() {
|
111
95
|
const srcPath = _lodash.default.get(this.options, 'src-path');
|
112
|
-
|
113
96
|
const destPath = _lodash.default.get(this.options, 'dest-path');
|
114
|
-
|
115
97
|
const tmpPath = _lodash.default.get(this.options, 'tmp-path');
|
116
|
-
|
117
98
|
const buildPath = _lodash.default.get(this.options, 'build-path');
|
118
|
-
|
119
99
|
const examplesPath = _lodash.default.get(this.options, 'examples-path');
|
120
|
-
|
121
100
|
const skipInstall = _lodash.default.get(this.options, 'skip-install', false);
|
122
|
-
|
123
101
|
this.composeWith('folklore:npm-package', {
|
124
102
|
'package-name': this.options['package-name'],
|
125
103
|
src: false,
|
@@ -142,7 +120,6 @@ module.exports = class ReactPackageGenerator extends _generator.default {
|
|
142
120
|
quiet: true
|
143
121
|
});
|
144
122
|
}
|
145
|
-
|
146
123
|
get writing() {
|
147
124
|
return {
|
148
125
|
examples() {
|
@@ -150,7 +127,6 @@ module.exports = class ReactPackageGenerator extends _generator.default {
|
|
150
127
|
const destPath = this.destinationPath('examples');
|
151
128
|
this.fs.copyTpl(srcPath, destPath, this);
|
152
129
|
},
|
153
|
-
|
154
130
|
src() {
|
155
131
|
const srcPath = this.templatePath('src');
|
156
132
|
const destPath = this.destinationPath('src');
|
@@ -158,13 +134,11 @@ module.exports = class ReactPackageGenerator extends _generator.default {
|
|
158
134
|
componentName: this.options['component-name']
|
159
135
|
});
|
160
136
|
},
|
161
|
-
|
162
137
|
storybook() {
|
163
138
|
const srcPath = this.templatePath('storybook');
|
164
139
|
const destPath = this.destinationPath('.storybook');
|
165
140
|
this.fs.copyTpl(srcPath, destPath, {});
|
166
141
|
},
|
167
|
-
|
168
142
|
packageJSON() {
|
169
143
|
const packagePath = this.destinationPath('package.json');
|
170
144
|
this.fs.extendJSON(packagePath, {
|
@@ -173,25 +147,20 @@ module.exports = class ReactPackageGenerator extends _generator.default {
|
|
173
147
|
}
|
174
148
|
});
|
175
149
|
}
|
176
|
-
|
177
150
|
};
|
178
151
|
}
|
179
|
-
|
180
152
|
get install() {
|
181
153
|
return {
|
182
154
|
npmInstall() {
|
183
155
|
if (this.options['skip-install']) {
|
184
156
|
return;
|
185
157
|
}
|
186
|
-
|
187
158
|
this.addDependencies(['react@latest', 'prop-types@latest', 'react-dom@latest']);
|
188
159
|
},
|
189
|
-
|
190
160
|
npmInstallDev() {
|
191
161
|
if (this.options['skip-install']) {
|
192
162
|
return;
|
193
163
|
}
|
194
|
-
|
195
164
|
this.addDevDependencies({
|
196
165
|
domready: 'latest',
|
197
166
|
jquery: 'latest',
|
@@ -203,8 +172,6 @@ module.exports = class ReactPackageGenerator extends _generator.default {
|
|
203
172
|
'html-webpack-plugin': 'latest'
|
204
173
|
});
|
205
174
|
}
|
206
|
-
|
207
175
|
};
|
208
176
|
}
|
209
|
-
|
210
177
|
};
|
@@ -1,33 +1,25 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _chalk = _interopRequireDefault(require("chalk"));
|
4
|
-
|
5
4
|
var _path = _interopRequireDefault(require("path"));
|
6
|
-
|
7
5
|
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
8
|
-
|
9
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
|
-
|
11
7
|
module.exports = class RollupGenerator extends _generator.default {
|
12
8
|
constructor(...args) {
|
13
9
|
super(...args);
|
14
10
|
}
|
15
|
-
|
16
11
|
get prompting() {
|
17
12
|
return {
|
18
13
|
welcome() {
|
19
14
|
if (this.options.quiet) {
|
20
15
|
return;
|
21
16
|
}
|
22
|
-
|
23
17
|
console.log(_chalk.default.yellow('\n----------------------'));
|
24
18
|
console.log('Rollup Generator');
|
25
19
|
console.log(_chalk.default.yellow('----------------------\n'));
|
26
20
|
}
|
27
|
-
|
28
21
|
};
|
29
22
|
}
|
30
|
-
|
31
23
|
get writing() {
|
32
24
|
return {
|
33
25
|
config() {
|
@@ -35,7 +27,6 @@ module.exports = class RollupGenerator extends _generator.default {
|
|
35
27
|
const destPath = this.destinationPath('rollup.config.js');
|
36
28
|
this.fs.copyTpl(srcPath, destPath);
|
37
29
|
},
|
38
|
-
|
39
30
|
dependencies() {
|
40
31
|
this.addDevDependencies({
|
41
32
|
'@rollup/plugin-babel': 'latest',
|
@@ -46,16 +37,12 @@ module.exports = class RollupGenerator extends _generator.default {
|
|
46
37
|
rollup: '^2.79.1'
|
47
38
|
});
|
48
39
|
}
|
49
|
-
|
50
40
|
};
|
51
41
|
}
|
52
|
-
|
53
42
|
async install() {
|
54
43
|
if (this.options['skip-install']) {
|
55
44
|
return;
|
56
45
|
}
|
57
|
-
|
58
46
|
await this.spawnCommand('npm', ['install']);
|
59
47
|
}
|
60
|
-
|
61
48
|
};
|
@@ -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 SassLintGenerator extends _generator.default {
|
10
7
|
constructor(...args) {
|
11
8
|
super(...args);
|
@@ -15,22 +12,18 @@ module.exports = class SassLintGenerator extends _generator.default {
|
|
15
12
|
defaults: false
|
16
13
|
});
|
17
14
|
}
|
18
|
-
|
19
15
|
get prompting() {
|
20
16
|
return {
|
21
17
|
welcome() {
|
22
18
|
if (this.options.quiet) {
|
23
19
|
return;
|
24
20
|
}
|
25
|
-
|
26
21
|
console.log(_chalk.default.yellow('\n----------------------'));
|
27
22
|
console.log('Sass lint Generator');
|
28
23
|
console.log(_chalk.default.yellow('----------------------\n'));
|
29
24
|
}
|
30
|
-
|
31
25
|
};
|
32
26
|
}
|
33
|
-
|
34
27
|
get writing() {
|
35
28
|
return {
|
36
29
|
eslintrc() {
|
@@ -40,8 +33,6 @@ module.exports = class SassLintGenerator extends _generator.default {
|
|
40
33
|
camelCase: this.options['camel-case']
|
41
34
|
});
|
42
35
|
}
|
43
|
-
|
44
36
|
};
|
45
37
|
}
|
46
|
-
|
47
38
|
};
|
@@ -1,13 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _chalk = _interopRequireDefault(require("chalk"));
|
4
|
-
|
5
4
|
var _path = _interopRequireDefault(require("path"));
|
6
|
-
|
7
5
|
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
8
|
-
|
9
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
|
-
|
11
7
|
module.exports = class ScssGenerator extends _generator.default {
|
12
8
|
constructor(...args) {
|
13
9
|
super(...args);
|
@@ -19,43 +15,34 @@ module.exports = class ScssGenerator extends _generator.default {
|
|
19
15
|
type: String,
|
20
16
|
defaults: 'src/scss'
|
21
17
|
});
|
22
|
-
|
23
18
|
this.stylesPath = destPath => this.destinationPath(_path.default.join(this.options.path, destPath || ''));
|
24
19
|
}
|
25
|
-
|
26
20
|
get prompting() {
|
27
21
|
return {
|
28
22
|
welcome() {
|
29
23
|
if (this.options.quiet) {
|
30
24
|
return;
|
31
25
|
}
|
32
|
-
|
33
26
|
console.log(_chalk.default.yellow('\n----------------------'));
|
34
27
|
console.log('SCSS Generator');
|
35
28
|
console.log(_chalk.default.yellow('----------------------\n'));
|
36
29
|
},
|
37
|
-
|
38
30
|
prompts() {
|
39
31
|
const prompts = [];
|
40
|
-
|
41
32
|
if (!this.options['project-name']) {
|
42
33
|
prompts.push(ScssGenerator.prompts.project_name);
|
43
34
|
}
|
44
|
-
|
45
35
|
if (!prompts.length) {
|
46
36
|
return null;
|
47
37
|
}
|
48
|
-
|
49
38
|
return this.prompt(prompts).then(answers => {
|
50
39
|
if (answers['project-name']) {
|
51
40
|
this.options['project-name'] = answers['project-name'];
|
52
41
|
}
|
53
42
|
});
|
54
43
|
}
|
55
|
-
|
56
44
|
};
|
57
45
|
}
|
58
|
-
|
59
46
|
get writing() {
|
60
47
|
return {
|
61
48
|
styles() {
|
@@ -63,14 +50,11 @@ module.exports = class ScssGenerator extends _generator.default {
|
|
63
50
|
const destPath = this.stylesPath('styles.scss');
|
64
51
|
this.fs.copy(srcPath, destPath);
|
65
52
|
},
|
66
|
-
|
67
53
|
commmons() {
|
68
54
|
const srcPath = this.templatePath('commons');
|
69
55
|
const destPath = this.stylesPath('commons');
|
70
56
|
this.fs.copy(srcPath, destPath);
|
71
57
|
}
|
72
|
-
|
73
58
|
};
|
74
59
|
}
|
75
|
-
|
76
60
|
};
|
@@ -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 ServerGenerator extends _generator.default {
|
14
9
|
// The name `constructor` is important here
|
15
10
|
constructor(...args) {
|
@@ -27,22 +22,18 @@ module.exports = class ServerGenerator extends _generator.default {
|
|
27
22
|
defaults: false
|
28
23
|
});
|
29
24
|
}
|
30
|
-
|
31
25
|
get prompting() {
|
32
26
|
return {
|
33
27
|
welcome() {
|
34
28
|
if (this.options.quiet) {
|
35
29
|
return;
|
36
30
|
}
|
37
|
-
|
38
31
|
console.log(_chalk.default.yellow('\n----------------------'));
|
39
32
|
console.log('Server Generator');
|
40
33
|
console.log(_chalk.default.yellow('----------------------\n'));
|
41
34
|
}
|
42
|
-
|
43
35
|
};
|
44
36
|
}
|
45
|
-
|
46
37
|
get writing() {
|
47
38
|
return {
|
48
39
|
index() {
|
@@ -55,7 +46,6 @@ module.exports = class ServerGenerator extends _generator.default {
|
|
55
46
|
socketIo
|
56
47
|
});
|
57
48
|
},
|
58
|
-
|
59
49
|
dependencies() {
|
60
50
|
const {
|
61
51
|
'socket-io': socketIo
|
@@ -66,23 +56,18 @@ module.exports = class ServerGenerator extends _generator.default {
|
|
66
56
|
ejs: 'latest',
|
67
57
|
express: 'latest'
|
68
58
|
});
|
69
|
-
|
70
59
|
if (socketIo) {
|
71
60
|
this.addDependencies({
|
72
61
|
'socket.io': 'latest'
|
73
62
|
});
|
74
63
|
}
|
75
64
|
}
|
76
|
-
|
77
65
|
};
|
78
66
|
}
|
79
|
-
|
80
67
|
async install() {
|
81
68
|
if (this.options['skip-install']) {
|
82
69
|
return;
|
83
70
|
}
|
84
|
-
|
85
71
|
await this.spawnCommand('npm', ['install']);
|
86
72
|
}
|
87
|
-
|
88
73
|
};
|
@@ -1,13 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _chalk = _interopRequireDefault(require("chalk"));
|
4
|
-
|
5
4
|
var _path = _interopRequireDefault(require("path"));
|
6
|
-
|
7
5
|
var _generator = _interopRequireDefault(require("../../lib/generator"));
|
8
|
-
|
9
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
|
-
|
11
7
|
module.exports = class StorybookGenerator extends _generator.default {
|
12
8
|
constructor(...args) {
|
13
9
|
super(...args);
|
@@ -21,25 +17,20 @@ module.exports = class StorybookGenerator extends _generator.default {
|
|
21
17
|
required: false,
|
22
18
|
defaults: '../src/__stories__/*.story.jsx'
|
23
19
|
});
|
24
|
-
|
25
20
|
this.storybookPath = destPath => this.destinationPath(_path.default.join(this.options.path, destPath));
|
26
21
|
}
|
27
|
-
|
28
22
|
get prompting() {
|
29
23
|
return {
|
30
24
|
welcome() {
|
31
25
|
if (this.options.quiet) {
|
32
26
|
return;
|
33
27
|
}
|
34
|
-
|
35
28
|
console.log(_chalk.default.yellow('\n----------------------'));
|
36
29
|
console.log('Storybook Generator');
|
37
30
|
console.log(_chalk.default.yellow('----------------------\n'));
|
38
31
|
}
|
39
|
-
|
40
32
|
};
|
41
33
|
}
|
42
|
-
|
43
34
|
get writing() {
|
44
35
|
return {
|
45
36
|
staticFiles() {
|
@@ -52,13 +43,11 @@ module.exports = class StorybookGenerator extends _generator.default {
|
|
52
43
|
this.fs.copy(this.templatePath('preview-head.html'), this.storybookPath('preview-head.html'));
|
53
44
|
this.fs.copy(this.templatePath('storiesOf.jsx'), this.storybookPath('storiesOf.jsx'));
|
54
45
|
},
|
55
|
-
|
56
46
|
storiesPattern() {
|
57
47
|
this.fs.copyTpl(this.templatePath('stories.pattern'), this.storybookPath('stories.pattern'), {
|
58
48
|
pattern: this.options.pattern
|
59
49
|
});
|
60
50
|
},
|
61
|
-
|
62
51
|
packageJSON() {
|
63
52
|
const packageJSON = this.fs.exists(destPath) ? this.fs.readJSON(destPath) : {};
|
64
53
|
packageJSON['storybook-deployer'] = {
|
@@ -68,17 +57,14 @@ module.exports = class StorybookGenerator extends _generator.default {
|
|
68
57
|
};
|
69
58
|
this.packageJson.merge(packageJSON);
|
70
59
|
}
|
71
|
-
|
72
60
|
};
|
73
61
|
}
|
74
|
-
|
75
62
|
get install() {
|
76
63
|
return {
|
77
64
|
npm() {
|
78
65
|
if (this.options['skip-install']) {
|
79
66
|
return;
|
80
67
|
}
|
81
|
-
|
82
68
|
this.addDevDependencies({
|
83
69
|
'@storybook/addon-actions': 'latest',
|
84
70
|
'@storybook/addon-info': 'latest',
|
@@ -89,8 +75,6 @@ module.exports = class StorybookGenerator extends _generator.default {
|
|
89
75
|
'glob-loader': 'latest'
|
90
76
|
});
|
91
77
|
}
|
92
|
-
|
93
78
|
};
|
94
79
|
}
|
95
|
-
|
96
80
|
};
|
@@ -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 StylelintGenerator extends _generator.default {
|
10
7
|
constructor(...args) {
|
11
8
|
super(...args);
|
@@ -15,17 +12,14 @@ module.exports = class StylelintGenerator extends _generator.default {
|
|
15
12
|
defaults: true
|
16
13
|
});
|
17
14
|
}
|
18
|
-
|
19
15
|
prompting() {
|
20
16
|
if (this.options.quiet) {
|
21
17
|
return;
|
22
18
|
}
|
23
|
-
|
24
19
|
console.log(_chalk.default.yellow('\n----------------------'));
|
25
20
|
console.log('Stylelint Generator');
|
26
21
|
console.log(_chalk.default.yellow('----------------------\n'));
|
27
22
|
}
|
28
|
-
|
29
23
|
get writing() {
|
30
24
|
return {
|
31
25
|
stylelintrc() {
|
@@ -35,7 +29,6 @@ module.exports = class StylelintGenerator extends _generator.default {
|
|
35
29
|
camelCase: this.options['camel-case']
|
36
30
|
});
|
37
31
|
},
|
38
|
-
|
39
32
|
dependencies() {
|
40
33
|
this.addDevDependencies({
|
41
34
|
stylelint: '^15.0.0',
|
@@ -44,16 +37,12 @@ module.exports = class StylelintGenerator extends _generator.default {
|
|
44
37
|
'stylelint-config-standard': '^30.0.1'
|
45
38
|
});
|
46
39
|
}
|
47
|
-
|
48
40
|
};
|
49
41
|
}
|
50
|
-
|
51
42
|
async install() {
|
52
43
|
if (this.options['skip-install']) {
|
53
44
|
return;
|
54
45
|
}
|
55
|
-
|
56
46
|
await this.spawnCommand('npm', ['install']);
|
57
47
|
}
|
58
|
-
|
59
48
|
};
|
@@ -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 TestGenerator extends _generator.default {
|
10
7
|
constructor(...args) {
|
11
8
|
super(...args);
|
@@ -15,22 +12,18 @@ module.exports = class TestGenerator extends _generator.default {
|
|
15
12
|
defaults: 'jest'
|
16
13
|
});
|
17
14
|
}
|
18
|
-
|
19
15
|
get prompting() {
|
20
16
|
return {
|
21
17
|
welcome() {
|
22
18
|
if (this.options.quiet) {
|
23
19
|
return;
|
24
20
|
}
|
25
|
-
|
26
21
|
console.log(_chalk.default.yellow('\n----------------------'));
|
27
22
|
console.log('Test Generator');
|
28
23
|
console.log(_chalk.default.yellow('----------------------\n'));
|
29
24
|
}
|
30
|
-
|
31
25
|
};
|
32
26
|
}
|
33
|
-
|
34
27
|
get writing() {
|
35
28
|
return {
|
36
29
|
directories() {
|
@@ -40,33 +33,26 @@ module.exports = class TestGenerator extends _generator.default {
|
|
40
33
|
this.fs.copy(this.templatePath(`${type}/mocks`), this.destinationPath('__mocks__'));
|
41
34
|
this.fs.copy(this.templatePath(`${type}/tests`), this.destinationPath('__tests__'));
|
42
35
|
},
|
43
|
-
|
44
36
|
jestConfig() {
|
45
37
|
const {
|
46
38
|
type
|
47
39
|
} = this.options;
|
48
|
-
|
49
40
|
if (type !== 'jest') {
|
50
41
|
return;
|
51
42
|
}
|
52
|
-
|
53
43
|
const destPath = this.destinationPath('jest.config.js');
|
54
|
-
|
55
44
|
if (!this.fs.exists(destPath)) {
|
56
45
|
this.fs.copy(this.templatePath(`${type}/jest.config.js`), destPath);
|
57
46
|
}
|
58
47
|
}
|
59
|
-
|
60
48
|
};
|
61
49
|
}
|
62
|
-
|
63
50
|
get install() {
|
64
51
|
return {
|
65
52
|
npm() {
|
66
53
|
if (this.options['skip-install']) {
|
67
54
|
return;
|
68
55
|
}
|
69
|
-
|
70
56
|
this.addDevDependencies({
|
71
57
|
'babel-jest': 'latest',
|
72
58
|
enzyme: 'latest',
|
@@ -78,8 +64,6 @@ module.exports = class TestGenerator extends _generator.default {
|
|
78
64
|
sinon: 'latest'
|
79
65
|
});
|
80
66
|
}
|
81
|
-
|
82
67
|
};
|
83
68
|
}
|
84
|
-
|
85
69
|
};
|
package/lib/lib/generator.js
CHANGED
@@ -4,25 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _yeomanGenerator = _interopRequireDefault(require("yeoman-generator"));
|
9
|
-
|
10
8
|
var _immutable = _interopRequireDefault(require("immutable"));
|
11
|
-
|
12
9
|
var _path = _interopRequireDefault(require("path"));
|
13
|
-
|
14
10
|
var _lodash = _interopRequireDefault(require("lodash"));
|
15
|
-
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
-
|
18
|
-
function
|
19
|
-
|
12
|
+
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; }
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
14
|
+
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); }
|
20
15
|
class Generator extends _yeomanGenerator.default {
|
21
16
|
static getConfigPath() {
|
22
17
|
const home = process.env[process.platform === 'win32' ? 'USERPROFILE' : 'HOME'];
|
23
18
|
return _path.default.join(home, '.config/yeoman-generator-folklore/config.json');
|
24
19
|
}
|
25
|
-
|
26
20
|
constructor(args, options) {
|
27
21
|
super(args, options);
|
28
22
|
this._composerJson = null;
|
@@ -31,45 +25,33 @@ class Generator extends _yeomanGenerator.default {
|
|
31
25
|
defaults: false
|
32
26
|
});
|
33
27
|
}
|
34
|
-
|
35
28
|
get composerJson() {
|
36
29
|
if (!this._composerJson) {
|
37
30
|
this._composerJson = this.createStorage('composer.json');
|
38
31
|
}
|
39
|
-
|
40
32
|
return this._composerJson;
|
41
33
|
}
|
42
|
-
|
43
34
|
getConfig() {
|
44
35
|
const configPath = Generator.getConfigPath();
|
45
36
|
return this.fs.exists(configPath) ? this.fs.readJSON(configPath) : {};
|
46
37
|
}
|
47
|
-
|
48
38
|
updateConfig(data, force) {
|
49
39
|
const forceUpdate = force || false;
|
50
|
-
|
51
40
|
const config = _immutable.default.fromJS(this.getConfig());
|
52
|
-
|
53
41
|
let newConfig = Object.assign({}, config);
|
54
|
-
|
55
42
|
_lodash.default.each(data, (value, key) => {
|
56
43
|
if (forceUpdate || value && value.length && value !== _lodash.default.get(config, key)) {
|
57
44
|
newConfig = newConfig.set(key, value);
|
58
45
|
}
|
59
46
|
});
|
60
|
-
|
61
47
|
const newData = newConfig.toJS();
|
62
|
-
|
63
48
|
if (config !== newConfig) {
|
64
49
|
const configPath = Generator.getConfigPath();
|
65
50
|
this.fs.writeJSON(configPath, newData);
|
66
51
|
}
|
67
|
-
|
68
52
|
return newData;
|
69
53
|
}
|
70
|
-
|
71
54
|
}
|
72
|
-
|
73
55
|
_defineProperty(Generator, "prompts", {
|
74
56
|
project_name: {
|
75
57
|
type: 'input',
|
@@ -81,6 +63,5 @@ _defineProperty(Generator, "prompts", {
|
|
81
63
|
}
|
82
64
|
}
|
83
65
|
});
|
84
|
-
|
85
66
|
var _default = Generator;
|
86
67
|
exports.default = _default;
|