Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Enable Brand Theme in Angular Starter
run: |
cd ./apps/angular-starter
sed -i "s/BRAND_THEME: false/BRAND_THEME: true/" src/environments/environments.ts
sed -i "s/BRAND_THEME: false/BRAND_THEME: true/" src/environments/environment.ts

- name: Build Angular Starter
run: pnpm --filter ix-angular-starter run build --base-href /ix-starter/angular-starter/
Expand Down
47 changes: 39 additions & 8 deletions apps/angular-starter/scripts/copy-theme.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,44 @@
import fs from "fs-extra";
import path from "path";
import { fileURLToPath } from "url";

try {
const themePackage = import.meta.resolve("@siemens-ix/corporate-theme");
const theme = path.join(themePackage, "..", "..");
fs.copySync(theme, path.join(__dirname, "../src/assets/theme"), {
filter: (src) => !src.includes("corporate-theme-alternative/node_modules"),
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const THEME_PACKAGE = "@siemens-ix/corporate-theme";
const TARGET_DIR = path.join(__dirname, "../src/assets/theme");

function findThemePackage() {
const searchPaths = [
path.join(__dirname, "../../../node_modules", THEME_PACKAGE),
path.join(__dirname, "../node_modules", THEME_PACKAGE),
];

for (const themePath of searchPaths) {
if (fs.existsSync(themePath)) {
console.log(`✓ Found theme at: ${themePath}`);
return themePath;
}
}
return null;
}

function copyTheme(sourcePath, targetPath) {
fs.copySync(sourcePath, targetPath, {
overwrite: true,
filter: (src) => !src.includes("node_modules"),
});
console.log("Load additional theme");
} catch (e) {
console.log("No additional theme found", e);
console.log(`✓ Theme copied to: ${targetPath}`);
}

try {
const themePath = findThemePackage();

if (!themePath) {
console.log("ℹ No theme found - using default");
process.exit(0);
}

copyTheme(themePath, TARGET_DIR);
} catch (error) {
console.error(`✗ Error: ${error.message}`);
process.exit(1);
}
4 changes: 2 additions & 2 deletions apps/angular-starter/src/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
importProvidersFrom,
provideZoneChangeDetection,
} from '@angular/core';
import { provideRouter } from '@angular/router';
import { provideRouter, withHashLocation } from '@angular/router';
import { IxModule } from '@siemens/ix-angular';

import { routes } from './app.routes';
Expand All @@ -19,7 +19,7 @@ export function HttpLoaderFactory(http: HttpClient) {
export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes),
provideRouter(routes, withHashLocation()),
provideHttpClient(),
importProvidersFrom(
BrowserModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { TranslateModule } from '@ngx-translate/core';
import { useShowDemoMessage } from '../../../shared/utlis';
import { SharedService } from '../../../shared/services/shared.service';
import { environment } from '../../../../environments/environments';
import { environment } from '../../../../environments/environment';
import { themeSwitcher } from '@siemens/ix';
import { Subscription } from 'rxjs';

Expand Down
2 changes: 1 addition & 1 deletion apps/angular-starter/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';
import { environment } from './environments/environments';
import { environment } from './environments/environment';
import { getIxTheme } from '@siemens/ix-aggrid';
import * as agGrid from 'ag-grid-community';
import { ModuleRegistry, AllCommunityModule } from 'ag-grid-community';
Expand Down