Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit f18bc66

Browse files
committed
chore: publish esm + umd
s s
1 parent 2dc2462 commit f18bc66

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

gulpfile.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ var $ = require('gulp-load-plugins')({lazy: true});
33
var args = require('yargs').argv;
44
var cp = require('child_process');
55
var del = require('del');
6+
var rollup = require('rollup-stream');
7+
var source = require('vinyl-source-stream');
68

79
var path = require("path");
810

@@ -19,18 +21,25 @@ gulp.task('help', $.taskListing.withFilters(function (taskName) {
1921
return shouldRemove;
2022
}));
2123

22-
gulp.task('build', ['ngc'], function(){
24+
gulp.task('build', ['umd'], function(){
2325
return gulp
2426
.src(jsCopySrc)
2527
.pipe(gulp.dest('./'));
2628
});
2729

28-
gulp.task('ngc',['clean'], function(done) {
30+
gulp.task('ngc', ['clean'], function(done) {
2931
runNgc('./', done);
3032
});
3133

34+
// Uses rollup-stream plugin https://www.npmjs.com/package/rollup-stream
35+
gulp.task('umd', ['ngc'], function(done) {
36+
return rollup('rollup.config.js')
37+
.pipe(source('in-memory-web-api.umd.js'))
38+
.pipe(gulp.dest('./bundles'));
39+
});
40+
3241
gulp.task('clean', function(done) {
33-
clean([ngcOutput+'*.js', '*.js.map', '*.d.ts', '!gulpfile.js', '*.metadata.json'], done);
42+
clean([ngcOutput+'*.js', '*.js.map', '*.d.ts', '!gulpfile.js', '*.metadata.json', './bundles/in-memory-web-api.umd.js'], done);
3443
});
3544

3645
/**

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "angular-in-memory-web-api",
33
"version": "0.1.7",
44
"description": "An in-memory web api for Angular demos and tests",
5-
"main":"index.js",
6-
"jsnext:main": "esm/index.js",
5+
"main":"bundles/in-memory-web-api.umd.js",
6+
"module": "index.js",
77
"scripts": {
88
"tsc": "tsc",
99
"tsc:w": "tsc -w",
@@ -78,6 +78,10 @@
7878
"gulp-task-listing": "^1.0.1",
7979
"gulp-util": "^3.0.7",
8080

81-
"yargs": "^5.0.0"
81+
"yargs": "^5.0.0",
82+
83+
"vinyl-source-stream": "^1.1.0",
84+
"rollup": "^0.36.0",
85+
"rollup-stream": "^1.14.0"
8286
}
8387
}

rollup.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export default {
2+
entry: './src/index.js',
3+
dest: './bundles/in-memory-web-api.umd.js',
4+
format: 'umd',
5+
moduleName: 'ng.inMemoryWebApi',
6+
globals: {
7+
'@angular/core': 'ng.core',
8+
'@angular/http': 'ng.http',
9+
'rxjs/Observable': 'Rx',
10+
'rxjs/add/operator/delay': 'Rx'
11+
}
12+
}

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
33
"target": "es5",
4-
"module": "commonjs",
4+
"module": "es2015",
55
"moduleResolution": "node",
66
"sourceMap": true,
77
"sourceRoot": "./src",

0 commit comments

Comments
 (0)