Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

docs: systemjs.config.plunker -> systemjs.config.web w/ auto-bootstrap #2756

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ gulp.task('build-dart-api-docs', ['_shred-api-examples', 'dartdoc'], function()
return buildApiDocsForDart();
});

// Using the --build flag will use systemjs.config.plunker.build.js (for preview builds)
// Using the --build flag will use systemjs.config.web.build.js (for preview builds)
gulp.task('build-plunkers', ['_copy-example-boilerplate'], function() {
regularPlunker.buildPlunkers(EXAMPLES_PATH, LIVE_EXAMPLES_PATH, { errFn: gutil.log, build: argv.build });
return embeddedPlunker.buildPlunkers(EXAMPLES_PATH, LIVE_EXAMPLES_PATH, { errFn: gutil.log, build: argv.build, targetSelf: argv.targetSelf });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* PLUNKER VERSION FOR CURRENT ANGULAR BUILD
* WEB VERSION FOR CURRENT ANGULAR BUILD
* (based on systemjs.config.js in angular.io)
* System configuration for Angular samples
* Adjust as necessary for your application needs.
Expand All @@ -11,7 +11,19 @@
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
transpiler: 'ts',
typescriptOptions: {
tsconfig: true
// Complete copy of compiler options in standard tsconfig.json
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"../../node_modules/@types/"
]
},
meta: {
'typescript': {
Expand Down Expand Up @@ -67,4 +79,26 @@
}
}
});

if (!global.noBootstrap) { bootstrap(); }

// Bootstrap the `AppModule`(skip the `app/main.ts` that normally does this)
function bootstrap() {

// Stub out `app/main.ts` so System.import('app') doesn't fail if called in the index.html
System.set(System.normalizeSync('app/main.ts'), System.newModule({ }));

// bootstrap and launch the app (equivalent to standard main.ts)
Promise.all([
System.import('@angular/platform-browser-dynamic'),
System.import('app/app.module')
])
.then(function (imports) {
var platform = imports[0];
var app = imports[1];
platform.platformBrowserDynamic().bootstrapModule(app.AppModule);
})
.catch(function(err){ console.error(err); });
}

})(this);
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* PLUNKER VERSION
* WEB ANGULAR VERSION
* (based on systemjs.config.js in angular.io)
* System configuration for Angular samples
* Adjust as necessary for your application needs.
Expand All @@ -9,7 +9,19 @@
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
transpiler: 'ts',
typescriptOptions: {
tsconfig: true
// Complete copy of compiler options in standard tsconfig.json
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"../../node_modules/@types/"
]
},
meta: {
'typescript': {
Expand Down Expand Up @@ -54,4 +66,26 @@
}
}
});

if (!global.noBootstrap) { bootstrap(); }

// Bootstrap the `AppModule`(skip the `app/main.ts` that normally does this)
function bootstrap() {

// Stub out `app/main.ts` so System.import('app') doesn't fail if called in the index.html
System.set(System.normalizeSync('app/main.ts'), System.newModule({ }));

// bootstrap and launch the app (equivalent to standard main.ts)
Promise.all([
System.import('@angular/platform-browser-dynamic'),
System.import('app/app.module')
])
.then(function (imports) {
var platform = imports[0];
var app = imports[1];
platform.platformBrowserDynamic().bootstrapModule(app.AppModule);
})
.catch(function(err){ console.error(err); });
}

})(this);
2 changes: 2 additions & 0 deletions public/docs/_examples/testing/ts/browser-test-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ System.config({
},
});

document['noBootstrap'] = true; // do not run system.config.web.js bootstrap

System.import('systemjs.config.js')
.then(importSystemJsExtras)
.then(initTestBed)
Expand Down
8 changes: 3 additions & 5 deletions tools/plunker-builder/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class PlunkerBuilder {
if (config.basePath.indexOf('/ts') > -1) {
// uses systemjs.config.js so add plunker version
this.options.addField(postData, 'systemjs.config.js', this.systemjsConfig);
this.options.addField(postData, 'tsconfig.json', this.tsconfig);
}
}

Expand Down Expand Up @@ -210,13 +209,12 @@ class PlunkerBuilder {
_getPlunkerFiles() {
// Assume plunker version is sibling of node_modules version
this.readme = fs.readFileSync(this.basePath + '/_boilerplate/plunker.README.md', 'utf-8');
var systemJsConfigPath = '/_boilerplate/systemjs.config.plunker.js';
var systemJsConfigPath = '/_boilerplate/systemjs.config.web.js';
if (this.options.build) {
systemJsConfigPath = '/_boilerplate/systemjs.config.plunker.build.js';
systemJsConfigPath = '/_boilerplate/systemjs.config.web.build.js';
}
this.systemjsConfig = fs.readFileSync(this.basePath + systemJsConfigPath, 'utf-8');
this.systemjsConfig += this.copyrights.jsCss;
this.tsconfig = fs.readFileSync(`${this.basePath}/_boilerplate/tsconfig.json`, 'utf-8');
}

_htmlToElement(document, html) {
Expand Down Expand Up @@ -255,8 +253,8 @@ class PlunkerBuilder {
}
});

// var defaultExcludes = [ '!**/node_modules/**','!**/tsconfig.json', '!**/*plnkr.json', '!**/*plnkr.html', '!**/*plnkr.no-link.html' ];
var defaultExcludes = [
'!**/app/main.ts',
'!**/tsconfig.json',
'!**/*plnkr.*',
'!**/package.json',
Expand Down