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

Commit c920a38

Browse files
devversionjelbourn
authored andcommitted
Use docs-content from NPM package (#565)
1 parent 316dd78 commit c920a38

22 files changed

+639
-1177
lines changed

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
# compiled output
44
/dist
55
/tmp
6-
/src/assets/documents
7-
/src/assets/examples
8-
/src/assets/stackblitz/examples
96
/src/assets/*.css
10-
/src/assets/*.html
117

128
# dependencies
139
/node_modules

angular.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
"input": "src/assets",
2222
"output": "/assets"
2323
},
24+
{
25+
"glob": "**/*",
26+
"input": "./node_modules/@angular/material-examples/docs-content",
27+
"output": "/docs-content"
28+
},
2429
{
2530
"glob": "favicon.ico",
2631
"input": "src",

karma.conf.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,11 @@ module.exports = function (config) {
1111
require('karma-chrome-launcher'),
1212
require('karma-firefox-launcher'),
1313
require('karma-jasmine-html-reporter'),
14-
require('karma-coverage-istanbul-reporter'),
1514
require('@angular-devkit/build-angular/plugins/karma'),
16-
require('karma-browserstack-launcher'),
17-
require('karma-sauce-launcher'),
1815
],
1916
client: {
2017
clearContext: false // leave Jasmine Spec Runner output visible in browser
2118
},
22-
coverageIstanbulReporter: {
23-
dir: require('path').join(__dirname, 'coverage'),
24-
reports: ['html', 'lcovonly'],
25-
fixWebpackSourcePaths: true
26-
},
2719
reporters: ['progress', 'kjhtml'],
2820
port: 9876,
2921
colors: true,

package.json

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,57 +10,52 @@
1010
"test": "npm run build-themes && ng test",
1111
"pree2e": "webdriver-manager update",
1212
"e2e": "protractor",
13-
"fetch-local": "bash ./tools/fetch-assets-local.sh",
1413
"build-themes": "bash ./tools/build-themes.sh",
1514
"prod-build": "npm run build-themes && ng build --aot --prod",
16-
"postinstall": "webdriver-manager update && bash ./tools/build-themes.sh",
15+
"postinstall": "webdriver-manager update --gecko false && bash ./tools/build-themes.sh",
1716
"publish-prod": "bash ./tools/deploy.sh stable prod",
1817
"publish-dev": "bash ./tools/deploy.sh",
1918
"publish-beta": "bash ./tools/deploy.sh stable beta"
2019
},
2120
"private": true,
2221
"dependencies": {
23-
"@angular/animations": "^7.0.0",
22+
"@angular/animations": "^7.1.4",
2423
"@angular/cdk": "^7.2.1",
25-
"@angular/common": "^7.0.0",
26-
"@angular/compiler": "^7.0.0",
27-
"@angular/core": "^7.0.0",
28-
"@angular/forms": "^7.0.0",
29-
"@angular/http": "^7.0.0",
24+
"@angular/common": "^7.1.4",
25+
"@angular/compiler": "^7.1.4",
26+
"@angular/core": "^7.1.4",
27+
"@angular/forms": "^7.1.4",
28+
"@angular/http": "^7.1.4",
3029
"@angular/material": "^7.2.1",
30+
"@angular/material-examples": "https://github.com/angular/material2-docs-content.git",
3131
"@angular/material-moment-adapter": "^7.2.1",
32-
"@angular/platform-browser": "^7.0.0",
33-
"@angular/platform-browser-dynamic": "^7.0.0",
34-
"@angular/router": "^7.0.0",
35-
"core-js": "^2.5.6",
32+
"@angular/platform-browser": "^7.1.4",
33+
"@angular/platform-browser-dynamic": "^7.1.4",
34+
"@angular/router": "^7.1.4",
35+
"core-js": "^2.6.1",
3636
"hammerjs": "^2.0.8",
37-
"moment": "^2.22.1",
38-
"rxjs": "^6.1.0",
37+
"moment": "^2.23.0",
38+
"rxjs": "^6.3.3",
3939
"zone.js": "^0.8.26"
4040
},
4141
"devDependencies": {
42-
"@angular-devkit/build-angular": "^0.10.1",
43-
"@angular/cli": "^7.0.1",
44-
"@angular/compiler-cli": "^7.0.0",
45-
"@types/jasmine": "^2.8.9",
46-
"@types/node": "^10.0.9",
47-
"firebase-tools": "^6.0.0",
48-
"highlight.js": "^9.9.0",
42+
"@angular-devkit/build-angular": "^0.11.4",
43+
"@angular/cli": "^7.1.4",
44+
"@angular/compiler-cli": "^7.1.4",
45+
"@types/jasmine": "^3.3.5",
46+
"@types/node": "^10.12.18",
47+
"firebase-tools": "^6.2.2",
4948
"jasmine-core": "~2.99.1",
5049
"jasmine-spec-reporter": "~4.2.1",
51-
"karma": "~1.7.1",
52-
"karma-browserstack-launcher": "^1.3.0",
50+
"karma": "^3.1.4",
5351
"karma-chrome-launcher": "^2.2.0",
54-
"karma-coverage-istanbul-reporter": "~1.4.2",
5552
"karma-firefox-launcher": "^1.1.0",
5653
"karma-jasmine": "^1.1.2",
5754
"karma-jasmine-html-reporter": "^0.2.2",
58-
"karma-sauce-launcher": "^1.2.0",
59-
"natives": "^1.1.6",
60-
"node-sass": "^4.5.3",
55+
"node-sass": "^4.11.0",
6156
"protractor": "~5.3.0",
6257
"ts-node": "^6.0.3",
6358
"tslint": "^5.10.0",
64-
"typescript": "^3.1.3"
59+
"typescript": "~3.1.3"
6560
}
6661
}

scripts/ci/build-and-test.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ source ./scripts/ci/travis-mode.sh
1212
if is_lint; then
1313
npm run lint
1414
elif is_e2e; then
15-
bash ./tools/fetch-assets.sh
1615
npm run e2e
1716
elif is_test; then
18-
bash ./tools/fetch-assets.sh
1917
npm run build-themes
2018
npm run test -- --watch false --progress=false
2119
fi

src/app/pages/component-viewer/component-api.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
</span>
44

55
<doc-viewer
6-
documentUrl="/assets/documents/api/{{componentViewer.componentDocItem.packageName}}-{{componentViewer.componentDocItem.id}}.html"
6+
documentUrl="/docs-content/api-docs/{{componentViewer.componentDocItem.packageName}}-{{componentViewer.componentDocItem.id}}.html"
77
class="docs-component-view-text-content docs-component-api"
88
(contentRendered)="scrollToSelectedContentSection()">
99
</doc-viewer>

src/app/pages/component-viewer/component-overview.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Overview for {{componentViewer.componentDocItem.id}}
33
</span>
44
<doc-viewer
5-
documentUrl="/assets/documents/overview/{{componentViewer.componentDocItem.packageName}}-{{componentViewer.componentDocItem.id}}.html"
5+
documentUrl="/docs-content/overviews/{{componentViewer.componentDocItem.packageName}}/{{componentViewer.componentDocItem.id}}.html"
66
class="docs-component-view-text-content docs-component-overview"
77
(contentRendered)="scrollToSelectedContentSection()">
88
</doc-viewer>

src/app/shared/example-viewer/example-viewer.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ describe('ExampleViewer', () => {
6969
expect(console.error).toHaveBeenCalledWith('Could not find example: foobar');
7070
}));
7171

72-
it('should return assets path for example based on extension', async(() => {
72+
it('should return docs-content path for example based on extension', async(() => {
7373
// set example
7474
component.example = exampleKey;
7575
fixture.detectChanges();
7676

7777
// get example file path for each extension
7878
const extensions = ['ts', 'css', 'html'];
79-
const basePath = '/assets/examples/';
79+
const basePath = '/docs-content/examples-highlighted/';
8080

8181
extensions.forEach(extension => {
8282
const expected = `${basePath}${exampleKey}-example-${extension}.html`;
@@ -178,10 +178,10 @@ class TestExampleModule { }
178178

179179

180180
const FAKE_DOCS = {
181-
'/assets/examples/autocomplete-overview-example-html.html':
181+
'/docs-content/examples-highlighted/autocomplete-overview-example-html.html':
182182
'<div>my docs page</div>',
183-
'/assets/examples/autocomplete-overview-example-ts.html':
183+
'/docs-content/examples-highlighted/autocomplete-overview-example-ts.html':
184184
'<span>const a = 1;</span>',
185-
'/assets/examples/autocomplete-overview-example-css.html':
185+
'/docs-content/examples-highlighted/autocomplete-overview-example-css.html':
186186
'<pre>.class { color: black; }</pre>',
187187
};

src/app/shared/example-viewer/example-viewer.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ export class ExampleViewer {
5959
return Object.keys(this.exampleTabs);
6060
}
6161

62-
private resolveExampleFile(fileName: string) {
63-
return `/assets/examples/${fileName}`;
62+
private resolveHighlightedExampleFile(fileName: string) {
63+
return `/docs-content/examples-highlighted/${fileName}`;
6464
}
6565

6666
private _generateExampleTabs() {
6767
this.exampleTabs = {
68-
HTML: this.resolveExampleFile(`${this.example}-example-html.html`),
69-
TS: this.resolveExampleFile(`${this.example}-example-ts.html`),
70-
CSS: this.resolveExampleFile(`${this.example}-example-css.html`),
68+
HTML: this.resolveHighlightedExampleFile(`${this.example}-example-html.html`),
69+
TS: this.resolveHighlightedExampleFile(`${this.example}-example-ts.html`),
70+
CSS: this.resolveHighlightedExampleFile(`${this.example}-example-css.html`),
7171
};
7272

7373
const additionalFiles = this.exampleData.additionalFiles || [];
@@ -76,7 +76,7 @@ export class ExampleViewer {
7676
// Since the additional files refer to the original file name, we need to transform
7777
// the file name to match the highlighted HTML file that displays the source.
7878
const fileSourceName = fileName.replace(fileExtensionRegex, '$1-$2.html');
79-
this.exampleTabs[fileName] = this.resolveExampleFile(fileSourceName);
79+
this.exampleTabs[fileName] = this.resolveHighlightedExampleFile(fileSourceName);
8080
});
8181
}
8282
}

src/app/shared/guide-items/guide-items.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,42 @@ const GUIDES = [
1010
{
1111
id: 'getting-started',
1212
name: 'Getting started',
13-
document: '/assets/documents/guides/material-getting-started.html',
13+
document: '/docs-content/guides/getting-started.html',
1414
},
1515
{
1616
id: 'schematics',
1717
name: 'Schematics',
18-
document: '/assets/documents/guides/material-schematics.html'
18+
document: '/docs-content/guides/schematics.html'
1919
},
2020
{
2121
id: 'theming',
2222
name: 'Theming Angular Material',
23-
document: '/assets/documents/guides/material-theming.html',
23+
document: '/docs-content/guides/theming.html',
2424
},
2525
{
2626
id: 'theming-your-components',
2727
name: 'Theming your own components',
28-
document: '/assets/documents/guides/material-theming-your-components.html',
28+
document: '/docs-content/guides/theming-your-components.html',
2929
},
3030
{
3131
id: 'typography',
3232
name: `Using Angular Material's Typography`,
33-
document: '/assets/documents/guides/material-typography.html',
33+
document: '/docs-content/guides/typography.html',
3434
},
3535
{
3636
id: 'customizing-component-styles',
3737
name: 'Customizing component styles',
38-
document: '/assets/documents/guides/material-customizing-component-styles.html'
38+
document: '/docs-content/guides/customizing-component-styles.html'
3939
},
4040
{
4141
id: 'creating-a-custom-form-field-control',
4242
name: 'Creating a custom form field control',
43-
document: '/assets/documents/guides/material-creating-a-custom-form-field-control.html'
43+
document: '/docs-content/guides/creating-a-custom-form-field-control.html'
4444
},
4545
{
4646
id: 'elevation',
4747
name: 'Using elevation helpers',
48-
document: '/assets/documents/guides/material-elevation.html'
48+
document: '/docs-content/guides/elevation.html'
4949
},
5050
];
5151

src/app/shared/stackblitz/stackblitz-writer.spec.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ describe('StackblitzWriter', () => {
2626
beforeEach(() => {
2727
stackblitzWriter = TestBed.get(StackblitzWriter);
2828
data = new ExampleData('');
29-
data.examplePath = 'http://material.angular.io/';
3029
data.exampleFiles = ['test.ts', 'test.html', 'src/detail.ts'];
3130
});
3231

@@ -104,10 +103,9 @@ describe('StackblitzWriter', () => {
104103
});
105104

106105
const FAKE_DOCS = {
107-
'http://material.angular.io/test.ts': 'ExampleComponent',
108-
'http://material.angular.io/test.html': `
109-
<example></example>`,
110-
'http://material.angular.io/src/detail.ts': 'DetailComponent',
106+
'/docs-content/examples-source/test.ts': 'ExampleComponent',
107+
'/docs-content/examples-source/test.html': `<example></example>`,
108+
'/docs-content/examples-source/src/detail.ts': 'DetailComponent',
111109
};
112110

113111
const TEST_URLS = [
@@ -117,7 +115,7 @@ const TEST_URLS = [
117115
'/assets/stackblitz/.angular-cli.json',
118116
'/assets/stackblitz/main.ts',
119117
'/assets/stackblitz/material-module.ts',
120-
'http://material.angular.io/test.ts',
121-
'http://material.angular.io/test.html',
122-
'http://material.angular.io/src/detail.ts',
118+
'/docs-content/examples-source/test.ts',
119+
'/docs-content/examples-source/test.html',
120+
'/docs-content/examples-source/src/detail.ts',
123121
];

src/app/shared/stackblitz/stackblitz-writer.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ const COPYRIGHT =
1212
Use of this source code is governed by an MIT-style license that
1313
can be found in the LICENSE file at http://angular.io/license`;
1414

15+
/**
16+
* Path that refers to the docs-content from the "@angular/material-examples" package. The
17+
* structure is defined in the Material repository, but we include the docs-content as assets in
18+
* in the CLI configuration.
19+
*/
20+
const DOCS_CONTENT_PATH = '/docs-content/examples-source/';
21+
1522
const TEMPLATE_PATH = '/assets/stackblitz/';
1623
const TEMPLATE_FILES = [
1724
'index.html',
@@ -88,7 +95,7 @@ export class StackblitzWriter {
8895
.map(file => this._readFile(form, data, file, TEMPLATE_PATH));
8996

9097
let exampleContents = data.exampleFiles
91-
.map(file => this._readFile(form, data, file, data.examplePath));
98+
.map(file => this._readFile(form, data, file, DOCS_CONTENT_PATH));
9299

93100
// TODO(josephperrott): Prevent including assets to be manually checked.
94101
if (data.selectorName === 'icon-svg-example') {

src/app/shared/table-of-contents/table-of-contents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class TableOfContents implements OnInit {
3131

3232
@Input() links: Link[] = [];
3333
@Input() container: string;
34-
@Input() headerSelectors = '.docs-markdown-h3,.docs-markdown-h4';
34+
@Input() headerSelectors = '.docs-markdown h3, .docs-markdown h4';
3535

3636
_rootUrl = this._router.url.split('#')[0];
3737
private _scrollContainer: any;

src/styles/_general.scss

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,13 @@ h1, h2 {
1515
padding-left: 20px;
1616

1717
h1 {
18-
font-size: 30px;
1918
font-weight: 300;
2019
margin: 0;
2120
padding: 28px 8px;
2221
font-size: 20px;
2322
}
2423
}
2524

26-
code {
27-
font-size: 90%;
28-
}
29-
30-
.docs-markdown-pre code {
31-
font-size: 100%;
32-
}
33-
3425
// These styles are for controlling SVGs without using the /deep/ selector
3526

3627
.docs-component-category-list-card-image svg {
@@ -53,3 +44,14 @@ code {
5344
vertical-align: middle;
5445
}
5546

47+
code, pre {
48+
font-family: 'Roboto Mono', monospace;
49+
}
50+
51+
code {
52+
font-size: 90%;
53+
}
54+
55+
pre {
56+
font-size: 14px;
57+
}

0 commit comments

Comments
 (0)