Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Generate the src/*.rdf files from a template #60

Merged
merged 1 commit into from
Jul 22, 2015

Conversation

pdehaan
Copy link
Contributor

@pdehaan pdehaan commented Jul 22, 2015

No description provided.

@pdehaan
Copy link
Contributor Author

pdehaan commented Jul 22, 2015

No clue if this is a good idea, but it saves having to keep the addon version in sync in 3 places and just generates the src/{install,update}.rdf files using the version value from the /package.json file.

Plus copies the generated src/*.rdf files into dist/*.rdf so you can deploy the XPI and RDF files all from dist/ and not a mix of src/ and dist/.

@pdehaan
Copy link
Contributor Author

pdehaan commented Jul 22, 2015

I updated the README.md, but I guess we could even go one step further and make an npm script wrapper which does these 2 steps as a single command:

Release process:

  1. Bump the version number in package.json using npm version patch. This will generate a git tag, too.
  2. Generate the src/install.rdf and src/update.rdf files, and zip up a new addon: gulp build.

Where we could theoretically create the following npm sauce:

"scripts": {
  "release": "npm version patch && gulp build"
}

And then running npm run release does both steps.

@@ -7,7 +7,7 @@
<em:type>2</em:type>

<em:unpack>false</em:unpack>
<em:version>1.1</em:version>
<em:version><%= version %></em:version>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So now package.json#version is now the only variable that gets interpolated into the install/update RDF files. Makes templating and everything else a lot simpler.

@jaredhirsch
Copy link
Member

@pdehaan Great idea, I'm totally happy to merge this.

As far as pushing the two steps into a script, we might actually do any of npm version (patch || minor || major) for a given release, so as long as the script accepts an argument that gets passed to npm version, I'm all for it.

Let me know if you want to mess with adding a release script, otherwise I'll merge this. Nice work ^_^

@@ -1,3 +1,4 @@
node_modules
dist
*.log
src/*.rdf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait, what?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhhh, you generate them from the template, ok

@pdehaan pdehaan changed the title WIP: Generate the src/*.rdf files from a template Generate the src/*.rdf files from a template Jul 22, 2015
@pdehaan
Copy link
Contributor Author

pdehaan commented Jul 22, 2015

so as long as the script accepts an argument that gets passed to npm version, I'm all for it.

Turns out, that may not be super straight forward, but I'm investigating a few options:

  1. Per Passing flags and arguments into run-script npm/npm#3494, something like this may work for us:

      "postrelease": "npm run build",
      "release": "npm version --",
    

    Then run npm run release minor or npm run release patch. Things get a bit weird if you just type npm run release though, since it just dumps all your npm/node version numbers:

    { 'mozilla-universal-search-addon': '2.0.0',
    npm: '3.1.1',
    ares: '1.9.0-DEV',
    http_parser: '1.0',
    modules: '11',
    node: '0.10.35',
    openssl: '1.0.1j',
    uv: '0.10.30',
    v8: '3.14.5.9',
    zlib: '1.2.8' }
  2. Or we just have 3-4 separate release scripts, which is more copy/pasta but a lot clearer in its intent:

      "release": "npm run release-patch",
      "release-major": "npm version major && npm run build",
      "release-minor": "npm version minor && npm run build",
      "release-patch": "npm version patch && npm run build",

@pdehaan
Copy link
Contributor Author

pdehaan commented Jul 22, 2015

@6a68 I'm happy to merge this as-is, and do the release scripts in a separate PR, or I can just --amend onto this PR. Whatever you prefer.

@jaredhirsch
Copy link
Member

@pdehaan Sure, let's merge and follow-on!

jaredhirsch added a commit that referenced this pull request Jul 22, 2015
Generate the src/*.rdf files from a template
@jaredhirsch jaredhirsch merged commit c431e54 into mozilla:master Jul 22, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants