fix scripts 2
This commit is contained in:
parent
4a1ef473b8
commit
d95bff8880
6 changed files with 813 additions and 125 deletions
|
|
@ -1,57 +0,0 @@
|
|||
import { builtinModules } from 'node:module';
|
||||
import esbuild from 'esbuild';
|
||||
import esbuildSvelte from 'esbuild-svelte';
|
||||
import { sveltePreprocess } from 'svelte-preprocess';
|
||||
import { getBuildBanner } from './buildBanner';
|
||||
|
||||
const banner = getBuildBanner('Release Build', version => version);
|
||||
|
||||
const build = await esbuild.build({
|
||||
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: 'es2018',
|
||||
logLevel: 'info',
|
||||
sourcemap: false,
|
||||
treeShaking: true,
|
||||
outfile: 'main.js',
|
||||
minify: true,
|
||||
metafile: true,
|
||||
define: {
|
||||
MB_GLOBAL_CONFIG_DEV_BUILD: 'false',
|
||||
},
|
||||
plugins: [
|
||||
esbuildSvelte({
|
||||
compilerOptions: { css: 'injected', dev: false },
|
||||
preprocess: sveltePreprocess(),
|
||||
filterWarnings: warning => {
|
||||
// we don't want warnings from node modules that we can do nothing about
|
||||
return !warning.filename?.includes('node_modules');
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
const file = Bun.file('meta.txt');
|
||||
await Bun.write(file, JSON.stringify(build.metafile, null, '\t'));
|
||||
|
||||
process.exit(0);
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
import esbuild from 'esbuild';
|
||||
import copy from 'esbuild-plugin-copy-watch';
|
||||
import esbuildSvelte from 'esbuild-svelte';
|
||||
import { sveltePreprocess } from 'svelte-preprocess';
|
||||
import manifest from '../../manifest.json' with { type: 'json' };
|
||||
import { getBuildBanner } from './buildBanner';
|
||||
|
||||
const banner = getBuildBanner('Dev Build', _ => 'Dev Build');
|
||||
|
||||
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',
|
||||
],
|
||||
format: 'cjs',
|
||||
target: 'es2018',
|
||||
logLevel: 'info',
|
||||
sourcemap: 'inline',
|
||||
treeShaking: true,
|
||||
outdir: `exampleVault/.obsidian/plugins/${manifest.id}/`,
|
||||
outbase: 'src',
|
||||
define: {
|
||||
MB_GLOBAL_CONFIG_DEV_BUILD: 'true',
|
||||
},
|
||||
plugins: [
|
||||
copy({
|
||||
paths: [
|
||||
{
|
||||
from: './styles.css',
|
||||
to: '',
|
||||
},
|
||||
{
|
||||
from: './manifest.json',
|
||||
to: '',
|
||||
},
|
||||
],
|
||||
}),
|
||||
esbuildSvelte({
|
||||
compilerOptions: { css: 'injected', dev: true },
|
||||
preprocess: sveltePreprocess(),
|
||||
filterWarnings: warning => {
|
||||
// we don't want warnings from node modules that we can do nothing about
|
||||
return !warning.filename?.includes('node_modules');
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
await context.watch();
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
"moduleResolution": "bundler",
|
||||
"importHelpers": true,
|
||||
"isolatedModules": true,
|
||||
"lib": ["DOM", "ES5", "ES6", "ES7", "Es2021"],
|
||||
"lib": ["DOM", "ES5", "ES6", "ES7", "Es2022"],
|
||||
"types": ["bun-types"],
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"resolveJsonModule": true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue