diff --git a/docs/README.md b/docs/README.md index 94f0597f862b..7ae7ea6d25ce 100644 --- a/docs/README.md +++ b/docs/README.md @@ -43,3 +43,15 @@ Run `pnpm bazel build //docs:build.production` to build the project. ## Running unit tests 1. Run `pnpm bazel test //docs/...` to execute the unit tests via [Karma](https://karma-runner.github.io). + +## Scenes Development server + +1. Run `pnpm bazel run //docs/scenes:build.serve` for a dev server. Navigate to `http://localhost:4200/`. + +# Build + +Run `pnpm bazel build //docs/scenes:build.production` to build the project. + +## Running unit tests + +1. Run `pnpm bazel test //docs/scenes/...` to execute the unit tests via [Karma](https://karma-runner.github.io). diff --git a/docs/angular.json b/docs/angular.json index 06d5462643e3..676de1bafb11 100644 --- a/docs/angular.json +++ b/docs/angular.json @@ -14,15 +14,16 @@ }, "architect": { "build": { - "builder": "@angular-devkit/build-angular:browser", + "builder": "@angular-devkit/build-angular:application", "options": { "sourceMap": true, + "preserveSymlinks": true, "allowedCommonJsDependencies": ["moment", "path-normalize"], "outputPath": "dist/material-angular-io", "index": "src/index.html", - "polyfills": "src/polyfills.ts", - "main": "src/main.ts", + "browser": "src/main.ts", "tsConfig": "tsconfig.app.json", + "polyfills": ["zone.js", "@angular/localize/init"], "assets": [ { "glob": "**/*", @@ -74,9 +75,7 @@ "includePaths": ["node_modules", "src", "src/styles"] }, "scripts": [], - "vendorChunk": true, "extractLicenses": false, - "buildOptimizer": false, "optimization": false, "namedChunks": true }, @@ -88,14 +87,11 @@ "maximumWarning": "6kb" } ], - "commonChunk": false, "optimization": true, "outputHashing": "all", "sourceMap": false, "namedChunks": false, "extractLicenses": true, - "vendorChunk": false, - "buildOptimizer": true, "fileReplacements": [ { "replace": "src/environments/environment.ts", @@ -130,7 +126,6 @@ "builder": "@angular-devkit/build-angular:karma", "options": { "main": "src/test.ts", - "polyfills": "src/polyfills.ts", "karmaConfig": "karma.conf.js", "tsConfig": "tsconfig.spec.json", "scripts": [], @@ -205,19 +200,18 @@ "prefix": "app", "architect": { "build": { - "builder": "@angular-devkit/build-angular:browser", + "builder": "@angular-devkit/build-angular:application", "options": { "outputPath": "dist/scenes", "index": "scenes/src/index.html", - "main": "scenes/src/main.ts", - "polyfills": "scenes/src/polyfills.ts", + "browser": "scenes/src/main.ts", + "polyfills": ["zone.js"], "tsConfig": "scenes/tsconfig.app.json", "assets": ["scenes/src/favicon.ico", "scenes/src/assets"], "styles": ["scenes/src/styles.scss"], "scripts": [], - "vendorChunk": true, "extractLicenses": false, - "buildOptimizer": false, + "preserveSymlinks": true, "sourceMap": true, "optimization": false, "namedChunks": true @@ -235,8 +229,6 @@ "sourceMap": false, "namedChunks": false, "extractLicenses": true, - "vendorChunk": false, - "buildOptimizer": true, "budgets": [ { "type": "initial", @@ -273,7 +265,6 @@ "builder": "@angular-devkit/build-angular:karma", "options": { "main": "scenes/src/test.ts", - "polyfills": "scenes/src/polyfills.ts", "tsConfig": "scenes/tsconfig.spec.json", "karmaConfig": "scenes/karma.conf.js", "assets": ["scenes/src/favicon.ico", "scenes/src/assets"], diff --git a/docs/package.json b/docs/package.json index 37fb0bb2c5ec..5294f768600d 100644 --- a/docs/package.json +++ b/docs/package.json @@ -19,9 +19,9 @@ "publish-prod": "bash ./tools/deploy.sh stable prod", "publish-dev": "bash ./tools/deploy.sh", "publish-beta": "bash ./tools/deploy.sh stable beta", - "test:audit:localhost": "node tools/audit-docs dist/material-angular-io", + "test:audit:localhost": "node tools/audit-docs dist/material-angular-io/browser", "test:audit:bazel": "node tools/audit-docs $(bazel cquery --output=files //:build.production)", - "test:audit:ci": "node tools/audit-docs ../dist/material-angular-io" + "test:audit:ci": "node tools/audit-docs ../dist/material-angular-io/browser" }, "engines": { "node": "^20.11.1 || >=22.0.0", diff --git a/docs/scenes/src/polyfills.ts b/docs/scenes/src/polyfills.ts deleted file mode 100644 index 0c70d917caeb..000000000000 --- a/docs/scenes/src/polyfills.ts +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.dev/license - */ - -/*************************************************************************************************** - * BROWSER POLYFILLS - */ - -/** IE10 and IE11 requires the following for NgClass support on SVG elements */ -// import 'classlist.js'; // Run `npm install --save classlist.js`. - -/** - * Web Animations `@angular/platform-browser/animations` - * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. - * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). - */ -// import 'web-animations-js'; // Run `npm install --save web-animations-js`. - -/** - * By default, zone.js will patch all possible macroTask and DomEvents - * user can disable parts of macroTask/DomEvents patch by setting following flags - * because those flags need to be set before `zone.js` being loaded, and webpack - * will put import in the top of bundle, so user need to create a separate file - * in this directory (for example: zone-flags.ts), and put the following flags - * into that file, and then add the following code before importing zone.js. - * import './zone-flags'; - * - * The flags allowed in zone-flags.ts are listed here. - * - * The following flags will work for all browsers. - * - * (window as any).__Zone_disable_requestAnimationFrame = true; - * // disable patch requestAnimationFrame - * (window as any).__Zone_disable_on_property = true; - * // disable patch onProperty such as onclick - * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; - * // disable patch specified eventNames - * - * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js - * with the following flag, it will bypass `zone.js` patch for IE/Edge - * - * (window as any).__Zone_enable_cross_context_check = true; - * - */ - -/*************************************************************************************************** - * Zone JS is required by default for Angular itself. - */ -import 'zone.js'; // Included with Angular CLI. - -/*************************************************************************************************** - * APPLICATION IMPORTS - */ diff --git a/docs/scenes/src/test.ts b/docs/scenes/src/test.ts index 861e0e73f3d4..df86e5ac1ae0 100644 --- a/docs/scenes/src/test.ts +++ b/docs/scenes/src/test.ts @@ -8,6 +8,7 @@ // This file is required by karma.conf.js and loads recursively all the .spec and framework files +import 'zone.js'; import 'zone.js/testing'; import {getTestBed} from '@angular/core/testing'; import {BrowserTestingModule, platformBrowserTesting} from '@angular/platform-browser/testing'; diff --git a/docs/scenes/tsconfig.app.json b/docs/scenes/tsconfig.app.json index 2e8cbcc4aa6d..c501472bda7d 100644 --- a/docs/scenes/tsconfig.app.json +++ b/docs/scenes/tsconfig.app.json @@ -4,6 +4,6 @@ "outDir": "../../out-tsc/app", "types": [] }, - "files": ["src/main.ts", "src/polyfills.ts"], + "files": ["src/main.ts"], "include": ["src/**/*.d.ts"] } diff --git a/docs/scenes/tsconfig.spec.json b/docs/scenes/tsconfig.spec.json index 50e52a04a0a1..1c3e3ac20542 100644 --- a/docs/scenes/tsconfig.spec.json +++ b/docs/scenes/tsconfig.spec.json @@ -4,6 +4,6 @@ "outDir": "../../out-tsc/spec", "types": ["jasmine", "node"] }, - "files": ["src/test.ts", "src/polyfills.ts"], + "files": ["src/test.ts"], "include": ["src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/docs/src/app/shared/normalize-path.ts b/docs/src/app/shared/normalize-path.ts index b38c45bed941..0b97c5c86b8e 100644 --- a/docs/src/app/shared/normalize-path.ts +++ b/docs/src/app/shared/normalize-path.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.dev/license */ -import * as normalize from 'path-normalize'; +import normalize from 'path-normalize'; /** * Normalizes the given path by: diff --git a/docs/src/assets/stack-blitz/angular.json b/docs/src/assets/stack-blitz/angular.json index 17f8ee732968..1f72421563cf 100644 --- a/docs/src/assets/stack-blitz/angular.json +++ b/docs/src/assets/stack-blitz/angular.json @@ -21,12 +21,12 @@ "prefix": "app", "architect": { "build": { - "builder": "@angular-devkit/build-angular:browser", + "builder": "@angular-devkit/build-angular:application", "options": { "outputPath": "dist/example-app", "index": "src/index.html", - "main": "src/main.ts", - "polyfills": ["zone.js"], + "browser": "src/main.ts", + "polyfills": ["zone.js", "@angular/localize/init"], "tsConfig": "tsconfig.app.json", "inlineStyleLanguage": "scss", "assets": ["src/assets"], @@ -59,9 +59,7 @@ "outputHashing": "all" }, "development": { - "buildOptimizer": false, "optimization": false, - "vendorChunk": true, "extractLicenses": false, "sourceMap": true, "namedChunks": true diff --git a/docs/src/assets/stack-blitz/src/main.ts b/docs/src/assets/stack-blitz/src/main.ts index abe21765e701..d31ab0acc4f3 100644 --- a/docs/src/assets/stack-blitz/src/main.ts +++ b/docs/src/assets/stack-blitz/src/main.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.dev/license */ -import '@angular/localize/init'; import {bootstrapApplication} from '@angular/platform-browser'; import {provideHttpClient} from '@angular/common/http'; import {provideAnimations} from '@angular/platform-browser/animations'; diff --git a/docs/src/polyfills.ts b/docs/src/polyfills.ts deleted file mode 100644 index 0a38489252c7..000000000000 --- a/docs/src/polyfills.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.dev/license - */ - -/*************************************************************************************************** - * BROWSER POLYFILLS - */ - -/** IE10 and IE11 requires the following for NgClass support on SVG elements */ -// import 'classlist.js'; // Run `npm install --save classlist.js`. - -/** - * Web Animations `@angular/platform-browser/animations` - * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. - * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). - */ -// import 'web-animations-js'; // Run `npm install --save web-animations-js`. - -/** - * By default, zone.js will patch all possible macroTask and DomEvents - * user can disable parts of macroTask/DomEvents patch by setting following flags - * because those flags need to be set before `zone.js` being loaded, and webpack - * will put import in the top of bundle, so user need to create a separate file - * in this directory (for example: zone-flags.ts), and put the following flags - * into that file, and then add the following code before importing zone.js. - * import './zone-flags.ts'; - * - * The flags allowed in zone-flags.ts are listed here. - * - * The following flags will work for all browsers. - * - * // disable patch requestAnimationFrame - * (window as any).__Zone_disable_requestAnimationFrame = true; - * // disable patch onProperty such as onclick - * (window as any).__Zone_disable_on_property = true; - * // disable patch specified eventNames - * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; - * - * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js - * with the following flag, it will bypass `zone.js` patch for IE/Edge - * - * (window as any).__Zone_enable_cross_context_check = true; - * - */ - -/*************************************************************************************************** - * Zone JS is required by default for Angular itself. - */ -import 'zone.js'; // Included with Angular CLI. - -/*************************************************************************************************** - * APPLICATION IMPORTS - */ - -// Examples might use `$localize`, so we initialize the localize package. Note that we do not -// intend to load any translations at runtime. `$localize` has a pass-through mode where it does -// not actually translate content. This is what we want to use for our examples. -import '@angular/localize/init'; diff --git a/docs/src/test.ts b/docs/src/test.ts index 861e0e73f3d4..df86e5ac1ae0 100644 --- a/docs/src/test.ts +++ b/docs/src/test.ts @@ -8,6 +8,7 @@ // This file is required by karma.conf.js and loads recursively all the .spec and framework files +import 'zone.js'; import 'zone.js/testing'; import {getTestBed} from '@angular/core/testing'; import {BrowserTestingModule, platformBrowserTesting} from '@angular/platform-browser/testing'; diff --git a/docs/tools/audit-docs.js b/docs/tools/audit-docs.js index e87a1bb28926..df206e8df42e 100644 --- a/docs/tools/audit-docs.js +++ b/docs/tools/audit-docs.js @@ -26,6 +26,7 @@ const sh = require('shelljs'); sh.set('-e'); const lightServer = require('light-server'); +const path = require('path'); // Constants @@ -97,7 +98,7 @@ if (!/https?:\/\//.test(urlOrDeployDir)) { lightServer({ port, bind, - serve: urlOrDeployDir, + serve: path.join(urlOrDeployDir, 'browser'), quiet: true, noReload: true, historyindex: '/index.html', diff --git a/docs/tsconfig.app.json b/docs/tsconfig.app.json index 29f5f5864eb6..5b9d3c5ecb0b 100644 --- a/docs/tsconfig.app.json +++ b/docs/tsconfig.app.json @@ -4,6 +4,6 @@ "outDir": "./out-tsc/app", "types": [] }, - "files": ["src/main.ts", "src/polyfills.ts"], + "files": ["src/main.ts"], "include": ["src/**/*.d.ts"] } diff --git a/docs/tsconfig.json b/docs/tsconfig.json index feb629395784..0e7c0a779167 100644 --- a/docs/tsconfig.json +++ b/docs/tsconfig.json @@ -4,6 +4,7 @@ "baseUrl": "./", "outDir": "../dist/out-tsc", "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true, "sourceMap": true, "declaration": false, "downlevelIteration": true, diff --git a/docs/tsconfig.spec.json b/docs/tsconfig.spec.json index 430cf757cee7..1030a83cf2e6 100644 --- a/docs/tsconfig.spec.json +++ b/docs/tsconfig.spec.json @@ -4,6 +4,6 @@ "outDir": "./out-tsc/spec", "types": ["jasmine", "node"] }, - "files": ["src/test.ts", "src/polyfills.ts"], + "files": ["src/test.ts"], "include": ["src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/scripts/docs-deploy/utils.mts b/scripts/docs-deploy/utils.mts index 5efeee912afe..332df7d592b2 100644 --- a/scripts/docs-deploy/utils.mts +++ b/scripts/docs-deploy/utils.mts @@ -55,6 +55,5 @@ export async function buildDocsSite() { await $`pnpm bazel build --config=snapshot-build //docs:build.production`; await $`rm -Rf docs/dist`; await $`mkdir -p docs/dist`; - await $`cp -R dist/bin/docs/material-angular-io.production docs/dist`; - await $`chmod -R u+w docs/dist/material-angular-io.production`; + await $`cp -R dist/bin/docs/dist/browser docs/dist`; }