Skip to content

Commit 772ba10

Browse files
committed
use gulp for build
1 parent 82da0e7 commit 772ba10

File tree

9 files changed

+1152
-20
lines changed

9 files changed

+1152
-20
lines changed

Makefile

Lines changed: 0 additions & 12 deletions
This file was deleted.

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
"escape",
2323
"unescape"
2424
],
25-
"main": "./lib/string.min.js",
25+
"main": "./dist/string.min.js",
2626
"ignore": [
27+
"lib/",
2728
"node_modules/",
2829
"package.json",
2930
"component.json",

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
"dependencies": {},
2727
"development": {},
2828
"scripts": [
29-
"lib/string.min.js"
29+
"dist/string.min.js"
3030
]
3131
}

dist/string.js

Lines changed: 1101 additions & 0 deletions
Large diffs are not rendered by default.

dist/string.min.js

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

gulpfile.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
var gulp = require('gulp'),
2+
uglify = require('gulp-uglify'),
3+
rimraf = require('gulp-rimraf'),
4+
rename = require('gulp-rename'),
5+
browserify = require('gulp-browserify'),
6+
SRC = './lib/string.js',
7+
TEST_SRC = './test/string.test.js',
8+
DEST = 'dist',
9+
mocha = require('gulp-mocha'),
10+
SRC_COMPILED = 'string.js',
11+
MIN_FILE = 'string.min.js';
12+
13+
gulp.task('browserify', function() {
14+
return gulp.src(SRC)
15+
.pipe(browserify({
16+
detectGlobals: true,
17+
standalone: 'S'
18+
}))
19+
.pipe(gulp.dest(DEST));
20+
});
21+
22+
gulp.task('test', ['browserify'], function () {
23+
return gulp.src(TEST_SRC, {read: false})
24+
.pipe(mocha({reporter: 'spec', growl: 1}));
25+
});
26+
27+
gulp.task('clean', function() {
28+
return gulp.src(DEST)
29+
.pipe(rimraf());
30+
});
31+
32+
gulp.task('build', ['test', 'clean'], function() {
33+
gulp.src(DEST + '/' + SRC_COMPILED)
34+
.pipe(uglify())
35+
.pipe(rename(MIN_FILE))
36+
.pipe(gulp.dest(DEST));
37+
});

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,17 @@
3535
],
3636
"dependencies": {},
3737
"devDependencies": {
38+
"gulp": "3.8.11",
39+
"gulp-browserify": "0.5.1",
40+
"gulp-mocha": "2.0.0",
41+
"gulp-rename": "1.2.0",
42+
"gulp-rimraf": "^0.1.1",
43+
"gulp-uglify": "1.1.0",
44+
"istanbul": "*",
3845
"mocha": "*",
39-
"uglify-js": "1.3.x",
40-
"istanbul": "*"
46+
"uglify-js": "1.3.x"
4147
},
42-
"main": "lib/string",
48+
"main": "dist/string",
4349
"scripts": {
4450
"test": "mocha test",
4551
"istanbul": "node_modules/.bin/istanbul cover node_modules/.bin/_mocha test/string.test.js"

test/browser.test.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<link rel="stylesheet" href="https://raw.github.com/visionmedia/mocha/master/mocha.css" />
77
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
88
<script src="https://raw.github.com/visionmedia/mocha/master/mocha.js"></script>
9-
<script src="../lib/string.js"></script>
9+
<script src="../dist/string.js"></script>
1010
<script>mocha.setup('bdd')</script>
1111
<script src="string.test.js"></script>
1212
<script>

test/mocha.opts

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)