Skip to content

Commit

Permalink
chore(_tools): update npm build meta
Browse files Browse the repository at this point in the history
  • Loading branch information
TomokiMiyauci committed Jul 7, 2023
1 parent ed11b37 commit f4c376b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion _tools/build_npm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { build, emptyDir } from "https://deno.land/x/dnt@0.30.0/mod.ts";
import { build, emptyDir } from "https://deno.land/x/dnt@0.37.0/mod.ts";
import { join } from "https://deno.land/std@0.157.0/path/mod.ts";
import { makeOptions } from "./meta.ts";

Expand Down
15 changes: 5 additions & 10 deletions _tools/meta.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
import { BuildOptions } from "https://deno.land/x/dnt@0.30.0/mod.ts";
import { BuildOptions } from "https://deno.land/x/dnt@0.37.0/mod.ts";

export const makeOptions = (version: string): BuildOptions => ({
test: false,
shims: {},
typeCheck: true,
typeCheck: "both",
entryPoints: ["./mod.ts"],
outDir: "./npm",
package: {
name: "@miyauci/result",
version,
description: "The standard API for result in JavaScript",
description: "Minimum result type port of Rust",
keywords: [
"result",
"ok",
"error",
"container",
"handle",
"throw",
"throws",
"handling",
"match",
"unsafe",
"success",
"failure",
],
license: "MIT",
homepage: "https://github.com/TomokiMiyauci/result-js",
Expand Down
13 changes: 7 additions & 6 deletions _tools/publish_npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ if (import.meta.main) {
const tag = isPrerelease?.[0] ?? "latest";

const pkg = makeOptions(version);
const result = await Deno.run({
cmd: ["npm", "publish", pkg.outDir, "--tag", String(tag)],
stdout: "piped",
})
.output();
const command = new Deno.Command("npm", {
args: ["publish", pkg.outDir, "--tag", String(tag)],
});
const result = await command.output();

console.log(new TextDecoder().decode(result));
if (!result.success) {
console.error(new TextDecoder().decode(result.stderr));
}
}

0 comments on commit f4c376b

Please sign in to comment.