mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-03-06 14:28:45 -06:00
feat(xdg-compliance): rc file location hierarchy (#1326)
`vue-cli` now uses the following hierarchy for hosting its rc file: * `VUE_CLI_CONFIG_PATH * `XDG_CONFIG_HOME/vue/.vuerc` * `HOME/.config/vue/.vuerc` * `HOME/.vuerc` closes #1325
This commit is contained in:
@@ -6,8 +6,22 @@ const { error } = require('@vue/cli-shared-utils/lib/logger')
|
||||
const { createSchema, validate } = require('@vue/cli-shared-utils/lib/validate')
|
||||
const { exit } = require('@vue/cli-shared-utils/lib/exit')
|
||||
|
||||
const xdgConfigPath = () => {
|
||||
const xdgConfigHome = process.env.XDG_CONFIG_HOME
|
||||
if (xdgConfigHome) {
|
||||
const rcDir = path.join(xdgConfigHome, 'vue')
|
||||
if (!fs.existsSync(rcDir)) {
|
||||
fs.mkdirSync(rcDir, 0o700)
|
||||
}
|
||||
return path.join(rcDir, '.vuerc')
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
const rcPath = exports.rcPath = (
|
||||
process.env.VUE_CLI_CONFIG_PATH ||
|
||||
xdgConfigPath() ||
|
||||
path.join(os.homedir(), '.vuerc')
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user