Skip to content

Commit b9a3c30

Browse files
setup umd build (antonybudianto#86)
* setup umd build * restore browser * implement manual_typings
1 parent 057a3c6 commit b9a3c30

File tree

6 files changed

+34
-12
lines changed

6 files changed

+34
-12
lines changed

karma.conf.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ module.exports = function(config) {
1212

1313
preprocessors: {
1414
'tmp/app/**/!(*.spec)+(.js)': ['coverage'],
15-
'tmp/app/**/*.js': ['sourcemap']
15+
'tmp/app/**/*.js': ['sourcemap'],
16+
'tmp/test/**/*.js': ['sourcemap']
1617
},
1718

1819
// Generate json used for remap-istanbul
@@ -34,6 +35,7 @@ module.exports = function(config) {
3435
'node_modules/zone.js/dist/fake-async-test.js',
3536
'node_modules/systemjs/dist/system.src.js',
3637

38+
'tmp/test/test-helpers/global/**/*.js',
3739
'systemjs.conf.js',
3840
'karma-test-shim.js',
3941

manual_typings/jasmine.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
declare module jasmine {
2+
interface Matchers {
3+
toContainText(text: string): boolean;
4+
}
5+
}

systemjs.conf.js

+20-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
(function(global) {
88
// ENV
9-
global.ENV = 'development'
9+
global.ENV = global.ENV || 'development';
1010

1111
// wildcard paths
1212
var paths = {
@@ -35,19 +35,29 @@
3535
}
3636
};
3737

38+
// Add package entries for angular packages
39+
var ngPackageNames = [
40+
'common',
41+
'compiler',
42+
'core',
43+
'http',
44+
'platform-browser',
45+
'platform-browser-dynamic',
46+
'router'
47+
];
48+
49+
// add package entries for packages that expose barrels using index.js
3850
var packageNames = [
39-
'@angular/common',
40-
'@angular/compiler',
41-
'@angular/core',
42-
'@angular/http',
43-
'@angular/platform-browser',
44-
'@angular/platform-browser-dynamic',
45-
'@angular/router',
46-
'@angular/testing',
4751
'lodash'
4852
];
4953

50-
// add package entries for angular packages in the form '@angular/common': { main: 'index.js', defaultExtension: 'js' }
54+
ngPackageNames.forEach(function(pkgName) {
55+
var main = global.ENV === 'testing' ? 'index.js' :
56+
pkgName + '.umd.js';
57+
58+
packages['@angular/'+pkgName] = { main: main, defaultExtension: 'js' };
59+
});
60+
5161
packageNames.forEach(function(pkgName) {
5262
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
5363
});

tasks/typescript.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ var sourcemaps = require('gulp-sourcemaps');
66

77
/* Initialize TS Project */
88
var typingFiles = [
9-
'typings/index.d.ts'
9+
'typings/index.d.ts',
10+
'manual_typings/**/*.d.ts'
1011
];
1112
var tsUnitFiles = [].concat(config.tsTestFiles.unit, config.tsTestFiles.helper);
1213
var tsE2EFiles = [].concat(config.tsTestFiles.e2e, config.tsTestFiles.helper);

test/test-helpers/global/env.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This lets systemjs.conf.js knows how to load the module during testing
2+
((global) => {
3+
global.ENV = 'testing';
4+
})(this);
File renamed without changes.

0 commit comments

Comments
 (0)