This repository was archived by the owner on May 1, 2020. It is now read-only.
This repository was archived by the owner on May 1, 2020. It is now read-only.
Environment proposal #762
Closed
Description
I am thinking we could do this:
- Introduce a new flag that gets passed in like this:
ionic serve --env qa
or ionic run android --env prod
My first thought was that it's value would default to dev
for non-prod builds, and prod
for prod builds. Developer's can pass in whatever they want, though.
- Based on the value that is passed in (or inferred), the
config
section of the package.json is read. It could look something like this:
...
"config": {
"ionic_env" : {
"dev" : {
"keyToReplace" : "devValueToReplaceWith",
"keyTwoToReplace" : "devValueTwoToReplaceWith"
},
"qa" : {
"keyToReplace" : "qaValueToReplaceWith",
"keyTwoToReplace" : "qaValueTwoToReplaceWith"
}
}
},
...
If the ionic_env
data is not there, we would just move on in the build process. If it is present, we would then perform the text replacement.
- Any computed values, sync or async, could be replaced after the build is done. We could either leave this up to the user to add on to the
npm script
section, or we could provide a hook into thepostprocess
step. I prefer the latter as it's easier to document and and we can probably make it a 1/2 second faster or so if we do it in app-scripts.
Feedback is appreciated.
Thanks,
Dan
Metadata
Metadata
Assignees
Labels
No labels