generator-folklore 3.0.16 → 3.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. package/lib/generators/app/index.js +5 -20
  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 +5 -34
  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 +5 -77
  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 +11 -78
  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 +5 -30
  23. package/lib/generators/react-app/templates/index.js +3 -3
  24. package/lib/generators/react-app/templates/src/components/App.jsx +28 -32
  25. package/lib/generators/react-app/templates/src/components/Routes.jsx +46 -0
  26. package/lib/generators/react-app/templates/src/components/buttons/Button.jsx +3 -0
  27. package/lib/generators/react-app/templates/src/components/layouts/Main.jsx +1 -3
  28. package/lib/generators/react-app/templates/src/components/menus/Menu.jsx +2 -3
  29. package/lib/generators/react-package/index.js +0 -33
  30. package/lib/generators/rollup/index.js +0 -13
  31. package/lib/generators/sass-lint/index.js +0 -9
  32. package/lib/generators/scss/index.js +0 -16
  33. package/lib/generators/server/index.js +0 -15
  34. package/lib/generators/storybook/index.js +0 -16
  35. package/lib/generators/stylelint/index.js +0 -11
  36. package/lib/generators/stylelint/templates/stylelintrc +2 -1
  37. package/lib/generators/test/index.js +0 -16
  38. package/lib/lib/generator.js +4 -24
  39. package/lib/lib/mysql.js +0 -10
  40. package/lib/lib/utils.js +0 -4
  41. package/package.json +2 -2
  42. package/lib/generators/react-app/templates/src/components/Container.jsx +0 -42
@@ -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 IntlGenerator extends _generator.default {
12
8
  constructor(...args) {
13
9
  super(...args);
@@ -36,22 +32,18 @@ module.exports = class IntlGenerator extends _generator.default {
36
32
  defaults: false
37
33
  });
38
34
  }
39
-
40
35
  get prompting() {
41
36
  return {
42
37
  welcome() {
43
38
  if (this.options.quiet) {
44
39
  return;
45
40
  }
46
-
47
41
  console.log(_chalk.default.yellow('\n----------------------'));
48
42
  console.log('Intl Generator');
49
43
  console.log(_chalk.default.yellow('----------------------\n'));
50
44
  }
51
-
52
45
  };
53
46
  }
54
-
55
47
  get writing() {
56
48
  return {
57
49
  packageJSON() {
@@ -74,22 +66,17 @@ module.exports = class IntlGenerator extends _generator.default {
74
66
  supportedLocales: locales.split(',')
75
67
  });
76
68
  },
77
-
78
69
  dependencies() {
79
70
  this.addDevDependencies({
80
71
  '@folklore/cli': '^0.0.50'
81
72
  });
82
73
  }
83
-
84
74
  };
85
75
  }
86
-
87
76
  async install() {
88
77
  if (this.options['skip-install']) {
89
78
  return;
90
79
  }
91
-
92
80
  await this.spawnCommand('npm', ['install']);
93
81
  }
94
-
95
82
  };
@@ -1,36 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  var _lodash = _interopRequireDefault(require("lodash"));
4
-
5
4
  var _yeomanRemote = _interopRequireDefault(require("yeoman-remote"));
6
-
7
5
  var _glob = _interopRequireDefault(require("glob"));
8
-
9
6
  var _path = _interopRequireDefault(require("path"));
10
-
11
7
  var _chalk = _interopRequireDefault(require("chalk"));
12
-
13
8
  var _passwordGenerator = _interopRequireDefault(require("password-generator"));
14
-
15
9
  var _generator = _interopRequireDefault(require("../../lib/generator"));
16
-
17
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
-
19
- 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
- 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
-
11
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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 LaravelGenerator 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', {
@@ -125,26 +114,21 @@ module.exports = class LaravelGenerator extends _generator.default {
125
114
  defaults: false
126
115
  });
127
116
  }
128
-
129
117
  get prompting() {
130
118
  return {
131
119
  welcome() {
132
120
  if (this.options.quiet) {
133
121
  return;
134
122
  }
135
-
136
123
  console.log(_chalk.default.yellow('\n----------------------'));
137
124
  console.log('Laravel Generator');
138
125
  console.log(_chalk.default.yellow('----------------------\n'));
139
126
  },
140
-
141
127
  prompts() {
142
128
  const prompts = [];
143
-
144
129
  if (!this.options['project-name']) {
145
130
  prompts.push(_generator.default.prompts.project_name);
146
131
  }
147
-
148
132
  if (!this.options['project-host']) {
149
133
  prompts.push({
150
134
  type: 'input',
@@ -156,7 +140,6 @@ module.exports = class LaravelGenerator extends _generator.default {
156
140
  }
157
141
  });
158
142
  }
159
-
160
143
  if (!this.options['db-name']) {
161
144
  prompts.push({
162
145
  type: 'input',
@@ -168,7 +151,6 @@ module.exports = class LaravelGenerator extends _generator.default {
168
151
  }
169
152
  });
170
153
  }
171
-
172
154
  const featuresChoices = [!this.options.panneau && {
173
155
  name: 'Panneau',
174
156
  value: 'panneau',
@@ -178,7 +160,6 @@ module.exports = class LaravelGenerator extends _generator.default {
178
160
  value: 'auth',
179
161
  checked: true
180
162
  }].filter(Boolean);
181
-
182
163
  if (featuresChoices.length) {
183
164
  prompts.push({
184
165
  type: 'checkbox',
@@ -188,68 +169,48 @@ module.exports = class LaravelGenerator extends _generator.default {
188
169
  default: featuresChoices.filter(it => it.checked || false).map(it => it.name)
189
170
  });
190
171
  }
191
-
192
172
  if (!prompts.length) {
193
173
  return null;
194
174
  }
195
-
196
175
  return this.prompt(prompts).then(answers => {
197
176
  if (answers['project-name']) {
198
177
  this.options['project-name'] = answers['project-name'];
199
178
  }
200
-
201
179
  if (answers['project-host']) {
202
180
  this.options['project-host'] = answers['project-host'];
203
181
  }
204
-
205
182
  if (answers['db-name']) {
206
183
  this.options['db-name'] = answers['db-name'];
207
184
  }
208
-
209
185
  const features = answers.features || [];
210
-
211
186
  if (features.indexOf('panneau') !== -1) {
212
187
  this.options.panneau = true;
213
188
  }
214
-
215
189
  if (features.indexOf('auth') !== -1) {
216
190
  this.options.auth = true;
217
191
  }
218
192
  });
219
193
  }
220
-
221
194
  };
222
195
  }
223
-
224
196
  configuring() {
225
197
  const assetsPath = _lodash.default.get(this.options, 'assets-path', '').replace(/\/$/, '');
226
-
227
198
  const tmpPath = _lodash.default.get(this.options, 'tmp-path', '').replace(/\/$/, '');
228
-
229
199
  const publicPath = _lodash.default.get(this.options, 'public-path');
230
-
231
200
  const buildPath = _lodash.default.get(this.options, 'build-path');
232
-
233
201
  const jsPath = _lodash.default.get(this.options, 'js-path');
234
-
235
202
  const jsSrcPath = _path.default.join(assetsPath, jsPath);
236
-
237
203
  const stylesPath = _lodash.default.get(this.options, 'styles-path');
238
-
239
204
  const stylesSrcPath = _path.default.join(assetsPath, stylesPath);
240
-
241
205
  const skipInstall = _lodash.default.get(this.options, 'skip-install', false);
242
-
243
206
  const urlLocal = _lodash.default.template(_lodash.default.get(this.options, 'local-url'))({
244
207
  project_host: this.options['project-host'],
245
208
  project_name: this.options['project-name']
246
209
  }).replace(/^(http)?(s)?(:\/\/)?/, 'http$2://');
247
-
248
210
  const urlProxy = _lodash.default.template(_lodash.default.get(this.options, 'proxy-url', _lodash.default.get(this.options, 'local-url')))({
249
211
  project_host: this.options['project-host'],
250
212
  project_name: this.options['project-name']
251
213
  }).replace(/^(http)?(s)?(:\/\/)?/, 'http$2://');
252
-
253
214
  this.composeWith('folklore:react-app', {
254
215
  'project-name': this.options['project-name'],
255
216
  path: jsSrcPath,
@@ -279,7 +240,6 @@ module.exports = class LaravelGenerator extends _generator.default {
279
240
  'skip-install': skipInstall,
280
241
  quiet: true
281
242
  });
282
-
283
243
  if (this.options.panneau) {
284
244
  this.composeWith('folklore:laravel-panneau', {
285
245
  'project-name': this.options['project-name'],
@@ -290,7 +250,6 @@ module.exports = class LaravelGenerator extends _generator.default {
290
250
  quiet: true
291
251
  });
292
252
  }
293
-
294
253
  if (this.options.auth) {
295
254
  this.composeWith('folklore:laravel-auth', {
296
255
  'project-name': this.options['project-name'],
@@ -302,7 +261,6 @@ module.exports = class LaravelGenerator extends _generator.default {
302
261
  });
303
262
  }
304
263
  }
305
-
306
264
  get writing() {
307
265
  return {
308
266
  laravel() {
@@ -311,19 +269,16 @@ module.exports = class LaravelGenerator extends _generator.default {
311
269
  const branch = this.options['laravel-branch'] || versionBranch;
312
270
  (0, _yeomanRemote.default)('laravel', 'laravel', branch, (err, cachePath) => {
313
271
  const destinationPath = this.destinationPath();
314
-
315
272
  const files = _glob.default.sync('**', {
316
273
  dot: true,
317
274
  nodir: true,
318
275
  cwd: cachePath
319
276
  });
320
-
321
277
  let source;
322
278
  let destination;
323
279
  files.forEach(file => {
324
280
  source = _path.default.join(cachePath, file);
325
281
  destination = _path.default.join(destinationPath, file);
326
-
327
282
  if (!this.fs.exists(destination)) {
328
283
  this.fs.copy(source, destination);
329
284
  }
@@ -331,7 +286,6 @@ module.exports = class LaravelGenerator extends _generator.default {
331
286
  done();
332
287
  });
333
288
  },
334
-
335
289
  removeFiles() {
336
290
  const files = ['gulpfile.js', 'package.json', 'webpack.mix.js', 'config/app.php', 'routes/web.php', 'public/css/app.css', 'public/js/app.js', 'app/Exceptions/Handler.php', 'app/Providers/AppServiceProvider.php', 'resources/sass/**', 'resources/js/**', 'resources/sass', 'resources/js', 'resources/assets/sass/**', 'resources/assets/js/**', 'resources/assets/sass', 'resources/assets/js', 'resources/views/welcome.blade.php', 'resources/views/errors/404.blade.php', 'resources/views/errors/500.blade.php'];
337
291
  files.forEach(file => {
@@ -339,7 +293,6 @@ module.exports = class LaravelGenerator extends _generator.default {
339
293
  this.fs.delete(filePath);
340
294
  });
341
295
  },
342
-
343
296
  packageJSON() {
344
297
  const packageJSON = this.fs.exists(jsonPath) ? this.fs.readJSON(jsonPath) : {};
345
298
  this.packageJson.merge(_objectSpread(_objectSpread({}, packageJSON), {}, {
@@ -347,7 +300,6 @@ module.exports = class LaravelGenerator extends _generator.default {
347
300
  devDependencies: {}
348
301
  }));
349
302
  },
350
-
351
303
  composerJSON() {
352
304
  const srcPath = this.templatePath('_composer.json');
353
305
  const destPath = this.destinationPath('composer.json');
@@ -355,18 +307,15 @@ module.exports = class LaravelGenerator extends _generator.default {
355
307
  const currentJson = this.fs.exists(destPath) ? this.fs.readJSON(destPath) : {};
356
308
  this.fs.writeJSON(destPath, _lodash.default.merge(currentJson, newJson));
357
309
  },
358
-
359
310
  env() {
360
311
  const url = _lodash.default.template(_lodash.default.get(this.options, 'url'))({
361
312
  project_host: this.options['project-host'],
362
313
  project_name: this.options['project-name']
363
314
  }).replace(/^(http)?(s)?(:\/\/)?/, 'http$2://');
364
-
365
315
  const urlLocal = _lodash.default.template(_lodash.default.get(this.options, 'local-url'))({
366
316
  project_host: this.options['project-host'],
367
317
  project_name: this.options['project-name']
368
318
  }).replace(/^(http)?(s)?(:\/\/)?/, 'http$2://');
369
-
370
319
  const templateData = {
371
320
  project_name: this.options['project-name'],
372
321
  db_host: this.options['db-host'],
@@ -375,12 +324,10 @@ module.exports = class LaravelGenerator extends _generator.default {
375
324
  db_name: this.options['db-name'],
376
325
  url: urlLocal
377
326
  };
378
-
379
327
  const prodTemplateData = _objectSpread(_objectSpread({}, templateData), {}, {
380
328
  url,
381
329
  db_username: this.options['db-name']
382
330
  });
383
-
384
331
  const src = this.templatePath('env');
385
332
  const dest = this.destinationPath('.env');
386
333
  this.fs.copyTpl(src, dest, templateData);
@@ -391,39 +338,30 @@ module.exports = class LaravelGenerator extends _generator.default {
391
338
  const destProd = this.destinationPath('.env.prod');
392
339
  this.fs.copyTpl(srcProd, destProd, prodTemplateData);
393
340
  },
394
-
395
341
  phpcs() {
396
342
  const srcPath = this.templatePath('phpcs.xml');
397
343
  const destPath = this.destinationPath('phpcs.xml');
398
344
  this.fs.copy(srcPath, destPath);
399
345
  },
400
-
401
346
  gitignore() {
402
347
  const srcPath = this.templatePath('gitignore');
403
348
  const destPath = this.destinationPath('.gitignore');
404
-
405
349
  if (this.fs.exists(destPath)) {
406
350
  this.fs.delete(destPath);
407
351
  }
408
-
409
352
  this.fs.copy(srcPath, destPath);
410
353
  },
411
-
412
354
  files() {
413
355
  const templatePath = this.templatePath('laravel');
414
356
  const destinationPath = this.destinationPath();
415
-
416
357
  const files = _glob.default.sync('**', {
417
358
  dot: true,
418
359
  nodir: true,
419
360
  cwd: templatePath
420
361
  });
421
-
422
362
  files.forEach(file => {
423
363
  const source = _path.default.join(templatePath, file);
424
-
425
364
  const destination = _path.default.join(destinationPath, file);
426
-
427
365
  if (file.match(/\.php$/i)) {
428
366
  this.fs.copyTpl(source, destination, {
429
367
  options: this.options
@@ -433,45 +371,35 @@ module.exports = class LaravelGenerator extends _generator.default {
433
371
  }
434
372
  });
435
373
  }
436
-
437
374
  };
438
375
  }
439
-
440
376
  get install() {
441
377
  return {
442
378
  composer() {
443
379
  if (this.options['skip-install']) {
444
380
  return;
445
381
  }
446
-
447
382
  const done = this.async();
448
383
  this.spawnCommand('composer', ['install']).on('close', done);
449
384
  },
450
-
451
385
  permissions() {
452
386
  this.spawnCommand('chmod', ['-R', '777', 'storage']);
453
387
  this.spawnCommand('chmod', ['-R', '777', 'public/files']);
454
388
  },
455
-
456
389
  keyGenerate() {
457
390
  if (this.options['skip-install']) {
458
391
  return;
459
392
  }
460
-
461
393
  const done = this.async();
462
394
  this.spawnCommand('php', ['artisan', 'key:generate']).on('close', done);
463
395
  },
464
-
465
396
  vendorPublish() {
466
397
  if (this.options['skip-install']) {
467
398
  return;
468
399
  }
469
-
470
400
  const done = this.async();
471
401
  this.spawnCommand('php', ['artisan', 'vendor:publish', '--all']).on('close', done);
472
402
  }
473
-
474
403
  };
475
404
  }
476
-
477
405
  };
@@ -1,17 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _lodash = _interopRequireDefault(require("lodash"));
4
-
5
4
  var _chalk = _interopRequireDefault(require("chalk"));
6
-
7
5
  var _glob = _interopRequireDefault(require("glob"));
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 LaravelAuthGenerator extends _generator.default {
16
10
  constructor(...args) {
17
11
  super(...args);
@@ -28,40 +22,32 @@ module.exports = class LaravelAuthGenerator extends _generator.default {
28
22
  defaults: 'resources/assets/styles'
29
23
  });
30
24
  }
31
-
32
25
  get prompting() {
33
26
  return {
34
27
  welcome() {
35
28
  if (this.options.quiet) {
36
29
  return;
37
30
  }
38
-
39
31
  console.log(_chalk.default.yellow('\n----------------------'));
40
32
  console.log('Laravel Auth Generator');
41
33
  console.log(_chalk.default.yellow('----------------------\n'));
42
34
  },
43
-
44
35
  prompts() {
45
36
  const prompts = [];
46
-
47
37
  if (!this.options['project-name']) {
48
38
  prompts.push(_generator.default.prompts.project_name);
49
39
  }
50
-
51
40
  if (!prompts.length) {
52
41
  return null;
53
42
  }
54
-
55
43
  return this.prompt(prompts).then(answers => {
56
44
  if (answers['project-name']) {
57
45
  this.options['project-name'] = answers['project-name'];
58
46
  }
59
47
  });
60
48
  }
61
-
62
49
  };
63
50
  }
64
-
65
51
  get writing() {
66
52
  return {
67
53
  composerJSON() {
@@ -71,7 +57,6 @@ module.exports = class LaravelAuthGenerator extends _generator.default {
71
57
  const currentJson = this.fs.exists(destPath) ? this.fs.readJSON(destPath) : {};
72
58
  this.fs.writeJSON(destPath, _lodash.default.merge(currentJson, newJson));
73
59
  },
74
-
75
60
  files() {
76
61
  const folders = ['app', 'resources', 'routes', 'database'];
77
62
  const jsPath = this.options['js-path'] || null;
@@ -79,16 +64,13 @@ module.exports = class LaravelAuthGenerator extends _generator.default {
79
64
  folders.forEach(folder => {
80
65
  const templatePath = this.templatePath(folder);
81
66
  const destinationPath = this.destinationPath(folder);
82
-
83
67
  _glob.default.sync('**', {
84
68
  dot: true,
85
69
  nodir: true,
86
70
  cwd: templatePath
87
71
  }).forEach(file => {
88
72
  const source = _path.default.join(templatePath, file);
89
-
90
73
  const destination = _path.default.join(destinationPath, file);
91
-
92
74
  if (file.match(/\.(jpg|jpeg|gif|png)$/i)) {
93
75
  this.fs.copy(source, destination);
94
76
  } else {
@@ -100,31 +82,24 @@ module.exports = class LaravelAuthGenerator extends _generator.default {
100
82
  });
101
83
  });
102
84
  }
103
-
104
85
  };
105
86
  }
106
-
107
87
  get install() {
108
88
  return {
109
89
  composer() {
110
90
  if (this.options['skip-install']) {
111
91
  return;
112
92
  }
113
-
114
93
  const done = this.async();
115
94
  this.spawnCommand('composer', ['install']).on('close', done);
116
95
  },
117
-
118
96
  vendorPublish() {
119
97
  if (this.options['skip-install']) {
120
98
  return;
121
99
  }
122
-
123
100
  const done = this.async();
124
101
  this.spawnCommand('php', ['artisan', 'vendor:publish', '--all']).on('close', done);
125
102
  }
126
-
127
103
  };
128
104
  }
129
-
130
105
  };
@@ -1,17 +1,11 @@
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 _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 LaravelMediathequeGenerator extends _generator.default {
16
10
  constructor(...args) {
17
11
  super(...args);
@@ -30,40 +24,32 @@ module.exports = class LaravelMediathequeGenerator extends _generator.default {
30
24
  default: false
31
25
  });
32
26
  }
33
-
34
27
  get prompting() {
35
28
  return {
36
29
  welcome() {
37
30
  if (this.options.quiet) {
38
31
  return;
39
32
  }
40
-
41
33
  console.log(_chalk.default.yellow('\n----------------------'));
42
34
  console.log('Laravel Mediatheque Generator');
43
35
  console.log(_chalk.default.yellow('----------------------\n'));
44
36
  },
45
-
46
37
  prompts() {
47
38
  const prompts = [];
48
-
49
39
  if (!this.options['project-name']) {
50
40
  prompts.push(_generator.default.prompts.project_name);
51
41
  }
52
-
53
42
  if (!prompts.length) {
54
43
  return null;
55
44
  }
56
-
57
45
  return this.prompt(prompts).then(answers => {
58
46
  if (answers['project-name']) {
59
47
  this.options['project-name'] = answers['project-name'];
60
48
  }
61
49
  });
62
50
  }
63
-
64
51
  };
65
52
  }
66
-
67
53
  get writing() {
68
54
  return {
69
55
  composerJSON() {
@@ -74,26 +60,21 @@ module.exports = class LaravelMediathequeGenerator extends _generator.default {
74
60
  }
75
61
  });
76
62
  },
77
-
78
63
  files() {
79
64
  if (!this.options.overrides) {
80
65
  return;
81
66
  }
82
-
83
67
  const folders = ['app'];
84
68
  folders.forEach(folder => {
85
69
  const templatePath = this.templatePath(folder);
86
70
  const destinationPath = this.destinationPath(folder);
87
-
88
71
  _glob.default.sync('**', {
89
72
  dot: true,
90
73
  nodir: true,
91
74
  cwd: templatePath
92
75
  }).forEach(file => {
93
76
  const source = _path.default.join(templatePath, file);
94
-
95
77
  const destination = _path.default.join(destinationPath, file);
96
-
97
78
  if (file.match(/\.(jpg|jpeg|gif|png)$/i)) {
98
79
  this.fs.copy(source, destination);
99
80
  } else {
@@ -104,37 +85,29 @@ module.exports = class LaravelMediathequeGenerator extends _generator.default {
104
85
  });
105
86
  });
106
87
  }
107
-
108
88
  };
109
89
  }
110
-
111
90
  get install() {
112
91
  return {
113
92
  composer() {
114
93
  if (this.options['skip-install']) {
115
94
  return;
116
95
  }
117
-
118
96
  const done = this.async();
119
97
  this.spawnCommand('composer', ['install']).on('close', done);
120
98
  },
121
-
122
99
  async vendorPublish() {
123
100
  if (this.options['skip-publish']) {
124
101
  return;
125
102
  }
126
-
127
103
  await this.spawnCommand('php', ['artisan', 'vendor:publish', '--provider=Folklore\\Mediatheque\\ServiceProvider']);
128
104
  }
129
-
130
105
  };
131
106
  }
132
-
133
107
  end() {
134
108
  if (this.options.quiet) {
135
109
  return;
136
110
  }
137
-
138
111
  console.log('\n\n');
139
112
  console.log(_chalk.default.yellow('\n----------------------'));
140
113
  console.log(_chalk.default.bold('Instructions'));
@@ -147,5 +120,4 @@ module.exports = class LaravelMediathequeGenerator extends _generator.default {
147
120
  ignoreIllegals: true
148
121
  }));
149
122
  }
150
-
151
123
  };