diff --git a/.gitignore b/.gitignore index a311b0fe..85164acc 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,5 @@ ui-debug.log #System Files .DS_Store Thumbs.db + +/material-cn-prebuilt diff --git a/package.json b/package.json index db04a03e..7683c92e 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,8 @@ "@angular-eslint/template-parser": "^13.1.0", "@angular/cli": "^14.0.0", "@angular/compiler-cli": "^14.0.0", + "@awesome-fe/prerender": "^0.0.8", + "@awesome-fe/translate": "^1.1.3", "@types/imagemin": "^7.0.0", "@types/jasmine": "^3.7.7", "@types/node": "^14.14.22", @@ -78,6 +80,7 @@ "eslint-plugin-jsdoc": "^32.3.0", "eslint-plugin-prefer-arrow": "^1.2.3", "firebase-tools": "^11.0.1", + "http-server-spa": "^1.3.0", "imagemin": "^7.0.1", "imagemin-pngquant": "^9.0.2", "jasmine-core": "^3.7.1", diff --git a/scenes/tslint.json b/scenes/tslint.json new file mode 100644 index 00000000..aa7c3eeb --- /dev/null +++ b/scenes/tslint.json @@ -0,0 +1,17 @@ +{ + "extends": "../tslint.json", + "rules": { + "directive-selector": [ + true, + "attribute", + "app", + "camelCase" + ], + "component-selector": [ + true, + "element", + "app", + "kebab-case" + ] + } +} diff --git a/scripts/ci/deploy-cn.sh b/scripts/ci/deploy-cn.sh new file mode 100755 index 00000000..0f4a94dc --- /dev/null +++ b/scripts/ci/deploy-cn.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -e +set -x + +yarn build:content + +yarn prod-build + +npx nt mark './dist/**/*.html' + +commitSha=$(git rev-parse --short HEAD) +commitMessage=$(git log --oneline -n 1) + +if [[ ! -d "./material-cn-prebuilt" ]]; then + git clone git@github.com:ng-docs/git@github.com:ng-docs/material-cn-prebuilt.git +fi + +cp -r ./dist/material-angular-io/* ./material-cn-prebuilt + +cd ./material-cn-prebuilt + +cp index.html 404.html + +git add . +git commit --allow-empty -am "${commitMessage}" || true + +git push prebuilt HEAD:master + +cd - diff --git a/src/app/app-module.ts b/src/app/app-module.ts index 161200c8..8946b403 100644 --- a/src/app/app-module.ts +++ b/src/app/app-module.ts @@ -1,6 +1,6 @@ import {BrowserModule} from '@angular/platform-browser'; import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; -import {NgModule} from '@angular/core'; +import {APP_ID, NgModule} from '@angular/core'; import {LocationStrategy, PathLocationStrategy} from '@angular/common'; import {RouterModule} from '@angular/router'; @@ -14,18 +14,22 @@ const prefersReducedMotion = typeof matchMedia === 'function' ? @NgModule({ imports: [ - BrowserModule, + BrowserModule.withServerTransition({appId: 'material-docs'}), BrowserAnimationsModule.withConfig({disableAnimations: prefersReducedMotion}), RouterModule.forRoot(MATERIAL_DOCS_ROUTES, { scrollPositionRestoration: 'enabled', anchorScrolling: 'enabled', - relativeLinkResolution: 'corrected' + relativeLinkResolution: 'corrected', }), NavBarModule, CookiePopupModule, ], declarations: [MaterialDocsApp], - providers: [{provide: LocationStrategy, useClass: PathLocationStrategy}], + providers: [ + {provide: LocationStrategy, useClass: PathLocationStrategy}, + {provide: APP_ID, useFactory: () => 'material-docs'}, + ], bootstrap: [MaterialDocsApp], }) -export class AppModule {} +export class AppModule { +} diff --git a/src/app/pages/component-category-list/component-category-list.html b/src/app/pages/component-category-list/component-category-list.html index 3aa52c68..1906a439 100644 --- a/src/app/pages/component-category-list/component-category-list.html +++ b/src/app/pages/component-category-list/component-category-list.html @@ -15,8 +15,8 @@ alt="" role="presentation" aria-hidden="true"> -