add codemirror build scripts
Hunter
Monday, December 22nd, 2025 at 10:08 PM
1 .DS_Store
2
3 jen-only/
4 +
5 +vendor/node_modules/
6 +vendor/package-lock.json
1 +#!/usr/bin/env node
2 +// Build script to bundle CodeMirror for offline use
3 +//
4 +// Usage:
5 +// cd vendor
6 +// npm install
7 +// npm run build
8 +//
9 +// This will regenerate ../codemirror-bundle.js
10 +
11 +import * as esbuild from 'esbuild';
12 +import { fileURLToPath } from 'url';
13 +import { dirname, join } from 'path';
14 +
15 +const __dirname = dirname(fileURLToPath(import.meta.url));
16 +
17 +await esbuild.build({
18 + stdin: {
19 + contents: `
20 + export {EditorView, keymap, placeholder, lineNumbers, Decoration} from "@codemirror/view";
21 + export {EditorState, Compartment} from "@codemirror/state";
22 + export {defaultKeymap, indentWithTab, undo, redo, undoDepth, redoDepth, history, historyKeymap} from "@codemirror/commands";
23 + export {closeBrackets, closeBracketsKeymap} from "@codemirror/autocomplete";
24 + export {html} from "@codemirror/lang-html";
25 + export {githubDark} from "@fsegurai/codemirror-theme-github-dark";
26 + export {indentUnit} from "@codemirror/language";
27 + export {search, searchKeymap, closeSearchPanel, openSearchPanel} from "@codemirror/search";
28 + `,
29 + resolveDir: __dirname,
30 + loader: 'js',
31 + },
32 + bundle: true,
33 + format: 'esm',
34 + outfile: join(__dirname, '..', 'codemirror-bundle.js'),
35 + minify: true,
36 + target: ['es2020'],
37 +});
38 +
39 +console.log('✓ CodeMirror bundle created: ../codemirror-bundle.js');
1 +{
2 + "name": "codemirror-bundle",
3 + "private": true,
4 + "type": "module",
5 + "scripts": {
6 + "build": "node build.mjs"
7 + },
8 + "dependencies": {
9 + "@codemirror/autocomplete": "^6",
10 + "@codemirror/commands": "^6",
11 + "@codemirror/lang-html": "^6",
12 + "@codemirror/language": "^6",
13 + "@codemirror/search": "^6",
14 + "@codemirror/state": "^6",
15 + "@codemirror/view": "^6",
16 + "@fsegurai/codemirror-theme-github-dark": "^6",
17 + "esbuild": "^0.24"
18 + }
19 +}