Skip to content

Commit 09b8276

Browse files
committed
build: separate demo-app in its own directory.
1 parent 9433556 commit 09b8276

Some content is hidden

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

60 files changed

+324
-203
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: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,53 @@ 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/demo-app'
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+
sourceDir: 'src/demo-app',
53+
tsCompiler: {
54+
},
1855
sassCompiler: {
1956
includePaths: [
2057
'src/core/style'
@@ -30,14 +67,4 @@ module.exports = function(defaults) {
3067
'@angular/**/*.js',
3168
]
3269
});
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-
};
70+
}

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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.4",
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.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing'
44
import {Component, DebugElement} from '@angular/core';
55
import {By} from '@angular/platform-browser';
66
import {MdCheckbox} from './checkbox';
7-
import {PromiseCompleter} from '../../core/async/promise-completer';
7+
import {PromiseCompleter} from '@angular2-material/core/async/promise-completer';
88

99
// TODO: Implement E2E tests for spacebar/click behavior for checking/unchecking
1010

src/components/checkbox/checkbox.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ enum TransitionCheckState {
5353
* See: https://www.google.com/design/spec/components/selection-controls.html
5454
*/
5555
@Component({
56+
moduleId: module.id,
5657
selector: 'md-checkbox',
57-
templateUrl: './components/checkbox/checkbox.html',
58-
styleUrls: ['./components/checkbox/checkbox.css'],
58+
templateUrl: 'checkbox.html',
59+
styleUrls: ['checkbox.css'],
5960
host: {
6061
'[class.md-checkbox-indeterminate]': 'indeterminate',
6162
'[class.md-checkbox-checked]': 'checked',

src/components/grid-list/grid-list-errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {MdError} from '../../core/errors/error';
1+
import {MdError} from '@angular2-material/core/errors/error';
22

33
/**
44
* Exception thrown when cols property is missing from grid-list

0 commit comments

Comments
 (0)