Skip to content

Commit

Permalink
chore: 🤖 add back the transformer
Browse files Browse the repository at this point in the history
  • Loading branch information
shaharkazaz committed Jan 5, 2025
1 parent 58bf87d commit 2bf3ace
Show file tree
Hide file tree
Showing 11 changed files with 17,276 additions and 24,644 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy-demo-app.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
run: ORIGIN='https://jsverse.github.io/transloco/' 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
13 changes: 13 additions & 0 deletions apps/transloco-playground/index-html-transform.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Target } from '@angular-devkit/architect';
import * as cheerio from 'cheerio';

export default (_: Target, indexHtml: string) => {
if (!process.env.ORIGIN) {
return indexHtml;
}

const $ = cheerio.load(indexHtml);
$('base').attr('href', process.env.ORIGIN);

return $.html();
};
12 changes: 11 additions & 1 deletion apps/transloco-playground/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"prefix": "transloco-nx-shell",
"targets": {
"build": {
"executor": "@nx/angular:browser-esbuild",
"executor": "@nx/angular:webpack-browser",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/transloco-playground",
Expand Down Expand Up @@ -36,6 +36,16 @@
],
"outputHashing": "all"
},
"docs": {
"fileReplacements": [
{
"replace": "apps/transloco-playground/src/environments/environment.ts",
"with": "apps/transloco-playground/src/environments/environment.docs.ts"
}
],
"indexHtmlTransformer": "apps/transloco-playground/index-html-transform.ts",
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
Expand Down
1 change: 0 additions & 1 deletion apps/transloco-playground/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];

Expand Down
1 change: 0 additions & 1 deletion apps/transloco-playground/src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { environment } from '../../environments/environment';
imports: [TranslocoModule],
})
export class HomeComponent {
isDocs = environment.isDocs;
dynamic = '🦄';
key = 'home';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const environment = {
production: true,
baseUrl: `/transloco`,
isDocs: true,
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export const environment = {
production: true,
baseUrl: '',
isDocs: false,
};
1 change: 0 additions & 1 deletion apps/transloco-playground/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
export const environment = {
production: false,
baseUrl: '',
isDocs: false,
};

/*
Expand Down
Loading

0 comments on commit 2bf3ace

Please sign in to comment.