diff --git a/.github/actions/step-setup/action.yml b/.github/actions/step-setup/action.yml index c555a538..8b8fad0e 100644 --- a/.github/actions/step-setup/action.yml +++ b/.github/actions/step-setup/action.yml @@ -10,5 +10,5 @@ runs: cache: npm - name: Install dependencies - run: npm i + run: npm ci shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db5e402d..370a0d23 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - target: ['ci:build', 'ci:test', 'ci:lint', 'ci:e2e', 'build docs'] + target: ['ci:build', 'ci:test', 'ci:lint', 'ci:e2e'] runs-on: ubuntu-latest name: ${{ matrix.target }} steps: diff --git a/.github/workflows/deploy-demo-app.yml b/.github/workflows/deploy-demo-app.yml index 00d594e1..8f04bb41 100644 --- a/.github/workflows/deploy-demo-app.yml +++ b/.github/workflows/deploy-demo-app.yml @@ -1,5 +1,5 @@ # Simple workflow for deploying static content to GitHub Pages -name: Deploy static content to Pages +name: Deploy playground to Pages on: # Runs on pushes targeting the default branch @@ -34,19 +34,19 @@ jobs: - name: Setup uses: ./.github/actions/step-setup - + - name: Setup Pages uses: actions/configure-pages@v5 - name: Build playground run: npm run build:playground - + - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: # Upload entire repository path: 'dist/apps/transloco-playground' - + - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 diff --git a/apps/transloco-playground/index-html-transform.ts b/apps/transloco-playground/index-html-transform.ts new file mode 100644 index 00000000..75830440 --- /dev/null +++ b/apps/transloco-playground/index-html-transform.ts @@ -0,0 +1,9 @@ +import { Target } from '@angular-devkit/architect'; +import * as cheerio from 'cheerio'; + +export default (targetOptions: Target, indexHtml: string) => { + const $ = cheerio.load(indexHtml); + $('base').attr('href', process.env.ORIGIN + '/transloco/'); + + return $.html(); +}; diff --git a/apps/transloco-playground/project.json b/apps/transloco-playground/project.json index fd705cbc..9a8e2ed0 100644 --- a/apps/transloco-playground/project.json +++ b/apps/transloco-playground/project.json @@ -36,6 +36,10 @@ ], "outputHashing": "all" }, + "docs": { + "indexHtmlTransformer": "apps/transloco-playground/index-html-transform.ts", + "outputHashing": "all" + }, "development": { "buildOptimizer": false, "optimization": false, diff --git a/apps/transloco-playground/src/app/app.component.ts b/apps/transloco-playground/src/app/app.component.ts index 702ade48..86886ec9 100644 --- a/apps/transloco-playground/src/app/app.component.ts +++ b/apps/transloco-playground/src/app/app.component.ts @@ -16,7 +16,6 @@ import { environment } from '../environments/environment'; }) export class AppComponent { private destroyRef = inject(DestroyRef); - isDocs = environment.isDocs; service = inject(TranslocoService); availableLangs = this.service.getAvailableLangs() as LangDefinition[]; diff --git a/apps/transloco-playground/src/app/home/home.component.ts b/apps/transloco-playground/src/app/home/home.component.ts index 6cc9cb36..528c16c0 100644 --- a/apps/transloco-playground/src/app/home/home.component.ts +++ b/apps/transloco-playground/src/app/home/home.component.ts @@ -13,7 +13,6 @@ import { environment } from '../../environments/environment'; imports: [TranslocoModule], }) export class HomeComponent { - isDocs = environment.isDocs; dynamic = '🦄'; key = 'home'; diff --git a/apps/transloco-playground/src/environments/environment.prod.ts b/apps/transloco-playground/src/environments/environment.prod.ts index 18028948..fb4a7bd2 100644 --- a/apps/transloco-playground/src/environments/environment.prod.ts +++ b/apps/transloco-playground/src/environments/environment.prod.ts @@ -1,5 +1,4 @@ export const environment = { production: true, baseUrl: '', - isDocs: false, }; diff --git a/apps/transloco-playground/src/environments/environment.ts b/apps/transloco-playground/src/environments/environment.ts index fe77cdfd..55dad31d 100644 --- a/apps/transloco-playground/src/environments/environment.ts +++ b/apps/transloco-playground/src/environments/environment.ts @@ -5,7 +5,6 @@ export const environment = { production: false, baseUrl: '', - isDocs: false, }; /* diff --git a/package.json b/package.json index 205daf0e..0c564edd 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "commit": "git-cz", "start": "nx run transloco-playground:serve", "build": "node scripts/build.mjs", - "build:playground": "nx build transloco-playground", + "build:playground": "nx build transloco-playground --configuration=docs", "ci:test": "nx run-many --target=test --all", "ci:build": "nx run-many --target=build --all", "ci:lint": "nx run-many --target=lint --all",