Mercurial > obsidian-remember-file-state
annotate esbuild.config.mjs @ 38:a371a2001e95 1.0.7
Bump versions to 1.0.7
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 14 Aug 2023 11:26:06 -0700 |
parents | 1c8e46c3e941 |
children | d52beb77d109 |
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 | |
34
1c8e46c3e941
Add URL to hosted repos in the generated code file.
Ludovic Chabant <ludovic@chabant.com>
parents:
32
diff
changeset
|
8 if you want to view the source, please visit one of the following: |
1c8e46c3e941
Add URL to hosted repos in the generated code file.
Ludovic Chabant <ludovic@chabant.com>
parents:
32
diff
changeset
|
9 https://hg.bolt80.com/obsidian-remember-file-state |
1c8e46c3e941
Add URL to hosted repos in the generated code file.
Ludovic Chabant <ludovic@chabant.com>
parents:
32
diff
changeset
|
10 https://hg.sr.ht/~ludovicchabant/obsidian-remember-file-state |
1c8e46c3e941
Add URL to hosted repos in the generated code file.
Ludovic Chabant <ludovic@chabant.com>
parents:
32
diff
changeset
|
11 https://github.com/ludovicchabant/obsidian-remember-file-state |
0 | 12 */ |
13 `; | |
14 | |
15 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
|
16 |
24 | 17 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
|
18 if (outdir != undefined && outdir != '') { |
24 | 19 if (outdir.slice(-1) != '/' && outdir.slice(-1) != "\\") { |
20 outdir += '/'; | |
21 } | |
32
141f0a7d1986
Better error handling for npm dogfood command. Expand the README info.
Ludovic Chabant <ludovic@chabant.com>
parents:
24
diff
changeset
|
22 } else { |
141f0a7d1986
Better error handling for npm dogfood command. Expand the README info.
Ludovic Chabant <ludovic@chabant.com>
parents:
24
diff
changeset
|
23 throw("Please provide an output directory to put the dog food into"); |
24 | 24 } |
25 | |
26 const outfile = outdir + 'main.js'; | |
0 | 27 |
28 esbuild.build({ | |
29 banner: { | |
30 js: banner, | |
31 }, | |
32 entryPoints: ['src/main.ts'], | |
33 bundle: true, | |
34 external: [ | |
19
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
35 'obsidian', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
36 'electron', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
37 '@codemirror/autocomplete', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
38 '@codemirror/closebrackets', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
39 '@codemirror/collab', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
40 '@codemirror/commands', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
41 '@codemirror/comment', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
42 '@codemirror/fold', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
43 '@codemirror/gutter', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
44 '@codemirror/highlight', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
45 '@codemirror/history', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
46 '@codemirror/language', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
47 '@codemirror/lint', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
48 '@codemirror/matchbrackets', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
49 '@codemirror/panel', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
50 '@codemirror/rangeset', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
51 '@codemirror/rectangular-selection', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
52 '@codemirror/search', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
53 '@codemirror/state', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
54 '@codemirror/stream-parser', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
55 '@codemirror/text', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
56 '@codemirror/tooltip', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
57 '@codemirror/view', |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
58 ...builtins], |
0 | 59 format: 'cjs', |
60 watch: !prod, | |
61 target: 'es2016', | |
62 logLevel: "info", | |
63 sourcemap: prod ? false : 'inline', | |
64 treeShaking: true, | |
19
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
65 outfile: outfile, |
0 | 66 }).catch(() => process.exit(1)); |