|
|
@ -18,7 +18,7 @@ exports.assignAlias = async (autoAlias, token, deployment, apiUrl, debug) => { |
|
|
|
await aliases.set(String(deployment), String(autoAlias)) |
|
|
|
} |
|
|
|
|
|
|
|
exports.reAlias = async (token, host, help, exit) => { |
|
|
|
exports.reAlias = async (token, host, help, exit, apiUrl, debug, alias) => { |
|
|
|
const path = process.cwd() |
|
|
|
|
|
|
|
const configFiles = { |
|
|
@ -31,11 +31,16 @@ exports.reAlias = async (token, host, help, exit) => { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
const {nowConfig} = await readMetaData(path, { |
|
|
|
const {nowConfig, name} = await readMetaData(path, { |
|
|
|
deploymentType: 'npm', // hard coding settings…
|
|
|
|
quiet: true // `quiet`
|
|
|
|
}) |
|
|
|
|
|
|
|
if (!host) { |
|
|
|
const lastAlias = await alias.last(name) |
|
|
|
host = lastAlias.url |
|
|
|
} |
|
|
|
|
|
|
|
if (!nowConfig) { |
|
|
|
help() |
|
|
|
return exit(0) |
|
|
@ -48,13 +53,12 @@ exports.reAlias = async (token, host, help, exit) => { |
|
|
|
|
|
|
|
if (typeof value === 'string') { |
|
|
|
pointers.push(value) |
|
|
|
} |
|
|
|
|
|
|
|
if (Array.isArray(value)) { |
|
|
|
} else if (Array.isArray(value)) { |
|
|
|
pointers = pointers.concat(nowConfig.alias) |
|
|
|
} else { |
|
|
|
error(`Property ${chalk.grey('aliases')} is not a valid array or string`) |
|
|
|
return exit(1) |
|
|
|
} |
|
|
|
|
|
|
|
error(`Property ${chalk.grey('aliases')} is not a valid array or string`) |
|
|
|
} |
|
|
|
|
|
|
|
if (nowConfig.aliases && Array.isArray(nowConfig.aliases)) { |
|
|
@ -71,6 +75,6 @@ exports.reAlias = async (token, host, help, exit) => { |
|
|
|
} |
|
|
|
|
|
|
|
for (const pointer of pointers) { |
|
|
|
await exports.assignAlias(pointer, token, host) |
|
|
|
await exports.assignAlias(pointer, token, host, apiUrl, debug) |
|
|
|
} |
|
|
|
} |
|
|
|