cleanup stage

This commit is contained in:
Alexander Wang 2025-01-12 21:43:03 -07:00
parent e7f4df37ad
commit b93dd31ba6
No known key found for this signature in database
GPG key ID: BE3937D0D52D8927
4 changed files with 16 additions and 11 deletions

View file

@ -22,5 +22,5 @@ test: fmt
race: fmt race: fmt
prefix "$@" ./ci/test.sh --race ./... prefix "$@" ./ci/test.sh --race ./...
.PHONY: js .PHONY: js
js: js: gen
cd d2js/js && prefix "$@" ./make.sh cd d2js/js && prefix "$@" ./make.sh all

View file

@ -1,6 +1,6 @@
.POSIX: .POSIX:
.PHONY: all .PHONY: all
all: fmt build test all: fmt build test cleanup
.PHONY: fmt .PHONY: fmt
fmt: node_modules fmt: node_modules
@ -8,7 +8,7 @@ fmt: node_modules
prefix "$@" rm -f yarn.lock prefix "$@" rm -f yarn.lock
.PHONY: build .PHONY: build
build: node_modules build: fmt
prefix "$@" ./ci/build.sh prefix "$@" ./ci/build.sh
.PHONY: test .PHONY: test
@ -18,3 +18,7 @@ test: build
.PHONY: node_modules .PHONY: node_modules
node_modules: node_modules:
prefix "$@" bun install $${CI:+--frozen-lockfile} prefix "$@" bun install $${CI:+--frozen-lockfile}
.PHONY: cleanup
cleanup: test
prefix "$@" git checkout -- src/platform.js

View file

@ -1,5 +1,5 @@
import { build } from "bun"; 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"; import { join, resolve } from "node:path";
const __dirname = new URL(".", import.meta.url).pathname; const __dirname = new URL(".", import.meta.url).pathname;
@ -31,11 +31,12 @@ const commonConfig = {
async function buildPlatformFile(platform) { async function buildPlatformFile(platform) {
const platformContent = const platformContent =
platform === "node" platform === "node"
? "export * from './platform.node.js';" ? `export * from "./platform.node.js";`
: "export * from './platform.browser.js';"; : `export * from "./platform.browser.js";`;
const platformPath = join(SRC_DIR, "platform.js"); const platformPath = join(SRC_DIR, "platform.js");
await writeFile(platformPath, platformContent); await writeFile(platformPath, platformContent);
await chmod(platformPath, 0o600);
} }
async function buildAndCopy(buildType) { async function buildAndCopy(buildType) {

View file

@ -14,8 +14,8 @@ if ! go version | grep -q '1.2[0-9]'; then
exit 1 exit 1
fi fi
if [ "${CI:-}" ]; then # if [ "${CI:-}" ]; then
export FORCE_COLOR=1 # export FORCE_COLOR=1
npx playwright@1.31.1 install --with-deps chromium # npx playwright@1.31.1 install --with-deps chromium
fi # fi
_make "$@" _make "$@"