{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
- },
- {
- "replace": "src/app/core/layouts/login-layout/login-layout.component.html",
- "with": "src/app/core/layouts/login-layout/login-layout.component.brand.html"
- },
- {
- "replace": "src/app/core/auth/login/login.component.html",
- "with": "src/app/core/auth/login/login.component.brand.html"
- },
- {
- "replace": "src/app/core/navigation/navigation/navigation.component.html",
- "with": "src/app/core/navigation/navigation/navigation.component.brand.html"
- },
- {
- "replace": "src/app/core/navigation/about/about.component.html",
- "with": "src/app/core/navigation/about/about.component.brand.html"
}
]
},
"ng": "ng",
"start": "npm run env_build && ng serve --host 0.0.0.0 --ssl",
"build": "npm run env_build && ng build --configuration=$npm_package_config_locale",
+ "prebuild:localize": "node suse-branding",
"build:localize": "node cd --env --pre && ng build --localize",
"postbuild:localize": "node cd --res",
+ "postpostbuild:localize": "node suse-branding --undo",
"env_build": "node cd --env",
"i18n": "npm run i18n:extract && npm run i18n:push && npm run i18n:pull && npm run i18n:merge",
"i18n:extract": "ng extract-i18n --output-path src/locale --progress=false",
--- /dev/null
+const fs = require('fs');
+const child_process = require('child_process');
+
+const fileReplacements = [{
+ "replace": "src/app/core/layouts/login-layout/login-layout.component.html",
+ "with": "src/app/core/layouts/login-layout/login-layout.component.brand.html"
+},{
+ "replace": "src/app/core/auth/login/login.component.html",
+ "with": "src/app/core/auth/login/login.component.brand.html"
+},{
+ "replace": "src/app/core/navigation/navigation/navigation.component.html",
+ "with": "src/app/core/navigation/navigation/navigation.component.brand.html"
+},{
+ "replace": "src/app/core/navigation/about/about.component.html",
+ "with": "src/app/core/navigation/about/about.component.brand.html"
+}];
+
+if (process.argv.includes('--undo')) {
+ undo();
+} else {
+ apply();
+}
+
+function apply() {
+ fileReplacements.forEach((options) => {
+ fs.copyFile(options.with, options.replace, (error) => {
+ if (error) throw error;
+ logger(`'${options.with}' was copied to '${options.replace}'`);
+ });
+ });
+}
+
+function undo() {
+ fileReplacements.forEach((options) => {
+ child_process.execSync(`git restore ${options.replace}`);
+ logger(`File '${options.replace}' restored`);
+ });
+}
+
+function logger(message) {
+ console.log(`[suse-branding.js] ${message}`);
+}