mirror of
https://github.com/chenasraf/simple-scaffold.git
synced 2026-05-17 17:28:09 +00:00
fix: config CLI precedence over file
This commit is contained in:
@@ -36,7 +36,7 @@ export async function parseCliArgs(args = process.argv.slice(2)) {
|
||||
const parsed = await parseConfigFile(config)
|
||||
await Scaffold(parsed)
|
||||
} catch (e) {
|
||||
const message = "message" in (e as any) ? (e as any).message : e?.toString()
|
||||
const message = "message" in (e as object) ? (e as Error).message : e?.toString()
|
||||
log(config, LogLevel.error, message)
|
||||
} finally {
|
||||
log(config, LogLevel.debug, "Cleaning up temporary files...", config.tmpDir)
|
||||
|
||||
@@ -115,6 +115,8 @@ export async function parseConfigFile(config: ScaffoldCmdConfig): Promise<Scaffo
|
||||
...output,
|
||||
...imported,
|
||||
beforeWrite: undefined,
|
||||
templates: config.templates || imported.templates,
|
||||
output: config.output || imported.output,
|
||||
data: {
|
||||
...imported.data,
|
||||
...config.data,
|
||||
@@ -172,7 +174,7 @@ export async function getRemoteConfig(
|
||||
): Promise<ScaffoldConfigFile> {
|
||||
const { config: configFile, git, tmpDir, ...logConfig } = config as Required<typeof config>
|
||||
|
||||
log(logConfig, LogLevel.info, `Loading config from remote ${git}, file ${configFile}`)
|
||||
log(logConfig, LogLevel.info, `Loading config from remote ${git}, config file ${configFile || "<auto-detect>"}`)
|
||||
|
||||
const url = new URL(git!)
|
||||
const isHttp = url.protocol === "http:" || url.protocol === "https:"
|
||||
|
||||
Reference in New Issue
Block a user