Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow extending config #1

Closed
pi0 opened this issue Jan 27, 2022 · 0 comments
Closed

Allow extending config #1

pi0 opened this issue Jan 27, 2022 · 0 comments

Comments

@pi0
Copy link
Member

pi0 commented Jan 27, 2022

// foo.config.js
export default {
 // Extend relative file
 extends: './foo.config.base', // cwd is same
 extends: '../base/foo.config', // cwd is ../base

 // Discover and extend config from directory
 extends: '../base', // loads base/foo.config.js 

 // Extend multiple config
 extends: ['../theme', '../base'],

 // Next steps
 extends: 'github:foo/bar' // clones https://github.com/foo/bar.git and loads foo.config.js
}

Resolved layers should be flattened and preserved in the final resolved configuration for custom merging/extend strategy:

const config = {
  baseColor: 'red',
  userOption: true,
  _extends: [
    {
      config: { baseColor: 'red' },
      meta: {
        cwd: 'path/to/theme',
        configFile: 'path/to/theme/foo.config.ts'
      }
    },
    {
      config: { baseColor: 'blue' },
      meta: {
        cwd: 'path/to/base',
        configFile: 'path/to/base/foo.config.ts'
      }
    }
  ]
}
pi0 added a commit that referenced this issue Jan 31, 2022
@pi0 pi0 closed this as completed Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant