Skip to content

Commit 6f77db5

Browse files
committed
Merge branch 'webpack'
# Conflicts: # addon/ng2/blueprints/ng2/files/package.json
2 parents 5183e1d + 681918f commit 6f77db5

36 files changed

+1770
-116
lines changed

addon/ng2/blueprints/ng2/files/__path__/index.html

+6-28
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
<title><%= jsComponentName %></title>
66
<base href="/">
77

8-
{{#unless environment.production}}
9-
<script src="/ember-cli-live-reload.js" type="text/javascript"></script>
10-
{{/unless}}
118
<meta name="viewport" content="width=device-width, initial-scale=1">
129
<link rel="icon" type="image/x-icon" href="favicon.ico"><% if (isMobile) { %>
1310
<meta name="apple-mobile-web-app-capable" content="yes">
@@ -16,14 +13,13 @@
1613
{{#each mobile.icons}}
1714
<link rel="{{rel}}" {{#if sizes}}sizes="{{sizes}}" {{/if}}href="{{href}}">
1815
{{/each}}
19-
2016
{{#if environment.production}}
2117
<script type="text/javascript">
22-
if ('serviceWorker' in navigator) {
23-
navigator.serviceWorker.register('/worker.js').catch(function(err) {
24-
console.log('Error installing service worker: ', err);
25-
});
26-
}
18+
if ('serviceWorker' in navigator) {
19+
navigator.serviceWorker.register('/worker.js').catch(function(err) {
20+
console.log('Error installing service worker: ', err);
21+
});
22+
}
2723
</script>
2824
{{/if}}
2925
<% } %>
@@ -32,32 +28,14 @@
3228
<<%= prefix %>-root>Loading...</<%= prefix %>-root>
3329

3430
<% if (isMobile) { %>
35-
3631
{{#if environment.production}}
3732
<script src="/app-concat.js" async></script>
3833
{{else}}
39-
{{#each scripts.polyfills}}
40-
<script src="{{.}}"></script>
41-
{{/each}}
42-
<script>
43-
System.import('system-config.js').then(function () {
44-
System.import('main');
45-
}).catch(console.error.bind(console));
46-
</script>
47-
{{/if}}
4834

35+
{{/if}}
4936
<% } else { %>
5037

51-
{{#each scripts.polyfills}}
52-
<script src="{{.}}"></script>
53-
{{/each}}
54-
<script>
55-
System.import('system-config.js').then(function () {
56-
System.import('main');
57-
}).catch(console.error.bind(console));
58-
</script>
5938

6039
<% } %>
61-
6240
</body>
6341
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Prefer CoreJS over the polyfills above
2+
import 'core-js/es6';
3+
import 'core-js/es7/reflect';
4+
import 'zone.js/dist/zone';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*global jasmine, __karma__, window*/
2+
require('core-js/es6');
3+
require('core-js/es7/reflect');
4+
5+
// Typescript emit helpers polyfill
6+
require('ts-helpers');
7+
8+
require('zone.js/dist/zone');
9+
require('zone.js/dist/long-stack-trace-zone');
10+
require('zone.js/dist/jasmine-patch');
11+
require('zone.js/dist/async-test');
12+
require('zone.js/dist/fake-async-test');
13+
require('zone.js/dist/sync-test');
14+
15+
// RxJS
16+
require('rxjs/Rx');
17+
18+
var testing = require('@angular/core/testing');
19+
var browser = require('@angular/platform-browser-dynamic/testing');
20+
21+
testing.setBaseTestProviders(
22+
browser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
23+
browser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS
24+
);
25+
26+
var testContext = require.context('../src', true, /\.spec\.ts/);
27+
28+
/*
29+
* get all the files, for each file, call the context function
30+
* that will require the file and load it up here. Context will
31+
* loop and require those spec files here
32+
*/
33+
function requireAll(requireContext) {
34+
return requireContext.keys().map(requireContext);
35+
}
36+
37+
requireAll(testContext);
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
{
2-
"compileOnSave": false,
32
"compilerOptions": {
3+
"baseUrl": ".",
44
"declaration": false,
55
"emitDecoratorMetadata": true,
66
"experimentalDecorators": true,
77
"mapRoot": "/",
88
"module": "commonjs",
99
"moduleResolution": "node",
10-
"noEmitOnError": true,
11-
"noImplicitAny": false,
12-
"outDir": "../dist/",
10+
"outDir": "./dist/",
1311
"rootDir": ".",
1412
"sourceMap": true,
15-
"target": "es5",
16-
"inlineSources": true
13+
"sourceRoot": ".",
14+
"target": "es2015"
1715
},
18-
16+
"exclude": [
17+
"node_modules",
18+
"bower_components"
19+
],
1920
"files": [
20-
"main.ts",<% if (isMobile) { %>
21-
"main-app-shell.ts",<% } %>
22-
"typings.d.ts"
21+
"./src/typings.d.ts"
2322
]
2423
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
12
// Typings reference file, see links for more information
23
// https://github.com/typings/typings
34
// https://www.typescriptlang.org/docs/handbook/writing-declaration-files.html
45

56
/// <reference path="<%= refToTypings %>/typings/browser.d.ts" />
67
<% if(!isMobile) { %>declare var module: { id: string };<% } %>
8+
declare var require: any;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Typescript emit helpers polyfill
2+
import 'ts-helpers';
3+
4+
import '@angular/core';
5+
import '@angular/common';
6+
import '@angular/compiler';
7+
import '@angular/http';
8+
import '@angular/router';
9+
import '@angular/platform-browser';
10+
import '@angular/platform-browser-dynamic';
11+
12+
<% if(isMobile) { %>
13+
import '@angular/app-shell';
14+
<% } %>
15+
16+
import 'rxjs/add/operator/map';
17+
import 'rxjs/add/operator/mergeMap';

addon/ng2/blueprints/ng2/files/config/karma.conf.js

+1-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Karma configuration file, see link for more information
2-
// https://karma-runner.github.io/0.13/config/configuration-file.html
3-
41
module.exports = function (config) {
52
config.set({
63
basePath: '..',
@@ -16,20 +13,7 @@ module.exports = function (config) {
1613
flags: ['--no-sandbox']
1714
}
1815
},
19-
files: [
20-
{ pattern: 'dist/vendor/es6-shim/es6-shim.js', included: true, watched: false },
21-
{ pattern: 'dist/vendor/zone.js/dist/zone.js', included: true, watched: false },
22-
{ pattern: 'dist/vendor/reflect-metadata/Reflect.js', included: true, watched: false },
23-
{ pattern: 'dist/vendor/systemjs/dist/system-polyfills.js', included: true, watched: false },
24-
{ pattern: 'dist/vendor/systemjs/dist/system.src.js', included: true, watched: false },
25-
{ pattern: 'dist/vendor/zone.js/dist/async-test.js', included: true, watched: false },
26-
{ pattern: 'dist/vendor/zone.js/dist/fake-async-test.js', included: true, watched: false },
27-
28-
{ pattern: 'config/karma-test-shim.js', included: true, watched: true },
29-
30-
// Distribution folder.
31-
{ pattern: 'dist/**/*', included: false, watched: true }
32-
],
16+
files: [],
3317
exclude: [
3418
// Vendor packages might include spec files. We don't want to use those.
3519
'dist/vendor/**/*.spec.js'

addon/ng2/blueprints/ng2/files/e2e/tsconfig.json

-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44
"declaration": false,
55
"emitDecoratorMetadata": true,
66
"experimentalDecorators": true,
7-
"mapRoot": "",
87
"module": "commonjs",
98
"moduleResolution": "node",
109
"noEmitOnError": true,
1110
"noImplicitAny": false,
1211
"rootDir": ".",
1312
"sourceMap": true,
14-
"sourceRoot": "/",
1513
"target": "es5"
1614
}
1715
}

addon/ng2/blueprints/ng2/files/package.json

+8-9
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,20 @@
2121
"@angular/platform-browser": "2.0.0-rc.3",
2222
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
2323
"@angular/router": "3.0.0-alpha.8",
24-
"es6-shim": "0.35.1",
25-
"reflect-metadata": "0.1.3",
24+
"ts-helpers": "^1.1.1",
2625
"rxjs": "5.0.0-beta.6",
2726
"systemjs": "0.19.26",
28-
"zone.js": "0.6.12"
27+
"zone.js": "0.6.12",
28+
"core-js": "^2.4.0"
2929
},
3030
"devDependencies": {<% if(isMobile) { %>
3131
"@angular/platform-server": "2.0.0-rc.3",
3232
"@angular/service-worker": "0.2.0",
3333
"@angular/app-shell": "0.0.0",
34-
"angular2-broccoli-prerender": "0.11.0",
35-
"angular2-universal":"0.100.5",
34+
"angular2-universal":"0.101.5",
3635
"angular2-universal-polyfills": "0.4.1",
37-
"preboot": "2.0.10",<% } %>
38-
"angular-cli": "<%= version %>",
36+
"preboot": "^2.0.10",<% } %>
37+
"angular-cli": "^<%= version %>",
3938
"codelyzer": "0.0.20",
4039
"ember-cli-inject-live-reload": "1.4.0",
4140
"jasmine-core": "2.4.1",
@@ -44,9 +43,9 @@
4443
"karma-chrome-launcher": "0.2.3",
4544
"karma-jasmine": "0.3.8",
4645
"protractor": "3.3.0",
47-
"ts-node": "0.5.5",
46+
"ts-node": "0.9.1",
4847
"tslint": "3.11.0",
49-
"typescript": "1.8.10",
48+
"typescript": "^1.9.0-dev.20160627-1.0",
5049
"typings": "0.8.1"<%= stylePackage %>
5150
}
5251
}

addon/ng2/blueprints/ng2/files/typings.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"selenium-webdriver": "registry:dt/selenium-webdriver#2.44.0+20160317120654"
66
},
77
"ambientDependencies": {
8-
"es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654"<% if (isMobile) {%>,
9-
"node": "registry:dt/node#4.0.0+20160509154515" <% } %>
8+
<% if (isMobile) {%>"node": "registry:dt/node#4.0.0+20160509154515" <% } %>
109
}
1110
}

addon/ng2/commands/build.ts

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
const Command = require('ember-cli/lib/models/command');
2+
const win = require('ember-cli/lib/utilities/windows-admin');
3+
4+
// const Build = require('../tasks/build');
5+
// const BuildWatch = require('../tasks/build-watch');
6+
7+
const WebpackBuild = require('../tasks/build-webpack');
8+
const WebpackBuildWatch = require('../tasks/build-webpack-watch');
9+
10+
interface BuildOptions {
11+
environment?: string;
12+
outputPath?: string;
13+
watch?: boolean;
14+
watcher?: string;
15+
supressSizes: boolean;
16+
}
17+
18+
module.exports = Command.extend({
19+
name: 'build',
20+
description: 'Builds your app and places it into the output path (dist/ by default).',
21+
aliases: ['b'],
22+
23+
availableOptions: [
24+
{ name: 'environment', type: String, default: 'development', aliases: ['e', { 'dev': 'development' }, { 'prod': 'production' }] },
25+
{ name: 'output-path', type: 'Path', default: 'dist/', aliases: ['o'] },
26+
{ name: 'watch', type: Boolean, default: false, aliases: ['w'] },
27+
{ name: 'watcher', type: String },
28+
{ name: 'suppress-sizes', type: Boolean, default: false },
29+
30+
// Experimental webpack build for material team
31+
{ name: 'm2', type: Boolean, default: false}
32+
],
33+
34+
run: function(commandOptions: BuildOptions) {
35+
36+
let buildTask = commandOptions.watch ?
37+
new WebpackBuildWatch() :
38+
new WebpackBuild();
39+
40+
console.log(buildTask);
41+
42+
return buildTask.run(commandOptions);
43+
}
44+
});
45+
46+
module.exports.overrideCore = true;

addon/ng2/commands/init.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var normalizeBlueprint = require('ember-cli/lib/utilities/normalize-blueprint-op
88
var GitInit = require('../tasks/git-init');
99
var LinkCli = require('../tasks/link-cli');
1010

11+
1112
module.exports = Command.extend({
1213
name: 'init',
1314
description: 'Creates a new angular-cli project in the current folder.',
@@ -93,7 +94,7 @@ module.exports = Command.extend({
9394

9495
return Promise.reject(new SilentError(message));
9596
}
96-
97+
9798
var blueprintOpts = {
9899
dryRun: commandOptions.dryRun,
99100
blueprint: commandOptions.blueprint || this._defaultBlueprint(),

0 commit comments

Comments
 (0)