Skip to content

Commit

Permalink
init: add selections for “Compression” feature
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Sep 15, 2018
1 parent 2f5f569 commit 3146de1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/cli/lib/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,16 @@ module.exports = function (type, dir, opts) {
type: 'multiselect',
message: 'Select features needed for your project:',
choices(val) {
let arr = ['CSS Preprocessor', 'Linter or Formatter (TODO)', 'TypeScript (TODO)'];
let arr = ['Compression', 'CSS Preprocessor', 'Linter or Formatter (TODO)', 'TypeScript (TODO)'];
val || arr.push('Bublé'); // only if no preset
return toChoices(arr.concat('Router', 'Service Worker', 'E2E Testing (TODO)', 'Unit Testing (TODO)'), true);
}
}, {
name: 'compress',
message: 'Which compression format?',
type: (_, all) => all.features.includes('compression') && 'select',
choices: toChoices(['None', 'Brotli', 'GZip', 'Zopfli']),
format: val => val !== 'none' && val
}, {
name: 'styles',
message: 'Which CSS preprocessor?',
Expand All @@ -96,7 +102,7 @@ module.exports = function (type, dir, opts) {
message: '(TODO) Which linter / formatter do you like?',
type: (_, all) => all.features.some(x => /linter-or-formatter/.test(x)) && 'select',
choices: toChoices(['None', 'ESLint', 'Prettier', 'TSLint']),
format: val => val === 'none' ? false : val
format: val => val !== 'none' && val
}, {
name: 'sw',
message: 'Which Service Worker library?',
Expand Down Expand Up @@ -210,6 +216,10 @@ module.exports = function (type, dir, opts) {
devdeps.push('@pwa/plugin-buble');
}

if (argv.compress) {
devdeps.push(`@pwa/plugin-${argv.compress}`);
}

pkg.dependencies = {};
deps.sort().forEach(str => {
pkg.dependencies[str] = 'latest';
Expand Down

0 comments on commit 3146de1

Please sign in to comment.