-
Notifications
You must be signed in to change notification settings - Fork 19
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
Select config json based on selected profile #67
base: main
Are you sure you want to change the base?
Select config json based on selected profile #67
Conversation
… the .pcconfig file is not found from the user directory.
added package-lock.json to gitignore
added package-lock.json to gitignore
Hey @slimbuck - can you own getting this reviewed and merged please? 🙏 |
@@ -68,7 +70,7 @@ class ConfigVars { | |||
|
|||
await this.checkPrepTarg(); | |||
|
|||
this.fromConfigFile(this.result.PLAYCANVAS_TARGET_DIR, TARGET_CONFIG_FILE); | |||
this.fromTargetConfigFile(this.result.PLAYCANVAS_TARGET_DIR, TARGET_CONFIG_FILE); |
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.
This is great!
I'm just thinking, it might be clearer for the user to specify the config filename directly (instead of a profile name).
Then the only code change here would be to use that filename instead of TARGET_CONFIG_FILE.
This way, the user knows exactly which file is being referenced and they can name the file however they like.
What do you think @figo2264?
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.
Basically, the main idea is to allow multiple config file on a single project and I adopted the concept from spring profile.
So, what you meant is just explicitly point out the config file name like what we normally do in typescript config, right?
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.
Yes. I'm imagining something like:
--config='pcconfig-dev.json'
Which would load settings from 'pcconfig-dev.json' instead of 'pcconfig.json'.
While working on a specific code base, it might be required to deploy the code into a branch in studio besides main for test purpose. Unfortunately, playcanvas-sync only supports a single config json file.
Simply saying it might be needed to have profile based config files.
So, Here I modifed the playcanvas-sync command line option so a profile option is optionally available.
Added Option
-p
or--profile
Based on the option value, it will select
pcconfig-{profile}.json
Once the config file for each profile is set, you can simple use it by running a different npm command.