From 8a725f756b74d59e78a41390b32dd0b92983080e Mon Sep 17 00:00:00 2001 From: William So Date: Thu, 6 Jun 2024 15:17:10 +0800 Subject: [PATCH] Fix ``build.mjs`` See . Signed-off-by: William So --- .changeset/quick-tables-buy.md | 5 +++++ build/build.mjs | 11 ++++++++--- package-lock.json | 6 ++++++ package.json | 1 + pnpm-lock.yaml | 7 +++++++ 5 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 .changeset/quick-tables-buy.md diff --git a/.changeset/quick-tables-buy.md b/.changeset/quick-tables-buy.md new file mode 100644 index 0000000..79408f4 --- /dev/null +++ b/.changeset/quick-tables-buy.md @@ -0,0 +1,5 @@ +--- +"@polyipseity/obsidian-plugin-library": patch +--- + +Fix `build.mjs`. See . diff --git a/build/build.mjs b/build/build.mjs index 2106f41..1199898 100644 --- a/build/build.mjs +++ b/build/build.mjs @@ -1,12 +1,13 @@ import { PACKAGE_ID, PATHS } from "./util.mjs" import { analyzeMetafile, context, formatMessages } from "esbuild" +import { argv, platform } from "node:process" import { constant, isEmpty, kebabCase } from "lodash-es" -import { argv } from "node:process" import { copy } from "esbuild-plugin-copy" import cssEscape from "css.escape" import esbuildCompress from "esbuild-compress" import esbuildSvelte from "esbuild-svelte" import { nodeExternalsPlugin } from "esbuild-node-externals" +import shq from "shq" import { spawn } from "node:child_process" import sveltePreprocess from "svelte-preprocess" import which from "which" @@ -120,7 +121,7 @@ async function tsc() { const npx = await which("npx", {}) return new Promise((resolve, reject) => { spawn( - npx, + platform === "win32" ? `"${npx}"` : shq(npx), [ "--package", "typescript", @@ -129,7 +130,11 @@ async function tsc() { "--emitDeclarationOnly", ...DEV ? ["--watch"] : [], ], - { stdio: "inherit" }, + { + // https://github.com/nodejs/node/issues/52554 + shell: true, + stdio: "inherit", + }, ) .once("error", reject) .once("exit", (code, signal) => { diff --git a/package-lock.json b/package-lock.json index 4c61d67..69f6e5d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,6 +41,7 @@ "obsidian": "~1.2.8", "p-lazy": "^4.0.0", "semver": "^7.6.2", + "shq": "^1.0.3", "source-map": "^0.7.4", "svelte": "^3.59.2", "ts-deepmerge": "^7.0.0", @@ -5921,6 +5922,11 @@ "node": ">=8" } }, + "node_modules/shq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/shq/-/shq-1.0.3.tgz", + "integrity": "sha512-1XtfCjwPTIA7E/5gvoRbgVyHpeHcLGcleGrTZIaiqGKDelycbna9BYriq0vSmbRNuew94v83909xRvL/AMuoUw==" + }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", diff --git a/package.json b/package.json index 5f77976..4d3f11e 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "obsidian": "~1.2.8", "p-lazy": "^4.0.0", "semver": "^7.6.2", + "shq": "^1.0.3", "source-map": "^0.7.4", "svelte": "^3.59.2", "ts-deepmerge": "^7.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 550a537..82c1cbd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -62,6 +62,9 @@ importers: semver: specifier: ^7.6.2 version: 7.6.2 + shq: + specifier: ^1.0.3 + version: 1.0.3 source-map: specifier: ^0.7.4 version: 0.7.4 @@ -3295,6 +3298,10 @@ packages: engines: {node: '>=8'} dev: true + /shq@1.0.3: + resolution: {integrity: sha512-1XtfCjwPTIA7E/5gvoRbgVyHpeHcLGcleGrTZIaiqGKDelycbna9BYriq0vSmbRNuew94v83909xRvL/AMuoUw==} + dev: false + /side-channel@1.0.4: resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} dependencies: