toggl/toggl-button — pull request #153 by 1ed (2014-10-20 14:27:22+00:00)
Title: [RFC] Improve the build process

My first take on https://github.com/toggl/toggl-button/pull/127#issuecomment-59502668

The basic idea is to remove the manifest file from the git repository and generate it dynamically before building. The `version`, `permissions` and `content_scripts` part of the manifest will be generated based on a configuration file (`parameters.json`) and merged with the `src/manifest.json.dist` file. If the `parameters.json` file can not be found the `parameters.json.dist` file will be used for configuration instead. People can add `update_url` and `base_url` parameters to the configuration to generate an autoupdating extension. The old `Makefile` based building can be replaced with `grunt build-zip` which generates zip file for publishing in the store.

I'm not sure if the current format of the configuration file is good enough:
```json
{
"version": "6.6.6",
"base_url": "http://example.com/",
"update_url": "http://example.com/updates.xml",
"sites": {
"anydo": ["https://web.any.do/*"],
...
"trac": ["*://trac.edgewall.org/*", "*://trac-hacks.org/*", "*://*.trac.wordpress.org/*", "*://bugs.jquery.com/*"],
"trello": ["*://*.trello.com/*"],
"unfuddle": ["*://*.unfuddle.com/*"],
"worksection": ["*://*.worksection.com/*"],
"wunderlist": ["https://*.wunderlist.com/*"],
"xero": ["https://go.xero.com/*"],
"youtrack": ["*://*.myjetbrains.com/*"],
"zendesk": ["*://*.zendesk.com/*"]
}
}
```
my another ide would be something like this:
```json
{
"base_url": "http://dev.mentha.hu/toggl-button/",
"manifest": {
"version": "4.2.3.4",
"update_url": "http://dev.mentha.hu/toggl-button/updates.xml",
"permissions": [
"https://web.any.do/*",
"*://app.asana.com/*",
"*://*.basecamp.com/*",
"*://*.bitbucket.org/*",
"*://*.capsulecrm.com/*",
"*://*.github.com/*",
"*://*.gitlab.com/*",
"*://docs.google.com/*",
"*://*.atlassian.net/*",
"*://*.jira.com/*",
"*://*.pivotaltracker.com/*",
"*://*.podio.com/*",
"*://*.producteev.com/*",
"*://*.redbooth.com/*",
"*://*.redmine.org/*"
],
"content_scripts": [
{
"matches": [
"*://bugs.jquery.com/*",
"*://*.trello.com/*",
...
"*://*.unfuddle.com/*",
"*://*.worksection.com/*",
"https://*.wunderlist.com/*",
"https://go.xero.com/*",
"*://*.myjetbrains.com/*",
"*://*.zendesk.com/*"
],
"css": [
"styles/style.css"
],
"js": [
"scripts/common.js"
]
},
{
"js": "scripts/content/anydo.js",
"matches": [
"https://web.any.do/*"
]
},
{
"js": "scripts/content/asana.js",
"matches": [
"*://app.asana.com/*"
]
},
...
{
"js": "scripts/content/basecamp.js",
"matches": [
"*://*.basecamp.com/*"
]
},
{
"js": "scripts/content/bitbucket.js",
"matches": [
"*://*.bitbucket.org/*"
]
}
]
}
}
```
The latter is much verbose but more flexible, maybe we can support both.

For more details see the commits.

What do you think about this idea?

**TODO**:
- [ ] Update documentation