adobe/aio-cli-plugin-app

config files (.aio, .env) not available to templates for the "no login" case

shazron opened this issue · 1 comments

Description

As you can see here, the config is only imported after the templates are installed here, for the "no login" case:

await this.installTemplates({
useDefaultValues: flags.yes,
installNpm: flags.install,
installConfig: flags.login,
templates
})
// 5. import config - if any
if (flags.import) {
await this.importConsoleConfig(consoleConfig)

For the "logged in" case, the templates are installed after the console config is imported:

await this.importConsoleConfig(consoleConfig)
// 9. install templates
await this.installTemplates({
useDefaultValues: flags.yes,
installNpm: flags.install,
templates
})

We should be consistent in both cases.

The Fix

Import the console config (if available via flag for the no login case), before templates are installed.

Code affected:

await this.installTemplates({
useDefaultValues: flags.yes,
installNpm: flags.install,
installConfig: flags.login,
templates
})
// 5. import config - if any
if (flags.import) {
await this.importConsoleConfig(consoleConfig)