76 lines
2.7 KiB
JavaScript
76 lines
2.7 KiB
JavaScript
// *************************************************************************
|
|
// * (C)opyright 2026 by Ruben Carlo Benante *
|
|
// * *
|
|
// * This program is free software; you can redistribute it and/or modify *
|
|
// * it under the terms of the GNU General Public License as published by *
|
|
// * the Free Software Foundation, either version 3 of the License, or *
|
|
// * (at your option) any later version. *
|
|
// * *
|
|
// * This program is distributed in the hope that it will be useful, *
|
|
// * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
// * GNU General Public License for more details. *
|
|
// * *
|
|
// * You should have received a copy of the GNU General Public License *
|
|
// * along with this program. If not, see http://www.gnu.org/licenses/. *
|
|
// * *
|
|
// * Contact author at: *
|
|
// * Ruben Carlo Benante *
|
|
// * rcb@beco.cc *
|
|
// *************************************************************************
|
|
|
|
import esbuild from 'esbuild';
|
|
import process from 'process';
|
|
import { builtinModules } from 'node:module';
|
|
|
|
const banner = `/*
|
|
* zettelclean - keep a Zettelkasten filename's slug in sync with the note's H1.
|
|
* Copyright (C) 2026 Ruben Carlo Benante (Dr. Beco) <rcb@beco.cc>
|
|
* Licensed under the GNU General Public License v3.0 or later.
|
|
* See https://www.gnu.org/licenses/ and the LICENSE file.
|
|
*
|
|
* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD.
|
|
* To view the source, visit the 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();
|
|
}
|