🎉 initial commit
This commit is contained in:
6
scripts/build.sh
Normal file
6
scripts/build.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
cd $(dirname $0)/..
|
||||
wasm-pack build --target=web --scope=landaiqing
|
||||
|
||||
cp -R ./extra/. ./pkg/
|
||||
|
||||
./scripts/package.mjs ./pkg/package.json
|
||||
39
scripts/package.mjs
Normal file
39
scripts/package.mjs
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env node
|
||||
import process from "node:process";
|
||||
import path from "node:path";
|
||||
import fs from "node:fs";
|
||||
|
||||
const pkg_path = path.resolve(process.cwd(), process.argv[2]);
|
||||
const pkg_text = fs.readFileSync(pkg_path, { encoding: "utf-8" });
|
||||
const pkg_json = JSON.parse(pkg_text);
|
||||
|
||||
delete pkg_json.files;
|
||||
|
||||
pkg_json.main = pkg_json.module;
|
||||
pkg_json.type = "module";
|
||||
pkg_json.publishConfig = {
|
||||
access: "public",
|
||||
};
|
||||
pkg_json.exports = {
|
||||
".": {
|
||||
types: "./rust_fmt.d.ts",
|
||||
node: "./rust_fmt_node.js",
|
||||
default: "./rust_fmt.js",
|
||||
},
|
||||
"./vite": {
|
||||
types: "./rust_fmt.d.ts",
|
||||
default: "./rust_fmt_vite.js",
|
||||
},
|
||||
"./package.json": "./package.json",
|
||||
"./*": "./*",
|
||||
};
|
||||
|
||||
fs.writeFileSync(pkg_path, JSON.stringify(pkg_json, null, 4));
|
||||
|
||||
// JSR
|
||||
|
||||
const jsr_path = path.resolve(pkg_path, "..", "jsr.jsonc");
|
||||
pkg_json.name = "@fmt/rust-fmt";
|
||||
pkg_json.exports = "./rust_fmt.js";
|
||||
pkg_json.exclude = ["!**", "*.tgz"];
|
||||
fs.writeFileSync(jsr_path, JSON.stringify(pkg_json, null, 4));
|
||||
Reference in New Issue
Block a user