1
+ #!/usr/bin/env -S deno run -A
2
+
3
+ import { build , emptyDir } from "https://deno.land/x/[email protected] /mod.ts" ;
4
+
5
+ await emptyDir ( "./npm" ) ;
6
+
7
+ await build ( {
8
+ entryPoints : [
9
+ "./mod.ts" ,
10
+ {
11
+ name : "./browser" ,
12
+ path : "./browser/mod.ts" ,
13
+ } ,
14
+ {
15
+ name : "./browser/dom" ,
16
+ path : "./browser/dom/mod.ts" ,
17
+ } ,
18
+ {
19
+ name : "./browser/websocket" ,
20
+ path : "./websocket/mod.ts" ,
21
+ } ,
22
+ {
23
+ name : "./parseAbsoluteLink" ,
24
+ path : "./parseAbsoluteLink.ts" ,
25
+ } ,
26
+ {
27
+ name : "./rest" ,
28
+ path : "./rest/mod.ts" ,
29
+ } ,
30
+ {
31
+ name : "./text" ,
32
+ path : "./text.ts" ,
33
+ } ,
34
+ {
35
+ name : "./title" ,
36
+ path : "./title.ts" ,
37
+ } ,
38
+ {
39
+ name : "./websocket" ,
40
+ path : "./websocket/mod.ts" ,
41
+ } ,
42
+ {
43
+ name : "./unstable-api" ,
44
+ path : "./api.ts" ,
45
+ } ,
46
+ {
47
+ name : "./unstable-api/pages" ,
48
+ path : "./api/pages.ts" ,
49
+ } ,
50
+ {
51
+ name : "./unstable-api/pages/project" ,
52
+ path : "./api/pages/project.ts" ,
53
+ } ,
54
+ {
55
+ name : "./unstable-api/pages/project/replace" ,
56
+ path : "./api/pages/project/replace.ts" ,
57
+ } ,
58
+ {
59
+ name : "./unstable-api/pages/project/replace/links" ,
60
+ path : "./api/pages/project/replace/links.ts" ,
61
+ } ,
62
+ {
63
+ name : "./unstable-api/pages/project/search" ,
64
+ path : "./api/pages/project/search.ts" ,
65
+ } ,
66
+ {
67
+ name : "./unstable-api/pages/project/search/query" ,
68
+ path : "./api/pages/project/search/query.ts" ,
69
+ } ,
70
+ {
71
+ name : "./unstable-api/pages/project/search/titles" ,
72
+ path : "./api/pages/project/search/titles.ts" ,
73
+ } ,
74
+ {
75
+ name : "./unstable-api/pages/project/title" ,
76
+ path : "./api/pages/project/title.ts" ,
77
+ } ,
78
+ {
79
+ name : "./unstable-api/pages/projects" ,
80
+ path : "./api/projects.ts" ,
81
+ } ,
82
+ {
83
+ name : "./unstable-api/pages/projects/project" ,
84
+ path : "./api/projects/project.ts" ,
85
+ } ,
86
+ {
87
+ name : "./unstable-api/pages/project/title/text" ,
88
+ path : "./api/pages/project/title/text.ts" ,
89
+ } ,
90
+ {
91
+ name : "./unstable-api/pages/project/title/icon" ,
92
+ path : "./api/pages/project/title/icon.ts" ,
93
+ } ,
94
+ {
95
+ name : "./unstable-api/users" ,
96
+ path : "./api/users.ts" ,
97
+ } ,
98
+ {
99
+ name : "./unstable-api/users/me" ,
100
+ path : "./api/users/me.ts" ,
101
+ } ,
102
+ ] ,
103
+ outDir : "./npm" ,
104
+ shims : {
105
+ // see JS docs for overview and more options
106
+ deno : true ,
107
+ } ,
108
+ package : {
109
+ // package.json properties
110
+ name : "@cosense/std" ,
111
+ version : Deno . args [ 0 ] ?? "0.0.0" ,
112
+ description : "UNOFFICIAL standard module for Scrapbox UserScript" ,
113
+ author : "takker99" ,
114
+ license : "MIT" ,
115
+ repository : {
116
+ type : "git" ,
117
+ url : "git+https://github.com/takker99/scrapbox-userscript-std.git" ,
118
+ } ,
119
+ homepage : "https://github.com/takker99/scrapbox-userscript-std#readme" ,
120
+ bugs : {
121
+ url : "https://github.com/takker99/scrapbox-userscript-std/issues" ,
122
+ } ,
123
+ keywords : [
124
+ "scrapbox" ,
125
+ "userscript" ,
126
+ "typescript" ,
127
+ "deno"
128
+ ] ,
129
+ engines : {
130
+ node : ">=16.0.0" ,
131
+ } ,
132
+ } ,
133
+ // Don't use import map for npm build to avoid JSR dependency conflicts
134
+ // importMap: "./deno.jsonc",
135
+
136
+ // Disable tests for npm build as they're Deno-specific
137
+ test : false ,
138
+ // Don't run type checking during build to avoid JSR dependency issues
139
+ typeCheck : false ,
140
+ declaration : "inline" ,
141
+ scriptModule : "cjs" ,
142
+ compilerOptions : {
143
+ lib : [ "esnext" , "dom" , "dom.iterable" ] ,
144
+ target : "ES2020" ,
145
+ } ,
146
+ } ) ;
147
+
148
+ // Copy additional files
149
+ await Deno . copyFile ( "LICENSE" , "npm/LICENSE" ) ;
150
+ await Deno . copyFile ( "README.md" , "npm/README.md" ) ;
151
+
152
+ console . log ( "npm package built successfully!" ) ;
0 commit comments