A tool for conquest of ATProto lexicons. https://jsr.io/@hotsocket/lexiconqueror
3.6 kB
129 lines
1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5 */
6
7import { build, emptyDir } from "@deno/dnt";
8import { default as denoJson } from "./deno.json" with { type: "json" };
9
10const OUT_DIR = "./npm";
11await emptyDir(OUT_DIR);
12
13// const imports = denoJson.imports as Record<string, string>;
14
15await build({
16 filterDiagnostic(diag) {
17 return diag.code != 2345; // fuck off its fine
18 },
19 postBuild() {
20 Deno.copyFileSync("./tsconfig.json", OUT_DIR + "/tsconfig.json");
21 Deno.copyFileSync("./LICENSE", OUT_DIR + "/LICENSE");
22 Deno.copyFileSync("./readme-npm.md", OUT_DIR + "/readme.md");
23 },
24 entryPoints: [...Object.values(denoJson.exports)],
25 outDir: OUT_DIR,
26 package: {
27 name: "lxq",
28 description: "A tool for conquest of ATProto lexicons.",
29 version: denoJson.version,
30 license: denoJson.license,
31 // bin: {
32 // lxq: "esm/src/npx.js",
33 // },
34 repository: {
35 type: "git",
36 url: "git+https://github.com/hotsocket-fyi/lexiconqueror",
37 },
38 bugs: "https://github.com/hotsocket-fyi/lexiconqueror/issues",
39 author: {
40 name: "HotSocket",
41 url: "https://hotsocket.fyi/",
42 },
43 dependencies: {
44 "@types/node": "^24.9.2",
45 },
46 } as PackageJson,
47 compilerOptions: {
48 lib: ["DOM", "ESNext"],
49 },
50 // don't do commonjs, kids!
51 scriptModule: false,
52
53 // https://my.clevelandclinic.org/health/diseases/22131-migraine-aura
54 shims: {
55 undici: false,
56 },
57 test: false,
58});
59
60// function convertImports(imports: Record<string, string>): Record<string, string> {
61// return Object.fromEntries(
62// Object.entries(imports).map(
63// ([k, v]): [string, string] | void => {
64// if (v.startsWith("./")) return;
65// const [registry, name_] = v.split(":", 2);
66// const lastAt = name_.lastIndexOf("@");
67// const name =
68// let newKey: string;
69// console.log(newKey);
70// if (registry == "jsr") {
71// }
72// },
73// ).filter((x) => !!x),
74// );
75// }
76// function findVersion(pkg: string): string {
77// return (denoJson.imports as Record<string, string>)[pkg].split("^")[1];
78// }
79
80// something with imports fucked up so i copied in the code for my editing pleasure
81// https://jsr.io/@deno/dnt/0.42.3/lib/types.ts
82interface PackageJsonPerson {
83 name: string;
84 email?: string;
85 url?: string;
86}
87
88interface PackageJsonBugs {
89 url?: string;
90 email?: string;
91}
92interface PackageJson {
93 name: string;
94 version: string;
95 description?: string;
96 keywords?: string[];
97 homepage?: string;
98 bugs?: PackageJsonBugs | string;
99 /**
100 * Check https://spdx.org/licenses/ for valid licences
101 */
102 license?: "MIT" | "ISC" | "UNLICENSED" | string;
103 author?: PackageJsonPerson | string;
104 contributors?: (PackageJsonPerson | string)[];
105 main?: string;
106 types?: string;
107 scripts?: { [key: string]: string };
108 repository?: string | { type: string; url: string; directory?: string };
109 dependencies?: { [packageName: string]: string };
110 devDependencies?: { [packageName: string]: string };
111 peerDependencies?: { [packageName: string]: string };
112 bundleDependencies?: { [packageName: string]: string };
113 optionalDependencies?: { [packageName: string]: string };
114 engines?: { [engineName: string]: string };
115 /**
116 * A list of os like "darwin", "linux", "win32", OS names can be prefix by a "!"
117 */
118 os?: string[];
119 /**
120 * A list of cpu like "x64", "ia32", "arm", "mips", CPU names can be prefix by a "!"
121 */
122 cpu?: string[];
123 private?: boolean;
124 /**
125 * rest of the fields
126 */
127 //deno-lint-ignore no-explicit-any
128 [propertyName: string]: any;
129}