Skip to content

Commit

Permalink
Update broccoli build to copy version from package.json to src/js/ver…
Browse files Browse the repository at this point in the history
…sion.js
  • Loading branch information
bantic committed Apr 20, 2016
1 parent b4bb951 commit ae06afc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
18 changes: 15 additions & 3 deletions Brocfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var styles = require('./broccoli/styles');
var jquery = require('./broccoli/jquery');
var injectLiveReload = require('broccoli-inject-livereload');
var LiveReload = require('tiny-lr');
var replace = require('broccoli-string-replace');

var vendoredModules = [
{name: 'mobiledoc-html-renderer'},
Expand Down Expand Up @@ -41,10 +42,21 @@ watcher.on('change', function() {
}
});

function replaceVersion(tree) {
var version = require('./package.json').version;
return replace(tree, {
files: ['**/*.js'],
pattern: {
match: /##VERSION##/g,
replacement: version
}
});
}

module.exports = mergeTrees([
builder.build('amd', buildOptions),
builder.build('global', buildOptions),
builder.build('commonjs', buildOptions),
replaceVersion(builder.build('amd', buildOptions)),
replaceVersion(builder.build('global', buildOptions)),
replaceVersion(builder.build('commonjs', buildOptions)),
styles(),
injectLiveReload(testTree)
]);
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ in `demo/`. To run the demo:

#### Releasing

* update version in `src/js/version.js`
* Update version in `package.json`
* `npm run update-changelog`
* commit with message `v<version>` (e.g. "v0.9.0")
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"broccoli-merge-trees": "^1.0.0",
"broccoli-multi-builder": "^0.2.8",
"broccoli-sane-watcher": "^1.1.4",
"broccoli-string-replace": "^0.1.1",
"broccoli-test-builder": "^0.2.0",
"conventional-changelog": "^1.1.0",
"conventional-changelog-cli": "^1.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/js/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default '0.9.3';
export default '##VERSION##';

0 comments on commit ae06afc

Please sign in to comment.