Skip to content
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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

figo2264
Copy link
Contributor

@figo2264 figo2264 commented Feb 26, 2024

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.

@willeastcott willeastcott added the enhancement New feature or request label Feb 27, 2024
@willeastcott
Copy link
Contributor

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);
Copy link
Member

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?

Copy link
Contributor Author

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?

Copy link
Member

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'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants