publish-vs-code-extensions.yml / Publish VS Code Extension (push) Successful in 8s
Publish Action Release / Derive release metadata (push) Successful in 5s
Publish Install Lua Addon Action / test_action (push) Failing after 18s
Publish Action Release / Publish tags (push) Successful in 21s
Publish Install Lua Addon Action / publish_action (push) Successful in 57s
60 lines
1.5 KiB
JavaScript
60 lines
1.5 KiB
JavaScript
const esbuild = require("esbuild");
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const production = process.argv.includes('--production');
|
|
const watch = process.argv.includes('--watch');
|
|
|
|
async function copyDirectory(src, dest) {
|
|
await fs.promises.mkdir(dest, { recursive: true });
|
|
const entries = await fs.promises.readdir(src, { withFileTypes: true });
|
|
|
|
for (const entry of entries) {
|
|
const srcPath = path.join(src, entry.name);
|
|
const destPath = path.join(dest, entry.name);
|
|
|
|
if (entry.isDirectory()) {
|
|
await copyDirectory(srcPath, destPath);
|
|
} else {
|
|
await fs.promises.copyFile(srcPath, destPath);
|
|
}
|
|
}
|
|
}
|
|
|
|
async function main() {
|
|
// Copy lua-addons to dist directory
|
|
const luaAddonsSource = path.join(__dirname, '../../dutchies-dcs-scripting-tools/lua-addons');
|
|
const luaAddonsDest = path.join(__dirname, 'dist/lua-addons');
|
|
|
|
if (fs.existsSync(luaAddonsSource)) {
|
|
await copyDirectory(luaAddonsSource, luaAddonsDest);
|
|
console.log('Lua addons copied to dist/');
|
|
}
|
|
|
|
const ctx = await esbuild.context({
|
|
entryPoints: [
|
|
'src/index.ts'
|
|
],
|
|
bundle: true,
|
|
format: 'cjs',
|
|
minify: production,
|
|
sourcemap: !production,
|
|
sourcesContent: false,
|
|
platform: 'node',
|
|
outfile: 'dist/index.js',
|
|
external: ['@actions/core'],
|
|
logLevel: 'silent',
|
|
});
|
|
if (watch) {
|
|
await ctx.watch();
|
|
} else {
|
|
await ctx.rebuild();
|
|
await ctx.dispose();
|
|
}
|
|
}
|
|
|
|
main().catch(e => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
});
|