Mercurial > obsidian-remember-file-state
annotate esbuild.config.mjs @ 33:b77a0dd22db8
Editing pass on the README text.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 14 Aug 2023 10:38:28 -0700 |
parents | 141f0a7d1986 |
children | 1c8e46c3e941 |
rev | line source |
---|---|
0 | 1 import esbuild from "esbuild"; |
2 import process from "process"; | |
3 import builtins from 'builtin-modules' | |
4 | |
5 const banner = | |
6 `/* | |
7 THIS IS A GENERATED/BUNDLED FILE BY ESBUILD | |
8 if you want to view the source, please visit the github repository of this plugin | |
9 */ | |
10 `; | |
11 | |
12 const prod = (process.argv[2] === 'production'); | |
19
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
13 |
24 | 14 var outdir = (process.argv[2] === 'dogfood' ? process.argv[3] : ''); |
32
141f0a7d1986
Better error handling for npm dogfood command. Expand the README info.
Ludovic Chabant <ludovic@chabant.com>
parents:
24
diff
changeset
|
15 if (outdir != undefined && outdir != '') { |
24 | 16 if (outdir.slice(-1) != '/' && outdir.slice(-1) != "\\") { |
17 outdir += '/'; | |
18 } | |
32
141f0a7d1986
Better error handling for npm dogfood command. Expand the README info.
Ludovic Chabant <ludovic@chabant.com>
parents:
24
diff
changeset
|
19 } else { |
141f0a7d1986
Better error handling for npm dogfood command. Expand the README info.
Ludovic Chabant <ludovic@chabant.com>
parents:
24
diff
changeset
|
20 throw("Please provide an output directory to put the dog food into"); |
24 | 21 } |
22 | |
23 const outfile = outdir + 'main.js'; | |
0 | 24 |
25 esbuild.build({ | |
26 banner: { | |
27 js: banner, | |
28 }, | |
29 entryPoints: ['src/main.ts'], | |
30 bundle: true, | |
31 external: [ | |
19
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
32 'obsidian', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
33 'electron', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
34 '@codemirror/autocomplete', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
35 '@codemirror/closebrackets', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
36 '@codemirror/collab', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
37 '@codemirror/commands', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
38 '@codemirror/comment', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
39 '@codemirror/fold', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
40 '@codemirror/gutter', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
41 '@codemirror/highlight', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
42 '@codemirror/history', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
43 '@codemirror/language', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
44 '@codemirror/lint', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
45 '@codemirror/matchbrackets', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
46 '@codemirror/panel', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
47 '@codemirror/rangeset', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
48 '@codemirror/rectangular-selection', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
49 '@codemirror/search', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
50 '@codemirror/state', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
51 '@codemirror/stream-parser', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
52 '@codemirror/text', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
53 '@codemirror/tooltip', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
54 '@codemirror/view', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
55 ...builtins], |
0 | 56 format: 'cjs', |
57 watch: !prod, | |
58 target: 'es2016', | |
59 logLevel: "info", | |
60 sourcemap: prod ? false : 'inline', | |
61 treeShaking: true, | |
19
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
62 outfile: outfile, |
0 | 63 }).catch(() => process.exit(1)); |