This commit is contained in:
2026-10-22 16:06:51 +07:00
commit 25158e780f
2897 changed files with 569062 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env node
/**
* Menyiapkan folder dist/ untuk deploy statis (Vercel).
*
* Aplikasi browser hanya membutuhkan:
* - index.html dari template utama
* - src/data.js, src/layout.js, src/svg.js
* - assets/qrcode-core.js, assets/helvetica-metrics.js
*
* Jalankan: node scripts/build-static.js
*/
'use strict';
const fs = require('fs');
const path = require('path');
const root = path.resolve(__dirname, '..');
const outDir = path.join(root, 'dist');
const template = path.join(root, 'template_label_qr_eppos_rp4610b_100mm_3kolom.html');
const browserFiles = [
'src/data.js',
'src/layout.js',
'src/svg.js',
'assets/qrcode-core.js',
'assets/helvetica-metrics.js'
];
if (!fs.existsSync(template)) {
throw new Error('Template HTML tidak ditemukan: ' + template);
}
fs.rmSync(outDir, { recursive: true, force: true });
fs.mkdirSync(outDir, { recursive: true });
fs.copyFileSync(template, path.join(outDir, 'index.html'));
browserFiles.forEach(function (relativePath) {
const source = path.join(root, relativePath);
if (!fs.existsSync(source)) {
throw new Error('Aset browser tidak ditemukan: ' + source);
}
const target = path.join(outDir, relativePath);
fs.mkdirSync(path.dirname(target), { recursive: true });
fs.copyFileSync(source, target);
});
process.stdout.write('dist/ siap dideploy:\n');
process.stdout.write(' index.html\n');
browserFiles.forEach(function (relativePath) {
process.stdout.write(' ' + relativePath + '\n');
});