Skip to content

Commit cca21f5

Browse files
committed
Update Makefile
1 parent c5812df commit cca21f5

File tree

7 files changed

+51
-4
lines changed

7 files changed

+51
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
components
33
npm-debug.log
44
build
5+
dist

Makefile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,17 @@ test: build test/browser/index.html
4040
node_modules: package.json
4141
@npm install
4242

43+
#
44+
# Target for updating version.
45+
46+
version: component.json package.json src/version.js
47+
node scripts/version
48+
4349
#
4450
# Target for `amplitude.js` file.
4551
#
4652

47-
$(OUT): node_modules $(SRC)
53+
$(OUT): node_modules $(SRC) version
4854
@$(DUO) --standalone amplitude src/index.js > $(OUT)
4955
@$(MINIFY) $(OUT) --output $(MIN_OUT)
5056

@@ -57,5 +63,13 @@ build: $(TESTS) $(OUT)
5763
@-mkdir -p build
5864
@$(DUO) --development test/tests.js > build/tests.js
5965

66+
#
67+
# Target for release.
68+
#
69+
70+
release: $(OUT)
71+
@-mkdir -p dist
72+
node scripts/release
73+
6074
.PHONY: clean
6175
.PHONY: test

amplitude.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2447,7 +2447,7 @@ exports.isEmpty = function(obj){
24472447
};
24482448
}, {}],
24492449
14: [function(require, module, exports) {
2450-
module.exports = '2.0.2';
2450+
module.exports = '2.0.3';
24512451

24522452
}, {}]}, {}, {"1":""})
24532453
);

amplitude.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"express": "4.x",
1717
"mocha-phantomjs": "^3.5.1",
1818
"phantomjs": "^1.9.12",
19-
"uglify-js": ">= 1.3.4"
19+
"uglify-js": ">= 1.3.4",
20+
"fs-extra": "^0.15.0"
2021
},
2122
"scripts": {
2223
"test": "make test"

scripts/release.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var fs = require('fs-extra');
2+
var path = require('path');
3+
var package = require('../package');
4+
var exec = require('child_process').exec;
5+
6+
var version = package.version;
7+
var cwd = process.cwd();
8+
9+
var file = path.join(cwd, 'dist', 'amplitude-' + version + '.js');
10+
var minfile = path.join(cwd, 'dist', 'amplitude-' + version + '-min.js');
11+
var mingzfile = path.join(cwd, 'dist', 'amplitude-' + version + '-min.gz.js');
12+
13+
fs.copySync(path.join(cwd, 'amplitude.js'), file);
14+
fs.copySync(path.join(cwd, 'amplitude.min.js'), minfile);
15+
exec('gzip < ' + minfile + ' > ' + mingzfile);

scripts/version.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var fs = require('fs');
2+
var path = require('path');
3+
var package = require('../package');
4+
var component = require('../component');
5+
6+
var version = package.version;
7+
component.version = version;
8+
9+
var cwd = process.cwd();
10+
11+
console.log('Updating to version ' + version);
12+
fs.writeFileSync(path.join(cwd, 'component.json'), JSON.stringify(component, null, 2) + '\n');
13+
console.log('Updated component.json');
14+
15+
fs.writeFileSync(path.join(cwd, 'src', 'version.js'), "module.exports = '" + version + "';\n");
16+
console.log('Updated src/version.js');

0 commit comments

Comments
 (0)