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.
Files changed (35) hide show
  1. package/lib/generators/app/index.js +3 -18
  2. package/lib/generators/babel/index.js +0 -12
  3. package/lib/generators/browserslist/index.js +0 -7
  4. package/lib/generators/build/index.js +0 -17
  5. package/lib/generators/cli/index.js +0 -18
  6. package/lib/generators/docs/index.js +3 -32
  7. package/lib/generators/editorconfig/index.js +0 -6
  8. package/lib/generators/eslint/index.js +0 -11
  9. package/lib/generators/html-project/index.js +0 -30
  10. package/lib/generators/intl/index.js +0 -13
  11. package/lib/generators/laravel/index.js +3 -75
  12. package/lib/generators/laravel-auth/index.js +0 -25
  13. package/lib/generators/laravel-mediatheque/index.js +0 -28
  14. package/lib/generators/laravel-package/index.js +0 -33
  15. package/lib/generators/laravel-panneau/index.js +0 -49
  16. package/lib/generators/laravel-project/index.js +9 -76
  17. package/lib/generators/lerna-package/index.js +0 -36
  18. package/lib/generators/lerna-repository/index.js +0 -34
  19. package/lib/generators/node-project/index.js +0 -28
  20. package/lib/generators/npm-package/index.js +0 -36
  21. package/lib/generators/prettier/index.js +0 -11
  22. package/lib/generators/react-app/index.js +3 -28
  23. package/lib/generators/react-package/index.js +0 -33
  24. package/lib/generators/rollup/index.js +0 -13
  25. package/lib/generators/sass-lint/index.js +0 -9
  26. package/lib/generators/scss/index.js +0 -16
  27. package/lib/generators/server/index.js +0 -15
  28. package/lib/generators/storybook/index.js +0 -16
  29. package/lib/generators/stylelint/index.js +0 -11
  30. package/lib/generators/stylelint/templates/stylelintrc +2 -1
  31. package/lib/generators/test/index.js +0 -16
  32. package/lib/lib/generator.js +3 -22
  33. package/lib/lib/mysql.js +0 -10
  34. package/lib/lib/utils.js +0 -4
  35. package/package.json +2 -2
@@ -1,36 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  var _chalk = _interopRequireDefault(require("chalk"));
4
-
5
4
  var _glob = _interopRequireDefault(require("glob"));
6
-
7
5
  var _lodash = _interopRequireDefault(require("lodash"));
8
-
9
6
  var _passwordGenerator = _interopRequireDefault(require("password-generator"));
10
-
11
7
  var _path = _interopRequireDefault(require("path"));
12
-
13
8
  var _yeomanRemote = _interopRequireDefault(require("yeoman-remote"));
14
-
15
9
  var _generator = _interopRequireDefault(require("../../lib/generator"));
16
-
17
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
-
19
11
  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; }
20
-
21
12
  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; }
22
-
23
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
24
-
13
+ 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; }
14
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
15
+ 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); }
25
16
  module.exports = class LaravelProjectGenerator extends _generator.default {
26
17
  static safeDbString(str) {
27
18
  return str.replace(/[-s.]+/gi, '_').replace(/[^a-z0-9]+/gi, '');
28
19
  }
29
-
30
20
  static getPassword() {
31
21
  return (0, _passwordGenerator.default)(20, false);
32
22
  }
33
-
34
23
  constructor(...args) {
35
24
  super(...args);
36
25
  this.argument('project-name', {
@@ -120,26 +109,21 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
120
109
  defaults: false
121
110
  });
122
111
  }
123
-
124
112
  get prompting() {
125
113
  return {
126
114
  welcome() {
127
115
  if (this.options.quiet) {
128
116
  return;
129
117
  }
130
-
131
118
  console.log(_chalk.default.yellow('\n----------------------'));
132
119
  console.log('Laravel Generator');
133
120
  console.log(_chalk.default.yellow('----------------------\n'));
134
121
  },
135
-
136
122
  prompts() {
137
123
  const prompts = [];
138
-
139
124
  if (!this.options['project-name']) {
140
125
  prompts.push(_generator.default.prompts.project_name);
141
126
  }
142
-
143
127
  if (!this.options['project-host']) {
144
128
  prompts.push({
145
129
  type: 'input',
@@ -151,7 +135,6 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
151
135
  }
152
136
  });
153
137
  }
154
-
155
138
  if (!this.options['db-name']) {
156
139
  prompts.push({
157
140
  type: 'input',
@@ -163,7 +146,6 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
163
146
  }
164
147
  });
165
148
  }
166
-
167
149
  const featuresChoices = [!this.options.mediatheque && {
168
150
  name: 'Mediatheque',
169
151
  value: 'mediatheque',
@@ -177,7 +159,6 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
177
159
  value: 'auth',
178
160
  checked: true
179
161
  }].filter(Boolean);
180
-
181
162
  if (featuresChoices.length) {
182
163
  prompts.push({
183
164
  type: 'checkbox',
@@ -187,56 +168,40 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
187
168
  default: featuresChoices.filter(it => it.checked || false).map(it => it.name)
188
169
  });
189
170
  }
190
-
191
171
  if (!prompts.length) {
192
172
  return null;
193
173
  }
194
-
195
174
  return this.prompt(prompts).then(answers => {
196
175
  if (answers['project-name']) {
197
176
  this.options['project-name'] = answers['project-name'];
198
177
  }
199
-
200
178
  if (answers['project-host']) {
201
179
  this.options['project-host'] = answers['project-host'];
202
180
  }
203
-
204
181
  if (answers['db-name']) {
205
182
  this.options['db-name'] = answers['db-name'];
206
183
  }
207
-
208
184
  const features = answers.features || [];
209
-
210
185
  if (features.indexOf('panneau') !== -1) {
211
186
  this.options.panneau = true;
212
187
  }
213
-
214
188
  if (features.indexOf('auth') !== -1) {
215
189
  this.options.auth = true;
216
190
  }
217
-
218
191
  if (features.indexOf('mediatheque') !== -1) {
219
192
  this.options.mediatheque = true;
220
193
  }
221
194
  });
222
195
  }
223
-
224
196
  };
225
197
  }
226
-
227
198
  configuring() {
228
199
  const assetsPath = _lodash.default.get(this.options, 'assets-path', '').replace(/\/$/, '');
229
-
230
200
  const publicPath = _lodash.default.get(this.options, 'public-path');
231
-
232
201
  const jsPath = _lodash.default.get(this.options, 'js-path');
233
-
234
202
  const jsSrcPath = _path.default.join(assetsPath, jsPath);
235
-
236
203
  const stylesPath = _lodash.default.get(this.options, 'styles-path');
237
-
238
204
  const stylesSrcPath = _path.default.join(assetsPath, stylesPath);
239
-
240
205
  this.composeWith('folklore:prettier', {
241
206
  'skip-install': true,
242
207
  quiet: true
@@ -285,7 +250,6 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
285
250
  quiet: true,
286
251
  'skip-install': true
287
252
  });
288
-
289
253
  if (this.options.mediatheque) {
290
254
  this.composeWith('folklore:laravel-mediatheque', {
291
255
  'project-name': this.options['project-name'],
@@ -293,14 +257,15 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
293
257
  quiet: true
294
258
  });
295
259
  }
296
-
297
260
  if (this.options.panneau) {
298
261
  this.composeWith('folklore:laravel-panneau', {
299
262
  'project-name': this.options['project-name'],
300
263
  'skip-install': true,
301
264
  quiet: true
302
265
  });
303
- } // if (this.options.auth) {
266
+ }
267
+
268
+ // if (this.options.auth) {
304
269
  // this.composeWith('folklore:laravel-auth', {
305
270
  // 'project-name': this.options['project-name'],
306
271
  // 'js-path': jsSrcPath,
@@ -310,7 +275,6 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
310
275
  // quiet: true,
311
276
  // });
312
277
  // }
313
-
314
278
  }
315
279
 
316
280
  get writing() {
@@ -323,36 +287,30 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
323
287
  } = this.options;
324
288
  const versionBranch = laravelVersion !== 'latest' && laravelVersion !== null ? `${laravelVersion.indexOf('.') !== -1 ? laravelVersion : `${laravelVersion}.x`}` : null;
325
289
  const branch = laravelBranch || versionBranch;
326
-
327
290
  const remoteCallback = (err, cachePath) => {
328
291
  const destinationPath = this.destinationPath();
329
-
330
292
  const files = _glob.default.sync('**', {
331
293
  dot: true,
332
294
  nodir: true,
333
295
  cwd: cachePath
334
296
  });
335
-
336
297
  let source;
337
298
  let destination;
338
299
  files.forEach(file => {
339
300
  source = _path.default.join(cachePath, file);
340
301
  destination = _path.default.join(destinationPath, file);
341
-
342
302
  if (!this.fs.exists(destination)) {
343
303
  this.fs.copy(source, destination);
344
304
  }
345
305
  });
346
306
  done();
347
307
  };
348
-
349
308
  if (branch !== null) {
350
309
  (0, _yeomanRemote.default)('laravel', 'laravel', branch, remoteCallback);
351
310
  } else {
352
311
  (0, _yeomanRemote.default)('laravel', 'laravel', remoteCallback);
353
312
  }
354
313
  },
355
-
356
314
  removeFiles() {
357
315
  const files = ['package.json', 'config/app.php', 'config/auth.php', 'routes/web.php', 'vite.config.js', 'resources/css', 'resources/js', 'resources/views/welcome.blade.php', 'app/Http/Controllers/HomeController.php', 'app/Http/Middleware/TrustProxies.php', 'app/Models/User.php'];
358
316
  files.forEach(file => {
@@ -360,7 +318,6 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
360
318
  this.fs.delete(filePath);
361
319
  });
362
320
  },
363
-
364
321
  composerJSON() {
365
322
  this.composerJson.merge({
366
323
  require: {
@@ -380,7 +337,6 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
380
337
  'prefer-stable': true
381
338
  });
382
339
  },
383
-
384
340
  packageJSON() {
385
341
  this.packageJson.merge({
386
342
  scripts: {
@@ -393,23 +349,19 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
393
349
  }
394
350
  });
395
351
  },
396
-
397
352
  env() {
398
353
  const url = _lodash.default.template(_lodash.default.get(this.options, 'url'))({
399
354
  project_host: this.options['project-host'],
400
355
  project_name: this.options['project-name']
401
356
  }).replace(/^(http)?(s)?(:\/\/)?/, 'http$2://');
402
-
403
357
  const urlLocal = _lodash.default.template(_lodash.default.get(this.options, 'local-url'))({
404
358
  project_host: this.options['project-host'],
405
359
  project_name: this.options['project-name']
406
360
  }).replace(/^(http)?(s)?(:\/\/)?/, 'http$2://');
407
-
408
361
  const urlProxy = _lodash.default.template(_lodash.default.get(this.options, 'proxy-url', _lodash.default.get(this.options, 'local-url')))({
409
362
  project_host: this.options['project-host'],
410
363
  project_name: this.options['project-name']
411
364
  }).replace(/^(http)?(s)?(:\/\/)?/, 'http$2://');
412
-
413
365
  const templateData = {
414
366
  project_name: this.options['project-name'],
415
367
  db_host: this.options['db-host'],
@@ -419,18 +371,18 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
419
371
  url: urlLocal,
420
372
  proxy_url: urlProxy
421
373
  };
422
-
423
374
  const prodTemplateData = _objectSpread(_objectSpread({}, templateData), {}, {
424
375
  url,
425
376
  db_username: this.options['db-name']
426
377
  });
427
-
428
378
  const src = this.templatePath('env');
429
379
  const dest = this.destinationPath('.env');
430
380
  this.fs.copyTpl(src, dest, templateData);
431
381
  const srcExample = this.templatePath('env');
432
382
  const destExample = this.destinationPath('.env.example');
433
- this.fs.copyTpl(srcExample, destExample, templateData); // const srcProd = this.templatePath('env.prod');
383
+ this.fs.copyTpl(srcExample, destExample, templateData);
384
+
385
+ // const srcProd = this.templatePath('env.prod');
434
386
  // const destProd = this.destinationPath('.env.prod');
435
387
  // this.fs.copyTpl(srcProd, destProd, prodTemplateData);
436
388
  },
@@ -438,18 +390,14 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
438
390
  files() {
439
391
  const templatePath = this.templatePath('laravel');
440
392
  const destinationPath = this.destinationPath();
441
-
442
393
  const files = _glob.default.sync('**', {
443
394
  dot: true,
444
395
  nodir: true,
445
396
  cwd: templatePath
446
397
  });
447
-
448
398
  files.forEach(file => {
449
399
  const source = _path.default.join(templatePath, file);
450
-
451
400
  const destination = _path.default.join(destinationPath, file);
452
-
453
401
  if (file.match(/\.php$/i)) {
454
402
  this.fs.copyTpl(source, destination, {
455
403
  options: this.options
@@ -459,63 +407,48 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
459
407
  }
460
408
  });
461
409
  }
462
-
463
410
  };
464
411
  }
465
-
466
412
  get install() {
467
413
  return {
468
414
  async npm() {
469
415
  if (this.options['skip-install']) {
470
416
  return;
471
417
  }
472
-
473
418
  await this.spawnCommand('npm', ['install']);
474
419
  },
475
-
476
420
  async composer() {
477
421
  if (this.options['skip-install']) {
478
422
  return;
479
423
  }
480
-
481
424
  await this.spawnCommand('composer', ['install']);
482
425
  },
483
-
484
426
  async keyGenerate() {
485
427
  if (this.options['skip-install']) {
486
428
  return;
487
429
  }
488
-
489
430
  await this.spawnCommand('php', ['artisan', 'key:generate']);
490
431
  },
491
-
492
432
  async vendorPublish() {
493
433
  if (this.options['skip-install']) {
494
434
  return;
495
435
  }
496
-
497
436
  await this.spawnCommand('php', ['artisan', 'vendor:publish', '--provider=Folklore\\ServiceProvider']);
498
437
  await this.spawnCommand('php', ['artisan', 'vendor:publish', '--provider=Folklore\\Locale\\LocaleServiceProvider']);
499
438
  await this.spawnCommand('php', ['artisan', 'vendor:publish', '--provider=Folklore\\Image\\ServiceProvider']);
500
439
  },
501
-
502
440
  async telescope() {
503
441
  if (this.options['skip-install']) {
504
442
  return;
505
443
  }
506
-
507
444
  await this.spawnCommand('php', ['artisan', 'telescope:install']);
508
445
  },
509
-
510
446
  async valet() {
511
447
  if (this.options['skip-install']) {
512
448
  return;
513
449
  }
514
-
515
450
  await this.spawnCommand('valet', ['link', '--secure', this.options['project-host']]);
516
451
  }
517
-
518
452
  };
519
453
  }
520
-
521
454
  };
@@ -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
  };