Skip to content

Commit 4ed5a43

Browse files
undo prebuild changes
1 parent 9c90d2f commit 4ed5a43

1 file changed

Lines changed: 10 additions & 28 deletions

File tree

prebuild.mjs

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,11 @@ import { fileURLToPath } from 'url';
1313
const __filename = fileURLToPath(import.meta.url);
1414
const __dirname = path.dirname(__filename);
1515

16-
let languagesHash;
17-
try {
18-
languagesHash = await hashElement(path.resolve(__dirname, 'src', 'main', 'webapp', 'i18n'), {
19-
algo: 'md5',
20-
encoding: 'hex',
21-
files: { include: ['*.json'] },
22-
});
23-
} catch (err) {
24-
// If i18n folder does not exist or hashing fails, continue with a fallback hash
25-
console.warn(`Warning: could not hash i18n folder: ${err.message}`);
26-
languagesHash = { hash: 'NO_I18N' };
27-
}
16+
const languagesHash = await hashElement(path.resolve(__dirname, 'src', 'main', 'webapp', 'i18n'), {
17+
algo: 'md5',
18+
encoding: 'hex',
19+
files: { include: ['*.json'] },
20+
});
2821

2922
// =====================
3023
// Environment variables
@@ -39,15 +32,14 @@ function inferVersion() {
3932
let version = 'DEV';
4033

4134
try {
42-
// Read build.gradle from project root (resolved against this script's directory)
43-
let data = fs.readFileSync(path.resolve(__dirname, 'build.gradle'), 'UTF-8');
35+
let data = fs.readFileSync('build.gradle', 'UTF-8');
4436

4537
// Try to match devVersion first (new format), then fall back to version (old format)
4638
let match = data.match(/\bdevVersion\s*=\s*"([^"]+)"/) || data.match(/\nversion\s*=\s*"([^"]+)"/);
4739

4840
version = match?.[1] ?? 'DEV';
4941
} catch (error) {
50-
console.log("Error while retrieving 'APP_VERSION' property", error.message || error);
42+
console.log("Error while retrieving 'APP_VERSION' property", error);
5143
}
5244

5345
return version;
@@ -70,25 +62,15 @@ export const environment = {
7062
},
7163
};
7264
`;
73-
74-
// Ensure output directory exists before writing
75-
const envOutPath = path.resolve(__dirname, 'src', 'main', 'webapp', 'app', 'environments', 'environment.override.ts');
76-
fs.mkdirSync(path.dirname(envOutPath), { recursive: true });
77-
fs.writeFileSync(envOutPath, environmentConfig);
65+
fs.writeFileSync(path.resolve(__dirname, 'src', 'main', 'webapp', 'app', 'environments', 'environment.override.ts'), environmentConfig);
7866

7967
// =====================
8068
// i18n merging
8169
// =====================
8270

8371
const groups = [
84-
{
85-
folder: path.resolve(__dirname, 'src', 'main', 'webapp', 'i18n', 'en'),
86-
output: path.resolve(__dirname, 'src', 'main', 'webapp', 'i18n', 'en.json'),
87-
},
88-
{
89-
folder: path.resolve(__dirname, 'src', 'main', 'webapp', 'i18n', 'de'),
90-
output: path.resolve(__dirname, 'src', 'main', 'webapp', 'i18n', 'de.json'),
91-
},
72+
{ folder: './src/main/webapp/i18n/en', output: './src/main/webapp/i18n/en.json' },
73+
{ folder: './src/main/webapp/i18n/de', output: './src/main/webapp/i18n/de.json' },
9274
];
9375

9476
const isObject = obj => obj && typeof obj === 'object';

0 commit comments

Comments
 (0)