feat: allow extending with theme config (#7131)

This commit is contained in:
pooya parsa 2022-09-01 12:05:02 +02:00 committed by GitHub
parent 2d30a1db8b
commit 68d12b468b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 38 additions and 9 deletions

View File

@ -14,7 +14,7 @@
}, },
"dependencies": { "dependencies": {
"@nuxt/schema": "3.0.0-rc.8", "@nuxt/schema": "3.0.0-rc.8",
"c12": "^0.2.9", "c12": "^0.2.10",
"consola": "^2.15.3", "consola": "^2.15.3",
"defu": "^6.1.0", "defu": "^6.1.0",
"globby": "^13.1.2", "globby": "^13.1.2",

View File

@ -11,6 +11,7 @@ export async function loadNuxtConfig (opts: LoadNuxtConfigOptions): Promise<Nuxt
name: 'nuxt', name: 'nuxt',
configFile: 'nuxt.config', configFile: 'nuxt.config',
rcFile: '.nuxtrc', rcFile: '.nuxtrc',
extend: { extendKey: ['theme', 'extends'] },
dotenv: true, dotenv: true,
globalRc: true, globalRc: true,
...opts ...opts

View File

@ -24,7 +24,7 @@
"@types/flat": "^5.0.2", "@types/flat": "^5.0.2",
"@types/mri": "^1.1.1", "@types/mri": "^1.1.1",
"@types/semver": "^7", "@types/semver": "^7",
"c12": "^0.2.9", "c12": "^0.2.10",
"chokidar": "^3.5.3", "chokidar": "^3.5.3",
"clear": "^0.1.0", "clear": "^0.1.0",
"clipboardy": "^3.0.0", "clipboardy": "^3.0.0",

View File

@ -21,7 +21,7 @@
"vite": "~3.0.9" "vite": "~3.0.9"
}, },
"dependencies": { "dependencies": {
"c12": "^0.2.9", "c12": "^0.2.10",
"create-require": "^1.1.1", "create-require": "^1.1.1",
"defu": "^6.1.0", "defu": "^6.1.0",
"jiti": "^1.14.0", "jiti": "^1.14.0",

View File

@ -11,7 +11,7 @@ import { defineUntypedSchema } from 'untyped'
export default defineUntypedSchema({ export default defineUntypedSchema({
/** /**
* Extend nested configurations from multiple local or remote sources. * Extend project from multiple local or remote sources.
* *
* Value should be either a string or array of strings pointing to source directories or config path relative to current config. * Value should be either a string or array of strings pointing to source directories or config path relative to current config.
* *
@ -23,6 +23,19 @@ export default defineUntypedSchema({
*/ */
extends: null, extends: null,
/**
* Extend project from a local or remote source.
*
* Value should be a string pointing to source directory or config path relative to current config.
*
* You can use `github:`, `gitlab:`, `bitbucket:` or `https://` to extend from a remote git repository.
*
* @type {string}
*
* @version 3
*/
theme: null,
/** /**
* Define the workspace directory of your application. * Define the workspace directory of your application.
* *

View File

@ -11,8 +11,8 @@ export default defineNuxtConfig({
}, },
buildDir: process.env.NITRO_BUILD_DIR, buildDir: process.env.NITRO_BUILD_DIR,
builder: process.env.TEST_WITH_WEBPACK ? 'webpack' : 'vite', builder: process.env.TEST_WITH_WEBPACK ? 'webpack' : 'vite',
theme: './extends/bar',
extends: [ extends: [
'./extends/bar',
'./extends/node_modules/foo' './extends/node_modules/foo'
], ],
nitro: { nitro: {

View File

@ -1651,7 +1651,7 @@ __metadata:
"@nuxt/schema": 3.0.0-rc.8 "@nuxt/schema": 3.0.0-rc.8
"@types/lodash.template": ^4 "@types/lodash.template": ^4
"@types/semver": ^7 "@types/semver": ^7
c12: ^0.2.9 c12: ^0.2.10
consola: ^2.15.3 consola: ^2.15.3
defu: ^6.1.0 defu: ^6.1.0
globby: ^13.1.2 globby: ^13.1.2
@ -1684,7 +1684,7 @@ __metadata:
dependencies: dependencies:
"@types/lodash.template": ^4 "@types/lodash.template": ^4
"@types/semver": ^7 "@types/semver": ^7
c12: ^0.2.9 c12: ^0.2.10
create-require: ^1.1.1 create-require: ^1.1.1
defu: ^6.1.0 defu: ^6.1.0
jiti: ^1.14.0 jiti: ^1.14.0
@ -4063,6 +4063,21 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"c12@npm:^0.2.10":
version: 0.2.10
resolution: "c12@npm:0.2.10"
dependencies:
defu: ^6.0.0
dotenv: ^16.0.1
gittar: ^0.1.1
jiti: ^1.14.0
mlly: ^0.5.11
pathe: ^0.3.4
rc9: ^1.2.2
checksum: 5c8f83a2a10717dd428d1c81801b5771694d6f2b381fda955d159d5e7943b7c958953764edab92033c84186c1d8444cbc0db10e771222b58c2ccbcff2a6c1eba
languageName: node
linkType: hard
"c12@npm:^0.2.7, c12@npm:^0.2.9": "c12@npm:^0.2.7, c12@npm:^0.2.9":
version: 0.2.9 version: 0.2.9
resolution: "c12@npm:0.2.9" resolution: "c12@npm:0.2.9"
@ -9392,7 +9407,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"mlly@npm:^0.5.12, mlly@npm:^0.5.13, mlly@npm:^0.5.14, mlly@npm:^0.5.2, mlly@npm:^0.5.7": "mlly@npm:^0.5.11, mlly@npm:^0.5.12, mlly@npm:^0.5.13, mlly@npm:^0.5.14, mlly@npm:^0.5.2, mlly@npm:^0.5.7":
version: 0.5.14 version: 0.5.14
resolution: "mlly@npm:0.5.14" resolution: "mlly@npm:0.5.14"
dependencies: dependencies:
@ -9921,7 +9936,7 @@ __metadata:
"@types/flat": ^5.0.2 "@types/flat": ^5.0.2
"@types/mri": ^1.1.1 "@types/mri": ^1.1.1
"@types/semver": ^7 "@types/semver": ^7
c12: ^0.2.9 c12: ^0.2.10
chokidar: ^3.5.3 chokidar: ^3.5.3
clear: ^0.1.0 clear: ^0.1.0
clipboardy: ^3.0.0 clipboardy: ^3.0.0