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

Commit c8ec132

Browse files
committed
Upgrade library to ES2015. Refs #15
1 parent ea33703 commit c8ec132

12 files changed

+89
-42123
lines changed

Diff for: .babelrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["es2015"],
3+
"plugins": ["add-module-exports"]
4+
}

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ npm-debug.log
33
.idea/
44
.ref/
55
.tmp/
6+
lib/
7+
dist/

Diff for: .npmignore

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
test
2-
demo
3-
dist
4-
src
1+
test/
2+
demo/
3+
src/
4+
lib/
55
.ref
66
.tmp
77
TODO.md

Diff for: Gruntfile.js

+28-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,24 @@ module.exports = function(grunt) {
22
function getBanner(isDemo) {
33
return '/*!\n' +
44
' * <%= pkg.name %>' + (isDemo ? '-demo' : '') + ' - v<%= pkg.version %>\n' +
5-
' * @copyright <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
5+
' * @copyright 2015-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
66
' * @author Nick Wronski <[email protected]>\n' +
77
' */';
88
}
99
grunt.initConfig({
1010
pkg: grunt.file.readJSON('package.json'),
1111
browserify: {
12+
options: {
13+
transform: [require('babelify').configure({
14+
sourceMapRelative: './',
15+
compact: true,
16+
sourceMaps: true
17+
})]
18+
},
1219
dist: {
1320
options: {
1421
browserifyOptions: {
15-
debug: false,
22+
debug: true,
1623
standalone: 'sqliteParser'
1724
}
1825
},
@@ -73,11 +80,24 @@ module.exports = function(grunt) {
7380
}
7481
},
7582
clean: {
76-
build: ['lib/*.js'],
83+
build: ['.tmp/*.js', 'lib/*.js'],
7784
dist: ['dist/*.js'],
7885
interactive: ['.tmp/**/*'],
7986
demo: ['demo/**/*']
8087
},
88+
concat: {
89+
options: {
90+
stripBanners: true,
91+
// This imports the utilities used by the parser
92+
banner: "\nimport * as util from './parser-util';\n\nconst ",
93+
// This exports the compiled parser
94+
footer: "\nexport default parser.parse;"
95+
},
96+
build: {
97+
src: ['.tmp/parser.js'],
98+
dest: 'lib/parser.js'
99+
}
100+
},
81101
shell: {
82102
build: {
83103
options: {
@@ -227,7 +247,7 @@ module.exports = function(grunt) {
227247
'build'
228248
]);
229249
grunt.registerTask('build', [
230-
'clean:build', 'shell:build', 'copy:build'
250+
'clean:build', 'shell:build', 'concat:build', 'copy:build'
231251
]);
232252
grunt.registerTask('test', [
233253
'build', 'shell:test'
@@ -248,8 +268,11 @@ module.exports = function(grunt) {
248268
grunt.registerTask('demo', [
249269
'interactive', 'clean:demo', 'copy:demo', 'uglify:demo', 'usebanner:demo'
250270
]);
271+
grunt.registerTask('minidist', [
272+
'default', 'clean:dist', 'browserify:dist'
273+
]);
251274
grunt.registerTask('dist', [
252-
'default', 'clean:dist', 'browserify:dist', 'uglify:dist', 'replace:dist', 'usebanner:dist'
275+
'minidist', 'uglify:dist', 'replace:dist', 'usebanner:dist'
253276
]);
254277
grunt.registerTask('release', [
255278
'test', 'dist', 'demo', 'clean:interactive'

Diff for: dist/sqlite-parser-min.js

-10
This file was deleted.

0 commit comments

Comments
 (0)