-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 ] } ] }) }) ```
- Loading branch information
Showing
15 changed files
with
619 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.