-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jikun/start or deploy from outside #740
Conversation
src/core/utils/cli-config.ts
Outdated
if (!configName || !swaCliConfigFileExists(path.resolve(configName, configFilePath))) { | ||
return {}; | ||
} | ||
logger.warn(`WARNING: Config file does not exist at "${configFilePath}", but can be detected at "${path.join(configName, configFilePath)}".`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a little strange that both path.join
and path.resolve
were used in the same part of code. I believe using only one of them is enough depending on the case.
Nit: make it as a variable in the beginning.
src/core/utils/cli-config.ts
Outdated
if (!confirmConfigPath) { | ||
return {}; | ||
} | ||
resolvedConfigFilePath = path.resolve(configName, configFilePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question: Why in some places path.resolve
was used and in some other places path.join
was used?
src/core/utils/cli-config.ts
Outdated
currentSwaCliConfigFromFile = { | ||
name: configName, | ||
filePath: configFilePath, | ||
filePath: resolvedConfigFilePath, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
You can handle the config path fallback logic in the beginning of this function, so that you won't need to change configFilePath
to resolved*
all the way down here.
Just checked the code in details. It seems we got a config path option in SWA CLI's global configs. If Cx runs SWA outside of a project folder, we expect Cx to specify the config path as an extra option. This may be the appropriate way to handle this from a PM's perspective. |
Supported "swa start app1" or "swa deploy app1" outside the app1 folder.
For example, under the current working dir containing two projects "app1" and "app2", the above commands will work if there is a "swa-cli.config.json" in "app1" folder, while in the past users must run "swa start" under the app folder.