Guillaume Chau
dbef5e9fed
feat(ui): config improvements (#1487)
BREAKING CHANGES:
- The configuration API has changed.
- The `files` options now accept an object of different config files:
```js
api.describeConfig({
/* ... */
// All possible files for this config
files: {
// eslintrc.js
eslint: {
js: ['.eslintrc.js'],
json: ['.eslintrc', '.eslintrc.json'],
// Will read from `package.json`
package: 'eslintConfig'
},
// vue.config.js
vue: {
js: ['vue.config.js']
}
},
})
```
- The `onWrite` api has changed: `setData` and `assignData` have now `fileId` as the first argument:
```js
api.describeConfig({
onWrite: async ({ api, prompts }) => {
const eslintData = {}
const vueData = {}
for (const prompt of prompts) {
// eslintrc
if (prompt.id.indexOf('vue/') === 0) {
eslintData[`rules.${prompt.id}`] = await api.getAnswer(prompt.id, JSON.parse)
} else {
// vue.config.js
vueData[prompt.id] = await api.getAnswer(prompt.id)
}
}
api.setData('eslint', eslintData)
api.setData('vue', vueData)
}
})
```
Other changes
- Config tabs (optional):
```js
api.describeConfig({
/* ... */
onRead: ({ data, cwd }) => ({
tabs: [
{
id: 'tab1',
label: 'My tab',
// Optional
icon: 'application_settings',
prompts: [
// Prompt objects
]
},
{
id: 'tab2',
label: 'My other tab',
prompts: [
// Prompt objects
]
}
]
})
})
```
2018-06-10 14:01:45 +02:00
..
2018-04-09 01:53:41 +02:00
2018-04-09 01:53:41 +02:00
2018-04-09 01:53:41 +02:00
2018-06-10 14:01:45 +02:00
2018-03-25 21:54:43 +02:00
2018-06-05 10:58:00 +02:00
2018-03-25 21:54:43 +02:00
2018-03-25 21:54:43 +02:00
2018-05-29 09:37:28 -04:00
2018-05-29 09:37:28 -04:00
2018-03-09 20:35:37 +01:00
2018-03-09 20:35:37 +01:00
2018-03-09 20:35:37 +01:00
2018-03-09 20:35:37 +01:00
2018-03-09 20:35:37 +01:00
2018-03-05 16:05:59 +01:00
2018-03-05 16:05:59 +01:00
2018-06-10 13:59:43 +02:00
2018-06-10 13:59:43 +02:00
2018-03-06 19:10:11 +01:00
2018-03-06 19:10:11 +01:00
2018-03-28 15:46:06 +02:00
2018-03-29 17:23:57 +02:00
2018-03-05 16:05:59 +01:00
2018-03-05 16:05:59 +01:00
2018-03-05 16:05:59 +01:00
2018-03-05 16:05:59 +01:00
2018-03-05 16:05:59 +01:00
2018-03-05 16:05:59 +01:00
2018-03-27 17:46:53 +02:00
2018-05-31 14:10:05 -04:00
2018-05-31 14:10:05 -04:00
2018-04-29 23:05:48 +02:00
2018-04-29 23:05:48 +02:00
2018-04-29 23:05:48 +02:00
2018-04-09 01:53:41 +02:00
2018-04-09 01:53:41 +02:00
2018-04-09 01:53:41 +02:00
2018-04-09 01:53:41 +02:00
2018-04-09 01:53:41 +02:00
2018-03-16 20:01:58 +01:00
2018-03-28 15:46:06 +02:00
2018-03-16 20:01:58 +01:00
2018-03-12 13:57:00 +01:00
2018-03-12 13:57:00 +01:00
2018-03-28 15:46:06 +02:00
2018-03-12 13:57:00 +01:00
2018-03-16 20:01:58 +01:00
2018-06-05 10:59:28 +02:00
2018-03-12 13:57:00 +01:00
2018-03-16 20:01:58 +01:00
2018-03-06 19:10:11 +01:00
2018-03-07 12:56:06 +01:00
2018-03-09 20:35:37 +01:00
2018-03-09 20:35:37 +01:00
2018-03-12 13:57:00 +01:00
2018-03-12 13:57:00 +01:00
2018-03-11 19:36:23 +01:00
2018-03-05 23:53:46 +01:00
2018-03-07 12:56:06 +01:00
2018-03-11 19:36:23 +01:00
2018-03-10 01:13:49 +01:00
2018-03-07 19:17:27 +01:00
2018-03-11 19:36:23 +01:00
2018-03-11 19:36:23 +01:00
2018-03-11 19:36:23 +01:00
2018-03-07 19:17:27 +01:00
2018-03-07 19:17:27 +01:00
2018-03-17 01:05:10 +01:00
2018-03-07 12:56:06 +01:00
2018-03-26 14:33:14 +02:00
2018-03-07 12:56:06 +01:00
2018-06-10 14:01:45 +02:00
2018-04-09 01:53:41 +02:00
2018-04-09 01:53:41 +02:00
2018-04-09 01:53:41 +02:00
2018-04-09 01:53:41 +02:00
2018-04-09 01:53:41 +02:00
2018-03-18 16:16:46 +01:00
2018-06-05 10:58:00 +02:00
2018-03-18 22:17:06 +01:00
2018-03-18 22:17:06 +01:00
2018-03-18 22:17:06 +01:00
2018-03-18 22:17:06 +01:00
2018-03-18 16:16:46 +01:00
2018-03-17 14:14:32 +01:00
2018-03-18 16:16:46 +01:00
2018-03-16 20:01:58 +01:00
2018-04-22 14:00:15 +02:00
2018-04-22 14:00:15 +02:00
2018-04-22 14:00:15 +02:00
2018-04-22 14:00:15 +02:00
2018-04-22 14:00:15 +02:00