-
Notifications
You must be signed in to change notification settings - Fork 15
fix(theme-loading): copy and load theme correctly and fix routing #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lakshmi-priya-b
wants to merge
5
commits into
siemens:main
Choose a base branch
from
lakshmi-priya-b:add-theme-loading
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
af44988
add logic for copying brand theme
lakshmi-priya-b 103c138
add fix for routing
lakshmi-priya-b 74a64e6
update theme package resolution using require.resolve()
lakshmi-priya-b 662d9ef
Remove error symbol from console message
danielleroux f1358b0
fix(e2e): update Angular E2E test URLs to use hash routing
lakshmi-priya-b File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.