added latest compiled version to git
This commit is contained in:
2797
latest/main.js
Normal file
2797
latest/main.js
Normal file
File diff suppressed because one or more lines are too long
8
latest/maniest.json
Normal file
8
latest/maniest.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"path": "https://gitea.phx-erp.de/PHXGMBH/phx-frontend-plugin-webcomponent-demo/raw/branch/master/latest/main.js",
|
||||
"items": [
|
||||
{
|
||||
"tagName": "frontend-plugin-demo"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -4,9 +4,10 @@
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build --watch --output-hashing none --configuration production",
|
||||
"build": "concurrently \"ng build --watch --output-hashing none --configuration production\" \"node scripts/copy-latest.mjs --watch\"",
|
||||
"test": "ng test",
|
||||
"build:dev": "ng build --output-hashing none --watch --configuration development",
|
||||
"copy-latest": "node scripts/copy-latest.mjs",
|
||||
"serve": "node ./scripts/serve-dist.mjs",
|
||||
"codegen": "graphql-codegen",
|
||||
"client": "ng serve --port 4201 --watch --configuration development",
|
||||
|
||||
49
scripts/copy-latest.mjs
Normal file
49
scripts/copy-latest.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import { watch } from 'node:fs';
|
||||
import { access, constants, copyFile, mkdir } from 'node:fs/promises';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const root = join(__dirname, '..');
|
||||
const source = join(root, 'dist/phx-frontend-plugin-demo/browser/main.js');
|
||||
const dest = join(root, 'latest/main.js');
|
||||
|
||||
async function copyMainJs() {
|
||||
try {
|
||||
await access(source, constants.F_OK);
|
||||
await mkdir(dirname(dest), { recursive: true });
|
||||
await copyFile(source, dest);
|
||||
console.log('[latest] Copied main.js');
|
||||
} catch (err) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
console.error('[latest] Copy failed:', err.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function watchMainJs() {
|
||||
let timeout;
|
||||
|
||||
const debouncedCopy = () => {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(copyMainJs, 100);
|
||||
};
|
||||
|
||||
const tryWatch = () => {
|
||||
access(source, constants.F_OK)
|
||||
.then(() => {
|
||||
copyMainJs();
|
||||
watch(source, debouncedCopy);
|
||||
console.log('[latest] Watching for main.js changes');
|
||||
})
|
||||
.catch(() => setTimeout(tryWatch, 500));
|
||||
};
|
||||
|
||||
tryWatch();
|
||||
}
|
||||
|
||||
if (process.argv.includes('--watch')) {
|
||||
watchMainJs();
|
||||
} else {
|
||||
copyMainJs();
|
||||
}
|
||||
Reference in New Issue
Block a user