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

Commit 8b0bdca

Browse files
committed
Add minified browserified browser bundle. Refs #28
Defined as "browser" property in package.json, which is recognized by jspm and browserify, among others., but the main for the module is still the unbundled files in lib/.
1 parent c4cc10f commit 8b0bdca

File tree

6 files changed

+60
-17
lines changed

6 files changed

+60
-17
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ node_modules/
22
.idea/
33
.ref/
44
.tmp/
5-
demo/
5+
/demo/
66
test/raw/

.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ All notable changes to this project will be documented in this file.
4646
```
4747

4848
### Changed
49+
- **BREAKING CHANGE** Instead of publishing this module on npm as a browserified and minified bundle, The transpiled ES2015 code in `lib/` is now published and I have left it up to the end user to decide if they want to browserify or minify the library. The combined unminified file sizes for the published version of the parser is now ~127kB.
50+
- There is still a `dist/` folder containing the minified browserified bundle that comes in at ~81kB (7% reduction from `v0.14.5`). This is defined in the `package.json` as the browser version of the module, which is recognized by tools such as [jspm](http://jspm.io/) and [browserify](http://browserify.org/).
51+
4952
- **BREAKING CHANGE** The `on` property of a `CREATE INDEX` statement is now treated as a table expression identifier, and has the corresponding `type` and `variant`:
5053

5154
``` json

Gruntfile.js

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,6 @@ module.exports = function(grunt) {
6464

6565

6666
browserify: {
67-
dist: {
68-
options: {
69-
browserifyOptions: {
70-
debug: true,
71-
standalone: 'sqliteParser'
72-
}
73-
},
74-
src: ['index.js'],
75-
dest: 'dist/sqlite-parser.js'
76-
},
7767
interactive: {
7868
options: {
7969
alias: {
@@ -99,6 +89,19 @@ module.exports = function(grunt) {
9989
],
10090
src: ['src/demo/demo.js'],
10191
dest: '.tmp/sqlite-parser-demo.js'
92+
},
93+
browser: {
94+
options: {
95+
browserifyOptions: {
96+
debug: false,
97+
standalone: 'sqliteParser'
98+
},
99+
alias: {
100+
'./streaming': './.tmp/streaming-shim.js'
101+
}
102+
},
103+
src: ['.tmp/index.js'],
104+
dest: '.tmp/sqlite-parser.js'
102105
}
103106
},
104107

@@ -134,6 +137,7 @@ module.exports = function(grunt) {
134137
build: ['.tmp/*.js', 'src/parser.js'],
135138
interactive: ['.tmp/*.css'],
136139
demo: ['demo/**/*'],
140+
browser: ['dist/**/*'],
137141
release: ['lib/**/*'],
138142
bin: ['bin/**/*'],
139143
testProcess: ['test/sql/official-suite/**/*.sql']
@@ -243,9 +247,9 @@ module.exports = function(grunt) {
243247
'demo/sqlite-parser-demo.js': ['.tmp/sqlite-parser-demo.js']
244248
}
245249
},
246-
bin: {
250+
browser: {
247251
files: {
248-
'bin/sqlite-parser': ['bin/sqlite-parser']
252+
'dist/sqlite-parser.js': '.tmp/sqlite-parser.js'
249253
}
250254
}
251255
},
@@ -283,6 +287,14 @@ module.exports = function(grunt) {
283287
dest: 'lib/'
284288
}]
285289
},
290+
browser: {
291+
options: {
292+
banner: getBanner(false)
293+
},
294+
files: {
295+
src: ['dist/sqlite-parser.js']
296+
}
297+
},
286298
demo: {
287299
options: {
288300
banner: getBanner(true)
@@ -323,6 +335,12 @@ module.exports = function(grunt) {
323335
dest: '.tmp/'
324336
}]
325337
},
338+
browser: {
339+
files: [{
340+
src: 'dist/sqlite-parser.js',
341+
dest: 'dist/sqlite-parser.js'
342+
}]
343+
},
326344
bin: {
327345
files: [{
328346
src: 'bin/sqlite-parser',
@@ -351,6 +369,10 @@ module.exports = function(grunt) {
351369
release: [
352370
'releaseall',
353371
'bin'
372+
],
373+
releaseall: [
374+
[ 'clean:release', 'copy:release', 'usebanner:release' ],
375+
[ 'clean:browser', 'browserify:browser', 'uglify:browser', 'usebanner:browser' ],
354376
]
355377
}
356378
});
@@ -373,6 +395,15 @@ module.exports = function(grunt) {
373395
'copy:release',
374396
'usebanner:release'
375397
]);
398+
// Create minified browser bundle of parser at dist/sqlite-parser.js
399+
grunt.registerTask('browser', [
400+
'demobuild',
401+
'clean:browser',
402+
'browserify:browser',
403+
'replace:browser',
404+
'uglify:browser',
405+
'usebanner:browser'
406+
]);
376407
// Create new version of command line utility at bin/sqlite-parser
377408
grunt.registerTask('bin', [
378409
'clean:bin',
@@ -441,8 +472,6 @@ module.exports = function(grunt) {
441472
]);
442473
grunt.registerTask('releaseall', [
443474
'demo',
444-
'clean:release',
445-
'copy:release',
446-
'usebanner:release'
475+
'concurrent:releaseall'
447476
]);
448477
};

dist/sqlite-parser.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,17 @@
2222
"browser": "./lib/streaming-shim.js"
2323
}
2424
},
25+
"browser": "dist/sqlite-parser.js",
2526
"scripts": {
2627
"test": "grunt test",
2728
"build": "grunt release"
2829
},
30+
"engines": {
31+
"node": ">=4"
32+
},
2933
"license": "MIT",
3034
"files": [
35+
"dist/",
3136
"bin/",
3237
"lib/",
3338
"LICENSE",

0 commit comments

Comments
 (0)