mirror of
https://github.com/obsidianmd/obsidian-sample-plugin.git
synced 2026-12-03 06:44:36 +00:00
Check whether the target version key already exists in versions.json instead of whether the minAppVersion value exists. The old check incorrectly skipped writing a new entry when a prior version mapped to the same minAppVersion. Modernize TypeScript and esbuild configuration - Set target to ES2021 (Obsidian runs on modern Electron/Chromium) - Replace individual strict flags with strict: true - Update lib to ES2021 + DOM - Remove importHelpers and allowJs - Add skipLibCheck, forceConsistentCasingInFileNames, noFallthroughCasesInSwitch - Align esbuild target to es2021 Update dependencies - Bump @types/node from ^16.11.6 to ^22.15.17 (Node 16 is EOL) - Bump eslint-plugin-obsidianmd from 0.1.9 to 0.2.4 - Bump globals from 14.0.0 to 16.1.0 - Bump typescript-eslint from 8.35.1 to 8.32.1 - Remove tslib (no longer needed without importHelpers) Fix code issues and update minimum app version - Prefix unused parameters with _ (evt, view) - Use definite assignment assertion on settings property - Fix editorCallback parameter type (MarkdownView | MarkdownFileInfo) - Replace document/window with activeDocument/activeWindow - Replace let with const in SampleModal.onOpen - Bump minAppVersion from 0.15.0 to 1.0.0 - Update eslint config for obsidianmd plugin 0.2.4 compatibility Update documentation - Fix entry point references (main.ts -> src/main.ts) - Update minimum Node.js version to v18 - Replace outdated eslint instructions with npm run lint - Update code examples for strict mode and activeWindow - Remove yarn as alternative to npm Update eslint configuration Bump to eslint 10 Return to eslint 9 chore: formatting feat: add release CI chore: bumped obsidian eslint plugin to latest version chore: cleanup redundant code chore: moved obsidian to devDependencies fix: apply ignore patterns before rulesets docs: updated AGENTS.md to match codebase fix: set quote_style to single chore: formatting
50 lines
986 B
JavaScript
50 lines
986 B
JavaScript
import esbuild from 'esbuild';
|
|
import process from 'process';
|
|
import { builtinModules } from 'node:module';
|
|
|
|
const banner = `/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source, please visit the github repository of this plugin
|
|
*/
|
|
`;
|
|
|
|
const prod = process.argv[2] === 'production';
|
|
|
|
const context = await esbuild.context({
|
|
banner: {
|
|
js: banner,
|
|
},
|
|
entryPoints: ['src/main.ts'],
|
|
bundle: true,
|
|
external: [
|
|
'obsidian',
|
|
'electron',
|
|
'@codemirror/autocomplete',
|
|
'@codemirror/collab',
|
|
'@codemirror/commands',
|
|
'@codemirror/language',
|
|
'@codemirror/lint',
|
|
'@codemirror/search',
|
|
'@codemirror/state',
|
|
'@codemirror/view',
|
|
'@lezer/common',
|
|
'@lezer/highlight',
|
|
'@lezer/lr',
|
|
...builtinModules,
|
|
],
|
|
format: 'cjs',
|
|
target: 'es2021',
|
|
logLevel: 'info',
|
|
sourcemap: prod ? false : 'inline',
|
|
treeShaking: true,
|
|
outfile: 'main.js',
|
|
minify: prod,
|
|
});
|
|
|
|
if (prod) {
|
|
await context.rebuild();
|
|
process.exit(0);
|
|
} else {
|
|
await context.watch();
|
|
}
|