commit ce074f4e3f311de246caf885c2603e7dda15182b
parent d16c764ef33112fe8725c9a302a512e758037e0b
Author: Hunter
Date:   Mon, 22 Dec 2025 22:08:24 -0500

add codemirror build scripts

Diffstat:
M.gitignore | 3+++
Avendor/build.mjs | 39+++++++++++++++++++++++++++++++++++++++
Avendor/package.json | 19+++++++++++++++++++
3 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,3 +1,6 @@ .DS_Store jen-only/ + +vendor/node_modules/ +vendor/package-lock.json diff --git a/vendor/build.mjs b/vendor/build.mjs @@ -0,0 +1,39 @@ +#!/usr/bin/env node +// Build script to bundle CodeMirror for offline use +// +// Usage: +// cd vendor +// npm install +// npm run build +// +// This will regenerate ../codemirror-bundle.js + +import * as esbuild from 'esbuild'; +import { fileURLToPath } from 'url'; +import { dirname, join } from 'path'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +await esbuild.build({ + stdin: { + contents: ` + export {EditorView, keymap, placeholder, lineNumbers, Decoration} from "@codemirror/view"; + export {EditorState, Compartment} from "@codemirror/state"; + export {defaultKeymap, indentWithTab, undo, redo, undoDepth, redoDepth, history, historyKeymap} from "@codemirror/commands"; + export {closeBrackets, closeBracketsKeymap} from "@codemirror/autocomplete"; + export {html} from "@codemirror/lang-html"; + export {githubDark} from "@fsegurai/codemirror-theme-github-dark"; + export {indentUnit} from "@codemirror/language"; + export {search, searchKeymap, closeSearchPanel, openSearchPanel} from "@codemirror/search"; + `, + resolveDir: __dirname, + loader: 'js', + }, + bundle: true, + format: 'esm', + outfile: join(__dirname, '..', 'codemirror-bundle.js'), + minify: true, + target: ['es2020'], +}); + +console.log('✓ CodeMirror bundle created: ../codemirror-bundle.js'); diff --git a/vendor/package.json b/vendor/package.json @@ -0,0 +1,19 @@ +{ + "name": "codemirror-bundle", + "private": true, + "type": "module", + "scripts": { + "build": "node build.mjs" + }, + "dependencies": { + "@codemirror/autocomplete": "^6", + "@codemirror/commands": "^6", + "@codemirror/lang-html": "^6", + "@codemirror/language": "^6", + "@codemirror/search": "^6", + "@codemirror/state": "^6", + "@codemirror/view": "^6", + "@fsegurai/codemirror-theme-github-dark": "^6", + "esbuild": "^0.24" + } +}