Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

Commit f492978

Browse files
committed
Merge pull request #74 from caridy/es6
solves #67: massive refactor to use ES6 modules under the hood
2 parents ce0a12a + 0d631dc commit f492978

21 files changed

+4755
-3305
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ cldr/
1212

1313
# NPM packages installed locally
1414
node_modules
15+
16+
lib/
17+
tmp/

.npmignore

+6
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,9 @@ cldr/
1414
# (It doesn't need anything used during development of this library.)
1515
tools/
1616
tests/
17+
18+
coverage/
19+
tasks/
20+
tmp/
21+
.travis.yml
22+
Gruntfile.js

CONTRIBUTING.md

+17-3
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,28 @@ To run the unit tests:
1212

1313
npm test
1414

15-
To build files:
15+
To build files in `dist/` and `lib/`:
1616

17-
npm run build
17+
grunt
18+
19+
To build files in `locale-data/` based on CLDR:
20+
21+
grunt cldr
22+
23+
24+
Source Code
25+
-----------
26+
27+
All the source code is in `src/` folder, written as ES6 modules, and transpiled
28+
using `es6-module-transpiler` into the `lib/` and `dist/` folders.
29+
30+
The `dist/` is in git because of bower, make sure you commit those files as well.
1831

1932
Release checklist
2033
-----------------
2134

22-
* build all files using `npm run build`
35+
* build all files using `grunt`
36+
* run all tests using `npm test`
2337
* verify that [README.md] is updated
2438
* bump the version in [package.json]
2539
* commit to master

Gruntfile.js

+47-9
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,69 @@ module.exports = function (grunt) {
22

33
grunt.initConfig({
44
pkg: grunt.file.readJSON('package.json'),
5+
6+
clean: {
7+
dist: 'dist/',
8+
lib : 'lib/',
9+
tmp : 'tmp/'
10+
},
11+
12+
copy: {
13+
tmp: {
14+
expand : true,
15+
flatten: true,
16+
src : ['tmp/src/*.js'],
17+
dest : 'lib/'
18+
}
19+
},
20+
21+
concat: {
22+
complete: {
23+
src: ['dist/Intl.min.js', 'locale-data/complete.js'],
24+
dest: 'dist/Intl.complete.js',
25+
}
26+
},
27+
528
jshint: {
6-
all: ['Intl.js']
29+
all: ['index.js', 'src/*.js', '*.json']
730
},
31+
32+
bundle_jsnext: {
33+
dest: 'dist/Intl.js',
34+
options: {
35+
namespace: 'IntlPolyfill'
36+
}
37+
},
38+
39+
cjs_jsnext: {
40+
dest: 'tmp/'
41+
},
42+
843
uglify: {
944
options: {
1045
preserveComments: 'some'
1146
},
1247
build: {
1348
files: {
14-
'Intl.min.js': ['Intl.js']
49+
'dist/Intl.min.js': ['dist/Intl.js']
1550
}
1651
}
1752
}
18-
1953
});
2054

2155
grunt.loadTasks('./tasks');
56+
grunt.loadNpmTasks('grunt-contrib-clean');
57+
grunt.loadNpmTasks('grunt-contrib-copy');
58+
grunt.loadNpmTasks('grunt-contrib-concat');
2259
grunt.loadNpmTasks('grunt-contrib-jshint');
2360
grunt.loadNpmTasks('grunt-contrib-uglify');
61+
grunt.loadNpmTasks('grunt-bundle-jsnext-lib');
2462

25-
grunt.registerTask('default', function () {
26-
grunt.task.run('jshint');
27-
grunt.task.run('uglify');
63+
grunt.registerTask('build', [
64+
'bundle_jsnext', 'uglify', 'cjs_jsnext', 'copy', 'concat'
65+
]);
2866

29-
if (grunt.option('complete'))
30-
grunt.task.run('compile-data');
31-
});
67+
grunt.registerTask('cldr', ['compile-data']);
68+
69+
grunt.registerTask('default', ['jshint', 'clean', 'build']);
3270
};

0 commit comments

Comments
 (0)