support dynamically changing properties in template code
- Dominant language
- JavaScript
- Stars
- 1
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
## Motivation
If the template has a `public/index.html`, then try to make the following changes:
Update the title of the app to the name of the app. Example:
```html
My App .
```
If the template has a a `public/manifest.json`, modify the `short_name` and `name` fields:
```json
"short_name": "My App",
"name": "My App",
```
## Proposal
The locations where these things need to be changed could be made dynamic using a `.graasprc` file in the template repository. Similar to the way that we delete files listed in a `.graaspignore` file.
Steps:
1. Read a `.graasprc` file in the template repository.
2. This file would have a key like:
```json
{
"replace": [
{
"location": "public/index.html",
"from": "Graasp App Starter",
"to": "{{APP_NAME}}"
},
{
"location": "*.js",
"from": "$MY_ENV_VAR",
"to": "{{APP_SPECIFIC_ENV_VAR}}"
},
]
}
```
As shown above, we could have the replacement strategy access variables set by the user in the CLI. Whether we use `{{` or something else can be also configurable within the same `.graasprc`, to adapt to the different templates.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.