Skip to content

Commit c068fa2

Browse files
committed
chore: 🤖 add back the transformer
1 parent 58bf87d commit c068fa2

14 files changed

+17295
-24648
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
target: ['ci:build', 'ci:test', 'ci:lint', 'ci:e2e', 'build docs']
14+
target: ['ci:build', 'ci:test', 'ci:lint', 'ci:e2e']
1515
runs-on: ubuntu-latest
1616
name: ${{ matrix.target }}
1717
steps:

.github/workflows/deploy-demo-app.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Simple workflow for deploying static content to GitHub Pages
2-
name: Deploy static content to Pages
2+
name: Deploy playground to Pages
33

44
on:
55
# Runs on pushes targeting the default branch
@@ -34,19 +34,19 @@ jobs:
3434

3535
- name: Setup
3636
uses: ./.github/actions/step-setup
37-
37+
3838
- name: Setup Pages
3939
uses: actions/configure-pages@v5
4040

4141
- name: Build playground
42-
run: npm run build:playground
43-
42+
run: ORIGIN='https://jsverse.github.io/transloco/' npm run build:playground
43+
4444
- name: Upload artifact
4545
uses: actions/upload-pages-artifact@v3
4646
with:
4747
# Upload entire repository
4848
path: 'dist/apps/transloco-playground'
49-
49+
5050
- name: Deploy to GitHub Pages
5151
id: deployment
5252
uses: actions/deploy-pages@v4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Target } from '@angular-devkit/architect';
2+
import * as cheerio from 'cheerio';
3+
4+
export default (_: Target, indexHtml: string) => {
5+
if (!process.env.ORIGIN) {
6+
return indexHtml;
7+
}
8+
9+
const $ = cheerio.load(indexHtml);
10+
$('base').attr('href', process.env.ORIGIN);
11+
12+
return $.html();
13+
};

apps/transloco-playground/project.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"prefix": "transloco-nx-shell",
77
"targets": {
88
"build": {
9-
"executor": "@nx/angular:browser-esbuild",
9+
"executor": "@nx/angular:webpack-browser",
1010
"outputs": ["{options.outputPath}"],
1111
"options": {
1212
"outputPath": "dist/apps/transloco-playground",
@@ -36,6 +36,16 @@
3636
],
3737
"outputHashing": "all"
3838
},
39+
"docs": {
40+
"fileReplacements": [
41+
{
42+
"replace": "apps/transloco-playground/src/environments/environment.ts",
43+
"with": "apps/transloco-playground/src/environments/environment.docs.ts"
44+
}
45+
],
46+
"indexHtmlTransformer": "apps/transloco-playground/index-html-transform.ts",
47+
"outputHashing": "all"
48+
},
3949
"development": {
4050
"buildOptimizer": false,
4151
"optimization": false,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Directive, ElementRef, inject, input, OnInit } from '@angular/core';
2+
3+
import { environment } from '../environments/environment';
4+
5+
@Directive({
6+
selector: 'img[appSrc]',
7+
standalone: true,
8+
})
9+
export class AppSrcDirective implements OnInit {
10+
host = inject(ElementRef).nativeElement as HTMLImageElement;
11+
appSrc = input<string>();
12+
13+
ngOnInit() {
14+
this.host.src = `${environment.baseUrl}${this.appSrc()}`;
15+
}
16+
}

apps/transloco-playground/src/app/app.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
target="_blank"
66
href="https://jsverse.gitbook.io/transloco/"
77
>
8-
<img height="50px" src="/assets/images/logo.svg" />
8+
<img height="50px" appSrc="assets/images/logo.svg" />
99
</a>
1010
<button
1111
class="navbar-toggler"

apps/transloco-playground/src/app/app.component.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
55

66
import { LangDefinition, TranslocoService } from '@jsverse/transloco';
77

8-
import { environment } from '../environments/environment';
8+
import { AppSrcDirective } from './app-src.directive';
99

1010
@Component({
1111
selector: 'app-root',
1212
templateUrl: './app.component.html',
1313
styleUrls: ['./app.component.scss'],
1414
standalone: true,
15-
imports: [RouterModule],
15+
imports: [RouterModule, AppSrcDirective],
1616
})
1717
export class AppComponent {
1818
private destroyRef = inject(DestroyRef);
19-
isDocs = environment.isDocs;
2019
service = inject(TranslocoService);
2120
availableLangs = this.service.getAvailableLangs() as LangDefinition[];
2221

apps/transloco-playground/src/app/home/home.component.ts

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { environment } from '../../environments/environment';
1313
imports: [TranslocoModule],
1414
})
1515
export class HomeComponent {
16-
isDocs = environment.isDocs;
1716
dynamic = '🦄';
1817
key = 'home';
1918

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const environment = {
2+
production: true,
3+
baseUrl: `/transloco`,
4+
};
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export const environment = {
22
production: true,
33
baseUrl: '',
4-
isDocs: false,
54
};

apps/transloco-playground/src/environments/environment.ts

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
export const environment = {
66
production: false,
77
baseUrl: '',
8-
isDocs: false,
98
};
109

1110
/*

apps/transloco-playground/src/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<base href="/" />
77

88
<meta name="viewport" content="width=device-width, initial-scale=1" />
9-
<link rel="icon" type="image/x-icon" href="favicon.ico" />
9+
<link rel="icon" href="assets/images/logo.svg" />
1010
<link
1111
href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
1212
rel="stylesheet"

0 commit comments

Comments
 (0)