Skip to content

Commit 2381c55

Browse files
committed
build: separate demo-app in its own directory.
1 parent c566242 commit 2381c55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+297
-171
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
/.idea
2626

2727
# misc
28+
.DS_Store
2829
/.sass-cache
2930
/connect.lock
3031
/coverage/*

angular-cli-build.js

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,66 @@ const path = require('path');
55
// Import the require hook. Enables us to require TS files natively.
66
require('ts-node/register');
77

8-
98
const Angular2App = require('angular-cli/lib/broccoli/angular2-app');
109
const Funnel = require('broccoli-funnel');
1110
const MergeTree = require('broccoli-merge-trees');
1211
const autoPrefixerTree = require('broccoli-autoprefixer');
1312

1413

1514
module.exports = function(defaults) {
16-
var angularAppTree = new Angular2App(defaults, {
17-
sourceDir: 'src/',
15+
const appTree = buildAppTree(defaults);
16+
const cssAutoprefixed = autoPrefixerTree(new Funnel(appTree, {
17+
include: [ '**/*.css' ]
18+
}));
19+
20+
return new MergeTree([
21+
new Funnel('src/demo-app', { include: ['**/*.scss'] }),
22+
appTree,
23+
cssAutoprefixed
24+
], { overwrite: true });
25+
};
26+
27+
28+
function buildAppTree(defaults) {
29+
let inputNode = new MergeTree([
30+
new Funnel('typings', {
31+
destDir: 'typings'
32+
}),
33+
new Funnel('src', {
34+
include: ['components/**/*', 'core/**/*'],
35+
destDir: 'src'
36+
}),
37+
new Funnel('src/demo-app', {
38+
destDir: 'src/demo-app'
39+
})
40+
]);
41+
42+
const getCoreAndComponentPath = function(name) {
43+
if (name.startsWith('src/core')) {
44+
return name.replace(/^src\/core/, 'src/demo-app/core');
45+
} else if (name.startsWith('src/components')) {
46+
return name.replace(/^src\/components/, 'src/demo-app/components');
47+
}
48+
return name;
49+
};
50+
51+
return new Angular2App(defaults, inputNode, {
52+
assets: {
53+
getDestinationPath: getCoreAndComponentPath
54+
},
55+
sourceDir: 'src/demo-app',
56+
tsCompiler: {
57+
additionalFiles: [
58+
'src/core/**/*.ts',
59+
'src/components/**/*.ts'
60+
],
61+
getDestinationPath: getCoreAndComponentPath
62+
},
1863
sassCompiler: {
1964
includePaths: [
2065
'src/core/style'
21-
]
66+
],
67+
getDestinationPath: getCoreAndComponentPath
2268
},
2369
vendorNpmFiles: [
2470
'systemjs/dist/system-polyfills.js',
@@ -30,14 +76,4 @@ module.exports = function(defaults) {
3076
'@angular/**/*.js',
3177
]
3278
});
33-
34-
const cssAutoprefixed = autoPrefixerTree(new Funnel(angularAppTree, {
35-
include: [ '**/*.css' ]
36-
}));
37-
38-
return new MergeTree([
39-
new Funnel('src', { include: ['**/*.scss']}),
40-
angularAppTree,
41-
cssAutoprefixed,
42-
], { overwrite: true });
43-
};
79+
}

config/environment.dev.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const environment = {
2+
production: false
3+
};

config/environment.prod.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const environment = {
2+
production: true
3+
};

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
"@angular/common": "2.0.0-rc.0",
2929
"@angular/compiler": "2.0.0-rc.0",
3030
"@angular/core": "2.0.0-rc.0",
31-
"@angular/router": "2.0.0-rc.0",
3231
"@angular/http": "2.0.0-rc.0",
3332
"@angular/platform-browser": "2.0.0-rc.0",
3433
"@angular/platform-browser-dynamic": "2.0.0-rc.0",
34+
"@angular/router": "2.0.0-rc.0",
3535
"es6-promise": "^3.0.2",
3636
"es6-shim": "^0.35.0",
3737
"reflect-metadata": "0.1.3",
@@ -41,7 +41,7 @@
4141
},
4242
"devDependencies": {
4343
"add-stream": "^1.0.0",
44-
"angular-cli": "0.0.37",
44+
"angular-cli": "^1.0.0-beta.1",
4545
"broccoli-autoprefixer": "^4.1.0",
4646
"broccoli-funnel": "^1.0.1",
4747
"broccoli-merge-trees": "^1.1.1",
@@ -68,7 +68,7 @@
6868
"symlink-or-copy": "^1.0.1",
6969
"ts-node": "^0.5.5",
7070
"tslint": "^3.5.0",
71-
"typescript": "^1.8.0",
71+
"typescript": "^1.9.0-dev",
7272
"typings": "^0.8.1",
7373
"which": "^1.2.4"
7474
}

src/components/button/button.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414

1515

1616
@Component({
17+
moduleId: module.id,
1718
selector: 'button[md-button], button[md-raised-button], button[md-icon-button], ' +
1819
'button[md-fab], button[md-mini-fab]',
1920
inputs: ['color'],
@@ -23,8 +24,8 @@ import {
2324
'(focus)': 'setKeyboardFocus()',
2425
'(blur)': 'removeKeyboardFocus()',
2526
},
26-
templateUrl: './components/button/button.html',
27-
styleUrls: ['./components/button/button.css'],
27+
templateUrl: 'button.html',
28+
styleUrls: ['button.css'],
2829
encapsulation: ViewEncapsulation.None,
2930
changeDetection: ChangeDetectionStrategy.OnPush,
3031
})

src/components/card/card.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ it also provides a number of preset styles for common card sections, including:
2121
*/
2222

2323
@Component({
24+
moduleId: module.id,
2425
selector: 'md-card',
25-
templateUrl: './components/card/card.html',
26-
styleUrls: ['./components/card/card.css'],
26+
templateUrl: 'card.html',
27+
styleUrls: ['card.css'],
2728
encapsulation: ViewEncapsulation.None,
2829
changeDetection: ChangeDetectionStrategy.OnPush,
2930
})
@@ -45,8 +46,9 @@ TODO(kara): update link to demo site when it exists
4546
*/
4647

4748
@Component({
49+
moduleId: module.id,
4850
selector: 'md-card-header',
49-
templateUrl: './components/card/card-header.html',
51+
templateUrl: 'card-header.html',
5052
encapsulation: ViewEncapsulation.None,
5153
changeDetection: ChangeDetectionStrategy.OnPush,
5254
})
@@ -64,8 +66,9 @@ TODO(kara): update link to demo site when it exists
6466
*/
6567

6668
@Component({
69+
moduleId: module.id,
6770
selector: 'md-card-title-group',
68-
templateUrl: './components/card/card-title-group.html',
71+
templateUrl: 'card-title-group.html',
6972
encapsulation: ViewEncapsulation.None,
7073
changeDetection: ChangeDetectionStrategy.OnPush,
7174
})

src/components/checkbox/checkbox.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ enum TransitionCheckState {
5555
* See: https://www.google.com/design/spec/components/selection-controls.html
5656
*/
5757
@Component({
58+
moduleId: module.id,
5859
selector: 'md-checkbox',
59-
templateUrl: './components/checkbox/checkbox.html',
60-
styleUrls: ['./components/checkbox/checkbox.css'],
60+
templateUrl: 'checkbox.html',
61+
styleUrls: ['checkbox.css'],
6162
host: {
6263
'role': 'checkbox',
6364
'[id]': 'id',
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import {Component} from '@angular/core';
22

33
@Component({
4+
moduleId: module.id,
45
selector: 'md-grid-list',
5-
templateUrl: './components/grid-list/grid-list.html',
6-
styleUrls: ['./components/grid-list/grid-list.css'],
6+
templateUrl: 'grid-list.html',
7+
styleUrls: ['grid-list.css'],
78
})
89
export class MdGridList {}

src/components/icon/icon.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ export class MdIconInvalidNameError extends Error {
5555
* <md-icon fontSet="fa" fontIcon="alarm"></md-icon>
5656
*/
5757
@Component({
58+
moduleId: module.id,
5859
template: '<ng-content></ng-content>',
5960
selector: 'md-icon',
60-
styleUrls: ['./components/icon/icon.css'],
61+
styleUrls: ['icon.css'],
6162
host: {
6263
'role': 'img',
6364
},

0 commit comments

Comments
 (0)