Archify Diagram Viewer 0.1.0
VS Code extension that previews Archify diagrams from their JSON sources (live, as you type) and opens rendered Archify HTML in a viewer tab. Bundles the Archify 3.0.1 renderer and runs it on VS Code's Node runtime. Adds validation diagnostics, JSON schema help, source-link navigation, export saving, render-to-file and open-in-browser commands. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+48
@@ -0,0 +1,48 @@
|
||||
import * as esbuild from 'esbuild';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
const production = process.argv.includes('--production');
|
||||
const watch = process.argv.includes('--watch');
|
||||
const tests = process.argv.includes('--tests');
|
||||
|
||||
const common = {
|
||||
bundle: true,
|
||||
format: 'cjs',
|
||||
platform: 'node',
|
||||
target: 'node20',
|
||||
sourcemap: !production,
|
||||
minify: production,
|
||||
logLevel: 'info',
|
||||
// jsonc-parser's UMD entry uses dynamic requires esbuild cannot follow.
|
||||
mainFields: ['module', 'main'],
|
||||
};
|
||||
|
||||
if (tests) {
|
||||
// Unit tests cover the modules that do not import 'vscode'; the
|
||||
// integration suite runs inside VS Code, which provides it.
|
||||
const entryPoints = fs.readdirSync('test')
|
||||
.filter((file) => file.endsWith('.test.ts'))
|
||||
.map((file) => path.join('test', file));
|
||||
await esbuild.build({ ...common, entryPoints, outdir: 'out/test', sourcemap: true });
|
||||
await esbuild.build({
|
||||
...common,
|
||||
entryPoints: ['test/integration/suite.ts'],
|
||||
outfile: 'out/test/integration/suite.js',
|
||||
external: ['vscode'],
|
||||
sourcemap: true,
|
||||
});
|
||||
} else {
|
||||
const ctx = await esbuild.context({
|
||||
...common,
|
||||
entryPoints: ['src/extension.ts'],
|
||||
outfile: 'dist/extension.js',
|
||||
external: ['vscode'],
|
||||
});
|
||||
if (watch) {
|
||||
await ctx.watch();
|
||||
} else {
|
||||
await ctx.rebuild();
|
||||
await ctx.dispose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user