From b93dd31ba661c6aab7546bfeec2e5a8c9179de2e Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Sun, 12 Jan 2025 21:43:03 -0700 Subject: [PATCH] cleanup stage --- Makefile | 4 ++-- d2js/js/Makefile | 8 ++++++-- d2js/js/build.js | 7 ++++--- make.sh | 8 ++++---- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 0a27720c2..37cf33c18 100644 --- a/Makefile +++ b/Makefile @@ -22,5 +22,5 @@ test: fmt race: fmt prefix "$@" ./ci/test.sh --race ./... .PHONY: js -js: - cd d2js/js && prefix "$@" ./make.sh +js: gen + cd d2js/js && prefix "$@" ./make.sh all diff --git a/d2js/js/Makefile b/d2js/js/Makefile index a8b662792..cc098c626 100644 --- a/d2js/js/Makefile +++ b/d2js/js/Makefile @@ -1,6 +1,6 @@ .POSIX: .PHONY: all -all: fmt build test +all: fmt build test cleanup .PHONY: fmt fmt: node_modules @@ -8,7 +8,7 @@ fmt: node_modules prefix "$@" rm -f yarn.lock .PHONY: build -build: node_modules +build: fmt prefix "$@" ./ci/build.sh .PHONY: test @@ -18,3 +18,7 @@ test: build .PHONY: node_modules node_modules: prefix "$@" bun install $${CI:+--frozen-lockfile} + +.PHONY: cleanup +cleanup: test + prefix "$@" git checkout -- src/platform.js diff --git a/d2js/js/build.js b/d2js/js/build.js index c7a1fcca5..889aaa050 100644 --- a/d2js/js/build.js +++ b/d2js/js/build.js @@ -1,5 +1,5 @@ import { build } from "bun"; -import { copyFile, mkdir, writeFile, readFile, rm } from "node:fs/promises"; +import { copyFile, mkdir, writeFile, readFile, rm, chmod } from "node:fs/promises"; import { join, resolve } from "node:path"; const __dirname = new URL(".", import.meta.url).pathname; @@ -31,11 +31,12 @@ const commonConfig = { async function buildPlatformFile(platform) { const platformContent = platform === "node" - ? "export * from './platform.node.js';" - : "export * from './platform.browser.js';"; + ? `export * from "./platform.node.js";` + : `export * from "./platform.browser.js";`; const platformPath = join(SRC_DIR, "platform.js"); await writeFile(platformPath, platformContent); + await chmod(platformPath, 0o600); } async function buildAndCopy(buildType) { diff --git a/make.sh b/make.sh index 6177fa6f2..9a3161556 100755 --- a/make.sh +++ b/make.sh @@ -14,8 +14,8 @@ if ! go version | grep -q '1.2[0-9]'; then exit 1 fi -if [ "${CI:-}" ]; then - export FORCE_COLOR=1 - npx playwright@1.31.1 install --with-deps chromium -fi +# if [ "${CI:-}" ]; then +# export FORCE_COLOR=1 +# npx playwright@1.31.1 install --with-deps chromium +# fi _make "$@"