Files
NeoTachyon/fe-app-tachyon/tsup.config.ts
T
Dushnilin bb1de1fd83 Merge branch 'temp-upstream-rebrand' into main
Resolves merge conflicts:
- install.sh, build.sh, .github/workflows/build.yml: Reverted to Dushnilin's versions to avoid installing SourceForge mirrors.
- fe-app-tachyon: Resolved type, formatting and copyOutbound conflicts, keeping both Dushnilin's custom features and ushan0v's frontend performance optimizations.
- backend: Kept Dushnilin's ucode refactorings, Telegram bot integration, and release repository URL (Dushnilin/tachyon) while merging updates.uc cache format v8 & persistent cache format v7.
- tests: Merged tests from both branches, preserving ucode -L wrappers for local test execution.
2026-07-14 08:01:45 +03:00

41 lines
1.3 KiB
TypeScript

import { defineConfig } from 'tsup';
import fs from 'fs';
import path from 'path';
export default defineConfig({
entry: ['src/main.ts'],
format: ['esm'], // пусть tsup генерит export {...}
outDir: '../luci-app-tachyon/htdocs/luci-static/resources/view/tachyon',
outExtension: () => ({ js: '.js' }),
dts: false,
clean: false,
sourcemap: false,
banner: {
js: `// This file is autogenerated, please don't change manually \n"use strict";`,
},
esbuildOptions(options) {
options.legalComments = 'none';
},
onSuccess: () => {
const outDir =
'../luci-app-tachyon/htdocs/luci-static/resources/view/tachyon';
const file = path.join(outDir, 'main.js');
let code = fs.readFileSync(file, 'utf8');
const originalCode = code;
code = code.replace(
/export\s*{([\s\S]*?)}/,
(match, group) => {
return `return baseclass.extend({${group}})`;
}
);
if (code === originalCode) {
throw new Error("Failed to patch LuCI build: 'export { ... }' block not found in main.js!");
}
fs.writeFileSync(file, code, 'utf8');
console.log(`✅ Patched LuCI build: ${file}`);
},
});