Skip to content

Commit f4b7afe

Browse files
crisbetodevversion
authored andcommitted
build: switch docs site to application builder
Switches the docs site to use the `application` builder which should be faster than the existing one.
1 parent e5ea9fe commit f4b7afe

File tree

17 files changed

+36
-152
lines changed

17 files changed

+36
-152
lines changed

docs/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,15 @@ Run `pnpm bazel build //docs:build.production` to build the project.
4343
## Running unit tests
4444

4545
1. Run `pnpm bazel test //docs/...` to execute the unit tests via [Karma](https://karma-runner.github.io).
46+
47+
## Scenes Development server
48+
49+
1. Run `pnpm bazel run //docs/scenes:build.serve` for a dev server. Navigate to `http://localhost:4200/`.
50+
51+
# Build
52+
53+
Run `pnpm bazel build //docs/scenes:build.production` to build the project.
54+
55+
## Running unit tests
56+
57+
1. Run `pnpm bazel test //docs/scenes/...` to execute the unit tests via [Karma](https://karma-runner.github.io).

docs/angular.json

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@
1414
},
1515
"architect": {
1616
"build": {
17-
"builder": "@angular-devkit/build-angular:browser",
17+
"builder": "@angular-devkit/build-angular:application",
1818
"options": {
1919
"sourceMap": true,
20+
"preserveSymlinks": true,
2021
"allowedCommonJsDependencies": ["moment", "path-normalize"],
2122
"outputPath": "dist/material-angular-io",
2223
"index": "src/index.html",
23-
"polyfills": "src/polyfills.ts",
24-
"main": "src/main.ts",
24+
"browser": "src/main.ts",
2525
"tsConfig": "tsconfig.app.json",
26+
"polyfills": ["zone.js", "@angular/localize/init"],
2627
"assets": [
2728
{
2829
"glob": "**/*",
@@ -74,9 +75,7 @@
7475
"includePaths": ["node_modules", "src", "src/styles"]
7576
},
7677
"scripts": [],
77-
"vendorChunk": true,
7878
"extractLicenses": false,
79-
"buildOptimizer": false,
8079
"optimization": false,
8180
"namedChunks": true
8281
},
@@ -88,14 +87,11 @@
8887
"maximumWarning": "6kb"
8988
}
9089
],
91-
"commonChunk": false,
9290
"optimization": true,
9391
"outputHashing": "all",
9492
"sourceMap": false,
9593
"namedChunks": false,
9694
"extractLicenses": true,
97-
"vendorChunk": false,
98-
"buildOptimizer": true,
9995
"fileReplacements": [
10096
{
10197
"replace": "src/environments/environment.ts",
@@ -130,7 +126,6 @@
130126
"builder": "@angular-devkit/build-angular:karma",
131127
"options": {
132128
"main": "src/test.ts",
133-
"polyfills": "src/polyfills.ts",
134129
"karmaConfig": "karma.conf.js",
135130
"tsConfig": "tsconfig.spec.json",
136131
"scripts": [],
@@ -205,19 +200,18 @@
205200
"prefix": "app",
206201
"architect": {
207202
"build": {
208-
"builder": "@angular-devkit/build-angular:browser",
203+
"builder": "@angular-devkit/build-angular:application",
209204
"options": {
210205
"outputPath": "dist/scenes",
211206
"index": "scenes/src/index.html",
212-
"main": "scenes/src/main.ts",
213-
"polyfills": "scenes/src/polyfills.ts",
207+
"browser": "scenes/src/main.ts",
208+
"polyfills": ["zone.js"],
214209
"tsConfig": "scenes/tsconfig.app.json",
215210
"assets": ["scenes/src/favicon.ico", "scenes/src/assets"],
216211
"styles": ["scenes/src/styles.scss"],
217212
"scripts": [],
218-
"vendorChunk": true,
219213
"extractLicenses": false,
220-
"buildOptimizer": false,
214+
"preserveSymlinks": true,
221215
"sourceMap": true,
222216
"optimization": false,
223217
"namedChunks": true
@@ -235,8 +229,6 @@
235229
"sourceMap": false,
236230
"namedChunks": false,
237231
"extractLicenses": true,
238-
"vendorChunk": false,
239-
"buildOptimizer": true,
240232
"budgets": [
241233
{
242234
"type": "initial",
@@ -273,7 +265,6 @@
273265
"builder": "@angular-devkit/build-angular:karma",
274266
"options": {
275267
"main": "scenes/src/test.ts",
276-
"polyfills": "scenes/src/polyfills.ts",
277268
"tsConfig": "scenes/tsconfig.spec.json",
278269
"karmaConfig": "scenes/karma.conf.js",
279270
"assets": ["scenes/src/favicon.ico", "scenes/src/assets"],

docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
"publish-prod": "bash ./tools/deploy.sh stable prod",
2020
"publish-dev": "bash ./tools/deploy.sh",
2121
"publish-beta": "bash ./tools/deploy.sh stable beta",
22-
"test:audit:localhost": "node tools/audit-docs dist/material-angular-io",
22+
"test:audit:localhost": "node tools/audit-docs dist/material-angular-io/browser",
2323
"test:audit:bazel": "node tools/audit-docs $(bazel cquery --output=files //:build.production)",
24-
"test:audit:ci": "node tools/audit-docs ../dist/material-angular-io"
24+
"test:audit:ci": "node tools/audit-docs ../dist/material-angular-io/browser"
2525
},
2626
"engines": {
2727
"node": "^20.11.1 || >=22.0.0",

docs/scenes/src/polyfills.ts

Lines changed: 0 additions & 57 deletions
This file was deleted.

docs/scenes/src/test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
1010

11+
import 'zone.js';
1112
import 'zone.js/testing';
1213
import {getTestBed} from '@angular/core/testing';
1314
import {BrowserTestingModule, platformBrowserTesting} from '@angular/platform-browser/testing';

docs/scenes/tsconfig.app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"outDir": "../../out-tsc/app",
55
"types": []
66
},
7-
"files": ["src/main.ts", "src/polyfills.ts"],
7+
"files": ["src/main.ts"],
88
"include": ["src/**/*.d.ts"]
99
}

docs/scenes/tsconfig.spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"outDir": "../../out-tsc/spec",
55
"types": ["jasmine", "node"]
66
},
7-
"files": ["src/test.ts", "src/polyfills.ts"],
7+
"files": ["src/test.ts"],
88
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
99
}

docs/src/app/shared/normalize-path.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import * as normalize from 'path-normalize';
9+
import normalize from 'path-normalize';
1010

1111
/**
1212
* Normalizes the given path by:

docs/src/assets/stack-blitz/angular.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
"prefix": "app",
2222
"architect": {
2323
"build": {
24-
"builder": "@angular-devkit/build-angular:browser",
24+
"builder": "@angular-devkit/build-angular:application",
2525
"options": {
2626
"outputPath": "dist/example-app",
2727
"index": "src/index.html",
28-
"main": "src/main.ts",
29-
"polyfills": ["zone.js"],
28+
"browser": "src/main.ts",
29+
"polyfills": ["zone.js", "@angular/localize/init"],
3030
"tsConfig": "tsconfig.app.json",
3131
"inlineStyleLanguage": "scss",
3232
"assets": ["src/assets"],
@@ -59,9 +59,7 @@
5959
"outputHashing": "all"
6060
},
6161
"development": {
62-
"buildOptimizer": false,
6362
"optimization": false,
64-
"vendorChunk": true,
6563
"extractLicenses": false,
6664
"sourceMap": true,
6765
"namedChunks": true

docs/src/assets/stack-blitz/src/main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import '@angular/localize/init';
109
import {bootstrapApplication} from '@angular/platform-browser';
1110
import {provideHttpClient} from '@angular/common/http';
1211
import {provideAnimations} from '@angular/platform-browser/animations';

docs/src/polyfills.ts

Lines changed: 0 additions & 62 deletions
This file was deleted.

docs/src/test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
1010

11+
import 'zone.js';
1112
import 'zone.js/testing';
1213
import {getTestBed} from '@angular/core/testing';
1314
import {BrowserTestingModule, platformBrowserTesting} from '@angular/platform-browser/testing';

docs/tools/audit-docs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const sh = require('shelljs');
2626
sh.set('-e');
2727

2828
const lightServer = require('light-server');
29+
const path = require('path');
2930

3031
// Constants
3132

@@ -97,7 +98,7 @@ if (!/https?:\/\//.test(urlOrDeployDir)) {
9798
lightServer({
9899
port,
99100
bind,
100-
serve: urlOrDeployDir,
101+
serve: path.join(urlOrDeployDir, 'browser'),
101102
quiet: true,
102103
noReload: true,
103104
historyindex: '/index.html',

docs/tsconfig.app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"outDir": "./out-tsc/app",
55
"types": []
66
},
7-
"files": ["src/main.ts", "src/polyfills.ts"],
7+
"files": ["src/main.ts"],
88
"include": ["src/**/*.d.ts"]
99
}

docs/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"baseUrl": "./",
55
"outDir": "../dist/out-tsc",
66
"forceConsistentCasingInFileNames": true,
7+
"allowSyntheticDefaultImports": true,
78
"sourceMap": true,
89
"declaration": false,
910
"downlevelIteration": true,

docs/tsconfig.spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"outDir": "./out-tsc/spec",
55
"types": ["jasmine", "node"]
66
},
7-
"files": ["src/test.ts", "src/polyfills.ts"],
7+
"files": ["src/test.ts"],
88
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
99
}

scripts/docs-deploy/utils.mts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,5 @@ export async function buildDocsSite() {
5555
await $`pnpm bazel build --config=snapshot-build //docs:build.production`;
5656
await $`rm -Rf docs/dist`;
5757
await $`mkdir -p docs/dist`;
58-
await $`cp -R dist/bin/docs/material-angular-io.production docs/dist`;
59-
await $`chmod -R u+w docs/dist/material-angular-io.production`;
58+
await $`cp -R dist/bin/docs/dist/browser docs/dist`;
6059
}

0 commit comments

Comments
 (0)