-
Notifications
You must be signed in to change notification settings - Fork 8
/
zotero-plugin.config.ts
71 lines (67 loc) · 1.97 KB
/
zotero-plugin.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { defineConfig } from 'zotero-plugin-scaffold'
import pkg from './package.json'
import { copyFileSync } from 'fs'
export default defineConfig({
source: ['src', 'addon'],
dist: 'build',
name: pkg.config.addonName,
id: pkg.config.addonID,
namespace: pkg.config.addonRef,
// updateURL: `https://github.com/{{owner}}/{{repo}}/releases/download/release/${
// pkg.version.includes('-') ? 'update-beta.json' : 'update.json'
// }`,
updateURL: `https://raw.githubusercontent.com/{{owner}}/{{repo}}/main/${
pkg.version.includes('-') ? 'update-beta.json' : 'update.json'
}`,
xpiDownloadLink: 'https://github.com/{{owner}}/{{repo}}/releases/download/v{{version}}/{{xpiName}}.xpi',
server: {
asProxy: true,
},
build: {
assets: ['addon/**/*.*'],
define: {
...pkg.config,
author: pkg.author,
description: pkg.description,
homepage: pkg.homepage,
buildVersion: pkg.version,
buildTime: '{{buildTime}}',
},
esbuildOptions: [
{
entryPoints: ['src/index.ts'],
define: {
__env__: `"${process.env.NODE_ENV}"`,
},
bundle: true,
target: 'firefox115',
outfile: `build/addon/chrome/content/scripts/${pkg.config.addonRef}.js`,
},
],
// If you want to checkout update.json into the repository, uncomment the following lines:
makeUpdateJson: {
hash: false,
},
hooks: {
'build:makeUpdateJSON': (ctx) => {
try {
copyFileSync('build/update.json', 'update_gitignore.json')
} catch (err) {
console.log('Some Error: ', err)
}
try {
copyFileSync('build/update-beta.json', 'update-beta_gitignore.json')
} catch (err) {
console.log('Some Error: ', err)
}
},
},
},
// release: {
// bumpp: {
// execute: "npm run build",
// },
// },
// If you need to see a more detailed build log, uncomment the following line:
// logLevel: "trace",
})