generator-folklore 3.0.16 → 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/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,13 @@
|
|
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
|
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; }
|
10
|
-
|
11
7
|
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; }
|
12
|
-
|
13
|
-
function
|
14
|
-
|
8
|
+
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; }
|
9
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
10
|
+
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); }
|
15
11
|
module.exports = class AppGenerator extends _generator.default {
|
16
12
|
// The name `constructor` is important here
|
17
13
|
constructor(...args) {
|
@@ -25,26 +21,21 @@ module.exports = class AppGenerator extends _generator.default {
|
|
25
21
|
required: false
|
26
22
|
});
|
27
23
|
}
|
28
|
-
|
29
24
|
get prompting() {
|
30
25
|
return {
|
31
26
|
welcome() {
|
32
27
|
if (this.options.quiet) {
|
33
28
|
return;
|
34
29
|
}
|
35
|
-
|
36
30
|
console.log(_chalk.default.yellow('\n----------------------'));
|
37
31
|
console.log('FOLKLORE Generator');
|
38
32
|
console.log(_chalk.default.yellow('----------------------\n'));
|
39
33
|
},
|
40
|
-
|
41
34
|
prompts() {
|
42
35
|
const prompts = [];
|
43
|
-
|
44
36
|
if (!this.options['project-name']) {
|
45
37
|
prompts.push(_generator.default.prompts.project_name);
|
46
38
|
}
|
47
|
-
|
48
39
|
if (!this.options.type) {
|
49
40
|
prompts.push({
|
50
41
|
type: 'list',
|
@@ -62,28 +53,22 @@ module.exports = class AppGenerator extends _generator.default {
|
|
62
53
|
}]
|
63
54
|
});
|
64
55
|
}
|
65
|
-
|
66
56
|
if (!prompts.length) {
|
67
57
|
return null;
|
68
58
|
}
|
69
|
-
|
70
59
|
return this.prompt(prompts).then(answers => {
|
71
60
|
if (answers.type) {
|
72
61
|
this.options.type = answers.type;
|
73
62
|
}
|
74
|
-
|
75
63
|
if (answers['project-name']) {
|
76
64
|
this.options['project-name'] = answers['project-name'];
|
77
65
|
}
|
78
66
|
});
|
79
67
|
}
|
80
|
-
|
81
68
|
};
|
82
69
|
}
|
83
|
-
|
84
70
|
configuring() {
|
85
71
|
const composeWith = `folklore:${this.options.type}`;
|
86
72
|
this.composeWith(composeWith, _objectSpread({}, this.options));
|
87
73
|
}
|
88
|
-
|
89
74
|
};
|
@@ -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 BabelGenerator extends _generator.default {
|
12
8
|
constructor(...args) {
|
13
9
|
super(...args);
|
@@ -27,17 +23,14 @@ module.exports = class BabelGenerator extends _generator.default {
|
|
27
23
|
defaults: false
|
28
24
|
});
|
29
25
|
}
|
30
|
-
|
31
26
|
prompting() {
|
32
27
|
if (this.options.quiet) {
|
33
28
|
return;
|
34
29
|
}
|
35
|
-
|
36
30
|
console.log(_chalk.default.yellow('\n----------------------'));
|
37
31
|
console.log('Babel Generator');
|
38
32
|
console.log(_chalk.default.yellow('----------------------\n'));
|
39
33
|
}
|
40
|
-
|
41
34
|
get writing() {
|
42
35
|
return {
|
43
36
|
config() {
|
@@ -54,7 +47,6 @@ module.exports = class BabelGenerator extends _generator.default {
|
|
54
47
|
reactIntl
|
55
48
|
});
|
56
49
|
},
|
57
|
-
|
58
50
|
dependencies() {
|
59
51
|
this.addDevDependencies({
|
60
52
|
'@babel/core': '^7.19.3',
|
@@ -65,16 +57,12 @@ module.exports = class BabelGenerator extends _generator.default {
|
|
65
57
|
'@babel/preset-react': 'latest'
|
66
58
|
});
|
67
59
|
}
|
68
|
-
|
69
60
|
};
|
70
61
|
}
|
71
|
-
|
72
62
|
async install() {
|
73
63
|
if (this.options['skip-install']) {
|
74
64
|
return;
|
75
65
|
}
|
76
|
-
|
77
66
|
await this.spawnCommand('npm', ['install']);
|
78
67
|
}
|
79
|
-
|
80
68
|
};
|
@@ -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 BrowsersListGenerator extends _generator.default {
|
10
7
|
get prompting() {
|
11
8
|
return {
|
@@ -13,19 +10,15 @@ module.exports = class BrowsersListGenerator 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('Browsers list Generator');
|
19
15
|
console.log(_chalk.default.yellow('----------------------\n'));
|
20
16
|
}
|
21
|
-
|
22
17
|
};
|
23
18
|
}
|
24
|
-
|
25
19
|
writing() {
|
26
20
|
const srcPath = this.templatePath('browserslistrc');
|
27
21
|
const destPath = this.destinationPath('.browserslistrc');
|
28
22
|
this.fs.copy(srcPath, destPath);
|
29
23
|
}
|
30
|
-
|
31
24
|
};
|
@@ -1,17 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _chalk = _interopRequireDefault(require("chalk"));
|
4
|
-
|
5
4
|
var _isArray = _interopRequireDefault(require("lodash/isArray"));
|
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 AppGenerator extends _generator.default {
|
16
10
|
// The name `constructor` is important here
|
17
11
|
constructor(...args) {
|
@@ -45,20 +39,16 @@ module.exports = class AppGenerator extends _generator.default {
|
|
45
39
|
type: Boolean,
|
46
40
|
defaults: true
|
47
41
|
});
|
48
|
-
|
49
42
|
this.ensureLeadingDotSlash = filePath => !_path.default.isAbsolute(filePath) && filePath.match(/^\./) === null ? `./${filePath}` : filePath;
|
50
43
|
}
|
51
|
-
|
52
44
|
prompting() {
|
53
45
|
if (this.options.quiet) {
|
54
46
|
return;
|
55
47
|
}
|
56
|
-
|
57
48
|
console.log(_chalk.default.yellow('\n----------------------'));
|
58
49
|
console.log('Build tools Generator');
|
59
50
|
console.log(_chalk.default.yellow('----------------------\n'));
|
60
51
|
}
|
61
|
-
|
62
52
|
get writing() {
|
63
53
|
return {
|
64
54
|
packageJSON() {
|
@@ -73,12 +63,10 @@ module.exports = class AppGenerator extends _generator.default {
|
|
73
63
|
const scripts = {
|
74
64
|
build: `flklr build --load-env ${(0, _utils.ensureLeadingDotSlash)(entryPath)}`
|
75
65
|
};
|
76
|
-
|
77
66
|
if (server) {
|
78
67
|
scripts.server = `flklr serve --load-env ${(0, _utils.ensureLeadingDotSlash)(entryPath)}`;
|
79
68
|
scripts.start = 'npm run server';
|
80
69
|
}
|
81
|
-
|
82
70
|
this.packageJson.merge({
|
83
71
|
scripts,
|
84
72
|
build: {
|
@@ -90,22 +78,17 @@ module.exports = class AppGenerator extends _generator.default {
|
|
90
78
|
}
|
91
79
|
});
|
92
80
|
},
|
93
|
-
|
94
81
|
dependencies() {
|
95
82
|
this.addDevDependencies({
|
96
83
|
'@folklore/cli': '^0.0.50'
|
97
84
|
});
|
98
85
|
}
|
99
|
-
|
100
86
|
};
|
101
87
|
}
|
102
|
-
|
103
88
|
async install() {
|
104
89
|
if (this.options['skip-install']) {
|
105
90
|
return;
|
106
91
|
}
|
107
|
-
|
108
92
|
await this.spawnCommand('npm', ['install']);
|
109
93
|
}
|
110
|
-
|
111
94
|
};
|
@@ -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 CliGenerator extends _generator.default {
|
14
9
|
// The name `constructor` is important here
|
15
10
|
constructor(...args) {
|
@@ -31,22 +26,18 @@ module.exports = class CliGenerator extends _generator.default {
|
|
31
26
|
defaults: './commands'
|
32
27
|
});
|
33
28
|
}
|
34
|
-
|
35
29
|
get prompting() {
|
36
30
|
return {
|
37
31
|
welcome() {
|
38
32
|
if (this.options.quiet) {
|
39
33
|
return;
|
40
34
|
}
|
41
|
-
|
42
35
|
console.log(_chalk.default.yellow('\n----------------------'));
|
43
36
|
console.log('CLI Generator');
|
44
37
|
console.log(_chalk.default.yellow('----------------------\n'));
|
45
38
|
}
|
46
|
-
|
47
39
|
};
|
48
40
|
}
|
49
|
-
|
50
41
|
get writing() {
|
51
42
|
return {
|
52
43
|
index() {
|
@@ -59,37 +50,28 @@ module.exports = class CliGenerator extends _generator.default {
|
|
59
50
|
commands
|
60
51
|
});
|
61
52
|
},
|
62
|
-
|
63
53
|
commands() {
|
64
54
|
if (!this.options.commands) {
|
65
55
|
return;
|
66
56
|
}
|
67
|
-
|
68
57
|
const templateData = {};
|
69
|
-
|
70
58
|
const commandsPath = this.options['commands-path'] || _path.default.join(this.options.path, 'commands');
|
71
|
-
|
72
59
|
const srcPath = this.templatePath('commands');
|
73
60
|
const destPath = this.destinationPath(commandsPath);
|
74
61
|
this.fs.copyTpl(srcPath, destPath, templateData);
|
75
62
|
},
|
76
|
-
|
77
63
|
dependencies() {
|
78
64
|
this.addDependencies({
|
79
65
|
'commander': 'latest',
|
80
66
|
'debug': 'latest'
|
81
67
|
});
|
82
68
|
}
|
83
|
-
|
84
69
|
};
|
85
70
|
}
|
86
|
-
|
87
71
|
async install() {
|
88
72
|
if (this.options['skip-install']) {
|
89
73
|
return;
|
90
74
|
}
|
91
|
-
|
92
75
|
await this.spawnCommand('npm', ['install']);
|
93
76
|
}
|
94
|
-
|
95
77
|
};
|
@@ -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 DocsGenerator extends _generator.default {
|
20
14
|
constructor(...args) {
|
21
15
|
super(...args);
|
@@ -28,25 +22,20 @@ module.exports = class DocsGenerator extends _generator.default {
|
|
28
22
|
type: String,
|
29
23
|
required: false
|
30
24
|
});
|
31
|
-
|
32
25
|
this.docsPath = destPath => this.destinationPath(_path.default.join(this.options['docs-path'], destPath || ''));
|
33
26
|
}
|
34
|
-
|
35
27
|
get prompting() {
|
36
28
|
return {
|
37
29
|
welcome() {
|
38
30
|
if (this.options.quiet) {
|
39
31
|
return;
|
40
32
|
}
|
41
|
-
|
42
33
|
console.log(_chalk.default.yellow('\n----------------------'));
|
43
34
|
console.log('Eslint Generator');
|
44
35
|
console.log(_chalk.default.yellow('----------------------\n'));
|
45
36
|
},
|
46
|
-
|
47
37
|
prompts() {
|
48
38
|
const prompts = [];
|
49
|
-
|
50
39
|
if (!this.options.language) {
|
51
40
|
prompts.push({
|
52
41
|
type: 'list',
|
@@ -62,21 +51,17 @@ module.exports = class DocsGenerator extends _generator.default {
|
|
62
51
|
}]
|
63
52
|
});
|
64
53
|
}
|
65
|
-
|
66
54
|
if (!prompts.length) {
|
67
55
|
return null;
|
68
56
|
}
|
69
|
-
|
70
57
|
return this.prompt(prompts).then(answers => {
|
71
58
|
if (answers.language) {
|
72
59
|
this.language = answers.language;
|
73
60
|
}
|
74
61
|
});
|
75
62
|
}
|
76
|
-
|
77
63
|
};
|
78
64
|
}
|
79
|
-
|
80
65
|
get writing() {
|
81
66
|
return {
|
82
67
|
bookJSON() {
|
@@ -84,42 +69,34 @@ module.exports = class DocsGenerator extends _generator.default {
|
|
84
69
|
const destPath = this.destinationPath('book.json');
|
85
70
|
this.fs.copy(srcPath, destPath);
|
86
71
|
},
|
87
|
-
|
88
72
|
jsdocJSON() {
|
89
73
|
if (this.options.language !== 'js') {
|
90
74
|
return;
|
91
75
|
}
|
92
|
-
|
93
76
|
const srcPath = this.templatePath('jsdoc.json');
|
94
77
|
const destPath = this.destinationPath('jsdoc.json');
|
95
78
|
this.fs.copy(srcPath, destPath);
|
96
79
|
},
|
97
|
-
|
98
80
|
phpdoc() {
|
99
81
|
if (this.options.language !== 'php') {
|
100
82
|
return;
|
101
83
|
}
|
102
|
-
|
103
84
|
const srcPath = this.templatePath('phpdoc.xml');
|
104
85
|
const destPath = this.destinationPath('phpdoc.xml');
|
105
86
|
this.fs.copy(srcPath, destPath);
|
106
87
|
},
|
107
|
-
|
108
88
|
docs() {
|
109
89
|
const srcPath = this.templatePath('docs');
|
110
90
|
const destPath = this.docsPath();
|
111
91
|
this.fs.copy(srcPath, destPath);
|
112
92
|
},
|
113
|
-
|
114
93
|
generateApiDoc() {
|
115
94
|
const srcPath = this.templatePath(`generate_api_doc.${this.options.language}`);
|
116
95
|
const destPath = this.destinationPath(this.docsPath('scripts/generate_api_doc'));
|
117
96
|
this.fs.copy(srcPath, destPath);
|
118
97
|
},
|
119
|
-
|
120
98
|
packageJSON() {
|
121
99
|
const generateApiPath = _path.default.relative(this.destinationPath(), this.destinationPath(this.docsPath('./scripts/generate_api_doc')));
|
122
|
-
|
123
100
|
const scripts = {
|
124
101
|
'docs:prepare': 'gitbook install',
|
125
102
|
'docs:api': `phpdoc && ${generateApiPath}`,
|
@@ -130,21 +107,17 @@ module.exports = class DocsGenerator extends _generator.default {
|
|
130
107
|
packageJSON.scripts = _objectSpread(_objectSpread({}, packageJSON.scripts), scripts);
|
131
108
|
this.packageJson.merge(packageJSON);
|
132
109
|
}
|
133
|
-
|
134
110
|
};
|
135
111
|
}
|
136
|
-
|
137
112
|
get install() {
|
138
113
|
return {
|
139
114
|
npm() {
|
140
115
|
if (this.options['skip-install']) {
|
141
116
|
return;
|
142
117
|
}
|
143
|
-
|
144
118
|
this.addDevDependencies({
|
145
119
|
'gitbook-cli': 'latest'
|
146
120
|
});
|
147
|
-
|
148
121
|
if (this.options.language === 'js') {
|
149
122
|
this.addDevDependencies({
|
150
123
|
jsdoc: 'latest',
|
@@ -152,8 +125,6 @@ module.exports = class DocsGenerator extends _generator.default {
|
|
152
125
|
});
|
153
126
|
}
|
154
127
|
}
|
155
|
-
|
156
128
|
};
|
157
129
|
}
|
158
|
-
|
159
130
|
};
|
@@ -1,26 +1,20 @@
|
|
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 EditorConfigGenerator extends _generator.default {
|
10
7
|
prompting() {
|
11
8
|
if (this.options.quiet) {
|
12
9
|
return;
|
13
10
|
}
|
14
|
-
|
15
11
|
console.log(_chalk.default.yellow('\n----------------------'));
|
16
12
|
console.log('Editor Config Generator');
|
17
13
|
console.log(_chalk.default.yellow('----------------------\n'));
|
18
14
|
}
|
19
|
-
|
20
15
|
writing() {
|
21
16
|
const srcPath = this.templatePath('editorconfig');
|
22
17
|
const destPath = this.destinationPath('.editorconfig');
|
23
18
|
this.fs.copy(srcPath, destPath);
|
24
19
|
}
|
25
|
-
|
26
20
|
};
|
@@ -1,22 +1,17 @@
|
|
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 EslintGenerator extends _generator.default {
|
10
7
|
prompting() {
|
11
8
|
if (this.options.quiet) {
|
12
9
|
return;
|
13
10
|
}
|
14
|
-
|
15
11
|
console.log(_chalk.default.yellow('\n----------------------'));
|
16
12
|
console.log('Eslint Generator');
|
17
13
|
console.log(_chalk.default.yellow('----------------------\n'));
|
18
14
|
}
|
19
|
-
|
20
15
|
get writing() {
|
21
16
|
return {
|
22
17
|
eslintrc() {
|
@@ -24,13 +19,11 @@ module.exports = class EslintGenerator extends _generator.default {
|
|
24
19
|
const destPath = this.destinationPath('.eslintrc');
|
25
20
|
this.fs.copy(srcPath, destPath);
|
26
21
|
},
|
27
|
-
|
28
22
|
eslintignore() {
|
29
23
|
const srcPath = this.templatePath('eslintignore');
|
30
24
|
const destPath = this.destinationPath('.eslintignore');
|
31
25
|
this.fs.copy(srcPath, destPath);
|
32
26
|
},
|
33
|
-
|
34
27
|
dependencies() {
|
35
28
|
this.addDevDependencies({
|
36
29
|
'babel-preset-airbnb': '^5.0.0',
|
@@ -45,16 +38,12 @@ module.exports = class EslintGenerator extends _generator.default {
|
|
45
38
|
'eslint-plugin-formatjs': '^4.2.2'
|
46
39
|
});
|
47
40
|
}
|
48
|
-
|
49
41
|
};
|
50
42
|
}
|
51
|
-
|
52
43
|
async install() {
|
53
44
|
if (this.options['skip-install']) {
|
54
45
|
return;
|
55
46
|
}
|
56
|
-
|
57
47
|
await this.spawnCommand('npm', ['install']);
|
58
48
|
}
|
59
|
-
|
60
49
|
};
|
@@ -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 HTMLProjectGenerator extends _generator.default {
|
14
9
|
// The name `constructor` is important here
|
15
10
|
constructor(...args) {
|
@@ -52,43 +47,34 @@ module.exports = class HTMLProjectGenerator extends _generator.default {
|
|
52
47
|
type: String,
|
53
48
|
desc: 'Filename for the node.js server'
|
54
49
|
});
|
55
|
-
|
56
50
|
this.srcPath = filePath => this.destinationPath(_path.default.join(this.options['src-path'], filePath));
|
57
51
|
}
|
58
|
-
|
59
52
|
get prompting() {
|
60
53
|
return {
|
61
54
|
welcome() {
|
62
55
|
if (this.options.quiet) {
|
63
56
|
return;
|
64
57
|
}
|
65
|
-
|
66
58
|
console.log(_chalk.default.yellow('\n----------------------'));
|
67
59
|
console.log('HTML Project Generator');
|
68
60
|
console.log(_chalk.default.yellow('----------------------\n'));
|
69
61
|
},
|
70
|
-
|
71
62
|
prompts() {
|
72
63
|
const prompts = [];
|
73
|
-
|
74
64
|
if (!this.options['project-name']) {
|
75
65
|
prompts.push(_generator.default.prompts.project_name);
|
76
66
|
}
|
77
|
-
|
78
67
|
if (!prompts.length) {
|
79
68
|
return null;
|
80
69
|
}
|
81
|
-
|
82
70
|
return this.prompt(prompts).then(answers => {
|
83
71
|
if (answers['project-name']) {
|
84
72
|
this.options['project-name'] = answers['project-name'];
|
85
73
|
}
|
86
74
|
});
|
87
75
|
}
|
88
|
-
|
89
76
|
};
|
90
77
|
}
|
91
|
-
|
92
78
|
configuring() {
|
93
79
|
const {
|
94
80
|
'project-name': projectName,
|
@@ -99,13 +85,9 @@ module.exports = class HTMLProjectGenerator extends _generator.default {
|
|
99
85
|
'server-path': serverPath,
|
100
86
|
'server-filename': serverFilename
|
101
87
|
} = this.options;
|
102
|
-
|
103
88
|
const jsSrcPath = _path.default.join(srcPath, jsPath);
|
104
|
-
|
105
89
|
const stylesSrcPath = _path.default.join(srcPath, stylesPath);
|
106
|
-
|
107
90
|
const serverSrcPath = _path.default.join(srcPath, serverPath);
|
108
|
-
|
109
91
|
this.composeWith('folklore:prettier', {
|
110
92
|
'skip-install': true,
|
111
93
|
quiet: true
|
@@ -139,7 +121,6 @@ module.exports = class HTMLProjectGenerator extends _generator.default {
|
|
139
121
|
'skip-install': true,
|
140
122
|
quiet: true
|
141
123
|
});
|
142
|
-
|
143
124
|
if (this.options.server) {
|
144
125
|
this.composeWith('folklore:server', {
|
145
126
|
path: serverSrcPath,
|
@@ -148,7 +129,6 @@ module.exports = class HTMLProjectGenerator extends _generator.default {
|
|
148
129
|
quiet: true
|
149
130
|
});
|
150
131
|
}
|
151
|
-
|
152
132
|
console.log(srcPath, jsSrcPath, _path.default.join(jsSrcPath, 'index.js'), _path.default.join(srcPath, 'index.html.ejs'));
|
153
133
|
this.composeWith('folklore:build', {
|
154
134
|
'src-path': srcPath,
|
@@ -162,16 +142,12 @@ module.exports = class HTMLProjectGenerator extends _generator.default {
|
|
162
142
|
quiet: true
|
163
143
|
});
|
164
144
|
}
|
165
|
-
|
166
145
|
get writing() {
|
167
146
|
return {
|
168
147
|
html() {
|
169
148
|
const projectName = _lodash.default.get(this.options, 'project-name');
|
170
|
-
|
171
149
|
const jsPath = _lodash.default.get(this.options, 'js-path', 'js').replace(/^\/?/, '/');
|
172
|
-
|
173
150
|
const cssPath = _lodash.default.get(this.options, 'css-path', 'css').replace(/^\/?/, '/');
|
174
|
-
|
175
151
|
const srcPath = this.templatePath('index.html.ejs');
|
176
152
|
const destPath = this.srcPath('index.html.ejs');
|
177
153
|
this.fs.copyTpl(srcPath, destPath, {
|
@@ -180,28 +156,22 @@ module.exports = class HTMLProjectGenerator extends _generator.default {
|
|
180
156
|
cssPath
|
181
157
|
});
|
182
158
|
},
|
183
|
-
|
184
159
|
img() {
|
185
160
|
const srcPath = this.templatePath('folklore.png');
|
186
161
|
const destPath = this.srcPath('img/folklore.png');
|
187
162
|
this.fs.copy(srcPath, destPath);
|
188
163
|
},
|
189
|
-
|
190
164
|
gitignore() {
|
191
165
|
const srcPath = this.templatePath('gitignore');
|
192
166
|
const destPath = this.destinationPath('.gitignore');
|
193
167
|
this.fs.copy(srcPath, destPath);
|
194
168
|
}
|
195
|
-
|
196
169
|
};
|
197
170
|
}
|
198
|
-
|
199
171
|
async install() {
|
200
172
|
if (this.options['skip-install']) {
|
201
173
|
return;
|
202
174
|
}
|
203
|
-
|
204
175
|
await this.spawnCommand('npm', ['install']);
|
205
176
|
}
|
206
|
-
|
207
177
|
};
|