|
1 | 1 | const path = require('path'); |
2 | 2 | const { addTestAnswers } = require('./scenarios'); |
3 | | -const { sortDependencies, installDependencies, printMessage, runLintFix, runPrettierWrite } = require('./utils'); |
| 3 | +const { |
| 4 | + sortDependencies, |
| 5 | + installDependencies, |
| 6 | + printMessage, |
| 7 | + runLintFix, |
| 8 | + runPrettierWrite, |
| 9 | +} = require('./utils'); |
4 | 10 |
|
5 | 11 | module.exports = { |
6 | | - "metalsmith": { |
| 12 | + metalsmith: { |
7 | 13 | // When running tests for the template, this adds answers for the selected scenario |
8 | | - "before": addTestAnswers |
| 14 | + before: addTestAnswers, |
9 | 15 | }, |
10 | | - "prompts": { |
11 | | - "name": { |
12 | | - "when": "isNotTest", |
13 | | - "type": "string", |
14 | | - "required": true, |
15 | | - "message": "Project name" |
| 16 | + prompts: { |
| 17 | + name: { |
| 18 | + when: 'isNotTest', |
| 19 | + type: 'string', |
| 20 | + required: true, |
| 21 | + message: 'Project name', |
16 | 22 | }, |
17 | | - "description": { |
18 | | - "when": "isNotTest", |
19 | | - "type": "string", |
20 | | - "required": false, |
21 | | - "message": "Project description", |
22 | | - "default": "A Vue.js web extension" |
| 23 | + description: { |
| 24 | + when: 'isNotTest', |
| 25 | + type: 'string', |
| 26 | + required: false, |
| 27 | + message: 'Project description', |
| 28 | + default: 'A Vue.js web extension', |
23 | 29 | }, |
24 | | - "author": { |
25 | | - "when": "isNotTest", |
26 | | - "type": "string", |
27 | | - "message": "Author" |
| 30 | + author: { |
| 31 | + when: 'isNotTest', |
| 32 | + type: 'string', |
| 33 | + message: 'Author', |
28 | 34 | }, |
29 | | - "license": { |
30 | | - "when": "isNotTest", |
31 | | - "type": "string", |
32 | | - "message": "License" |
| 35 | + license: { |
| 36 | + when: 'isNotTest', |
| 37 | + type: 'string', |
| 38 | + message: 'License', |
33 | 39 | }, |
34 | | - "options": { |
35 | | - "when": "isNotTest", |
36 | | - "type": "confirm", |
37 | | - "message": "Provide an options page? (https://developer.chrome.com/extensions/options)" |
| 40 | + options: { |
| 41 | + when: 'isNotTest', |
| 42 | + type: 'confirm', |
| 43 | + message: 'Provide an options page? (https://developer.chrome.com/extensions/options)', |
38 | 44 | }, |
39 | | - "router": { |
40 | | - "when": "isNotTest", |
41 | | - "type": "confirm", |
42 | | - "message": "Install vue-router?" |
| 45 | + router: { |
| 46 | + when: 'isNotTest', |
| 47 | + type: 'confirm', |
| 48 | + message: 'Install vue-router?', |
43 | 49 | }, |
44 | | - "store": { |
45 | | - "when": "isNotTest", |
46 | | - "type": "confirm", |
47 | | - "message": "Install vuex?" |
| 50 | + store: { |
| 51 | + when: 'isNotTest', |
| 52 | + type: 'confirm', |
| 53 | + message: 'Install vuex?', |
48 | 54 | }, |
49 | | - "axios": { |
50 | | - "when": "isNotTest", |
51 | | - "type": "confirm", |
52 | | - "message": "Install axios?" |
| 55 | + axios: { |
| 56 | + when: 'isNotTest', |
| 57 | + type: 'confirm', |
| 58 | + message: 'Install axios?', |
53 | 59 | }, |
54 | | - "lint": { |
55 | | - "when": "isNotTest", |
56 | | - "type": "confirm", |
57 | | - "message": "Install ESLint?" |
| 60 | + lint: { |
| 61 | + when: 'isNotTest', |
| 62 | + type: 'confirm', |
| 63 | + message: 'Install ESLint?', |
58 | 64 | }, |
59 | | - "lintConfig": { |
60 | | - "when": "isNotTest && lint", |
61 | | - "type": 'list', |
62 | | - "message": 'Pick an ESLint preset', |
63 | | - "choices": [ |
| 65 | + lintConfig: { |
| 66 | + when: 'isNotTest && lint', |
| 67 | + type: 'list', |
| 68 | + message: 'Pick an ESLint preset', |
| 69 | + choices: [ |
64 | 70 | { |
65 | | - "name": 'Standard (https://github.com/standard/standard)', |
66 | | - "value": 'standard', |
67 | | - "short": 'Standard', |
| 71 | + name: 'Standard (https://github.com/standard/standard)', |
| 72 | + value: 'standard', |
| 73 | + short: 'Standard', |
68 | 74 | }, |
69 | 75 | { |
70 | | - "name": 'Airbnb (https://github.com/airbnb/javascript)', |
71 | | - "value": 'airbnb', |
72 | | - "short": 'Airbnb', |
| 76 | + name: 'Airbnb (https://github.com/airbnb/javascript)', |
| 77 | + value: 'airbnb', |
| 78 | + short: 'Airbnb', |
73 | 79 | }, |
74 | 80 | { |
75 | | - "name": 'none (configure it yourself)', |
76 | | - "value": 'none', |
77 | | - "short": 'none', |
78 | | - } |
79 | | - ] |
| 81 | + name: 'none (configure it yourself)', |
| 82 | + value: 'none', |
| 83 | + short: 'none', |
| 84 | + }, |
| 85 | + ], |
80 | 86 | }, |
81 | | - "prettier": { |
82 | | - "when": "isNotTest", |
83 | | - "type": "confirm", |
84 | | - "message": "Install Prettier?" |
| 87 | + prettier: { |
| 88 | + when: 'isNotTest', |
| 89 | + type: 'confirm', |
| 90 | + message: 'Install Prettier?', |
85 | 91 | }, |
86 | | - "prettierHook": { |
87 | | - "when": "isNotTest && prettier", |
88 | | - "type": "list", |
89 | | - "message": "Setup a git precommit hook that will automatically run Prettier", |
90 | | - "choices": [ |
| 92 | + prettierHook: { |
| 93 | + when: 'isNotTest && prettier', |
| 94 | + type: 'list', |
| 95 | + message: 'Setup a git precommit hook that will automatically run Prettier', |
| 96 | + choices: [ |
91 | 97 | { |
92 | | - "name": 'pretty-quick (https://github.com/azz/pretty-quick)', |
93 | | - "value": 'prettyQuick', |
94 | | - "short": 'pretty-quick', |
| 98 | + name: 'pretty-quick (https://github.com/azz/pretty-quick)', |
| 99 | + value: 'prettyQuick', |
| 100 | + short: 'pretty-quick', |
95 | 101 | }, |
96 | 102 | { |
97 | | - "name": 'precise-commits (https://github.com/nrwl/precise-commits)', |
98 | | - "value": 'preciseCommits', |
99 | | - "short": 'precise-commits', |
| 103 | + name: 'precise-commits (https://github.com/nrwl/precise-commits)', |
| 104 | + value: 'preciseCommits', |
| 105 | + short: 'precise-commits', |
100 | 106 | }, |
101 | 107 | { |
102 | | - "name": "No, I will handle that myself", |
103 | | - "value": false, |
104 | | - "short": "no", |
| 108 | + name: 'No, I will handle that myself', |
| 109 | + value: false, |
| 110 | + short: 'no', |
105 | 111 | }, |
106 | | - ] |
| 112 | + ], |
107 | 113 | }, |
108 | | - "autoInstall": { |
109 | | - "when": "isNotTest", |
110 | | - "type": "list", |
111 | | - "message": "Automatically install dependencies?", |
112 | | - "choices": [ |
| 114 | + autoInstall: { |
| 115 | + when: 'isNotTest', |
| 116 | + type: 'list', |
| 117 | + message: "Automatically install dependencies?", |
| 118 | + choices: [ |
113 | 119 | { |
114 | | - "name": "Yes, use NPM", |
115 | | - "value": "npm", |
116 | | - "short": "npm", |
| 120 | + name: "Yes, use NPM", |
| 121 | + value: "npm", |
| 122 | + short: "npm", |
117 | 123 | }, |
118 | 124 | { |
119 | | - "name": "Yes, use Yarn", |
120 | | - "value": "yarn", |
121 | | - "short": "yarn", |
| 125 | + name: "Yes, use Yarn", |
| 126 | + value: "yarn", |
| 127 | + short: "yarn", |
122 | 128 | }, |
123 | 129 | { |
124 | | - "name": "No, I will handle that myself", |
125 | | - "value": false, |
126 | | - "short": "no", |
| 130 | + name: "No, I will handle that myself", |
| 131 | + value: false, |
| 132 | + short: "no", |
127 | 133 | }, |
128 | | - ] |
129 | | - } |
| 134 | + ], |
| 135 | + }, |
130 | 136 | }, |
131 | | - "filters": { |
132 | | - ".eslintrc.js": "lint", |
133 | | - ".prettierrc": "prettier", |
134 | | - "src/options/**/*": "options", |
135 | | - "src/store/**/*": "store", |
136 | | - "src/popup/router/**/*": "router" |
| 137 | + filters: { |
| 138 | + '.eslintrc.js': 'lint', |
| 139 | + '.prettierrc': 'prettier', |
| 140 | + 'src/options/**/*': 'options', |
| 141 | + 'src/store/**/*': 'store', |
| 142 | + 'src/popup/router/**/*': 'router', |
137 | 143 | }, |
138 | | - "complete": function (data, { chalk }) { |
| 144 | + complete: function (data, { chalk }) { |
139 | 145 | const { green, red } = chalk; |
140 | 146 | const cwd = path.join(process.cwd(), data.inPlace ? '' : data.destDirName); |
141 | 147 |
|
|
0 commit comments