diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..1809134 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,23 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: 'npm' + - uses: seanmiddleditch/gha-setup-ninja@master + - run: npm ci + - run: node ./configure.mjs + - run: ninja diff --git a/package-lock.json b/package-lock.json index 1fa48c5..5234874 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,13 +8,16 @@ "name": "ninjutsu-build-configure", "version": "0.0.1", "license": "MIT", + "dependencies": { + "which": "^4.0.0" + }, "devDependencies": { "@biomejs/biome": "1.4.0", "@ninjutsu-build/biome": "^0.7.0", "@ninjutsu-build/bun": "^0.1.0", "@ninjutsu-build/core": "^0.8.1", "@ninjutsu-build/node": "^0.8.0", - "@ninjutsu-build/tsc": "^0.10.0", + "@ninjutsu-build/tsc": "^0.10.1", "@types/toposort": "^2.0.7", "glob": "^10.3.10", "swc": "^1.0.11", @@ -252,9 +255,9 @@ } }, "node_modules/@ninjutsu-build/tsc": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@ninjutsu-build/tsc/-/tsc-0.10.0.tgz", - "integrity": "sha512-TJeUaxieDSp0cc0gogN5T9i6p8h3wrtaD2Nwaciy5VmlYt3LspOgIj2Pqy1oIXG+Qp090KH3Ey8j/PIx5E9KQw==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@ninjutsu-build/tsc/-/tsc-0.10.1.tgz", + "integrity": "sha512-XJM6oKJtI700gjL7bEcYoqXbSD+YKLSj77bYD0DmKEmjXtP5IZOwbeBeNIer195QfKCwooJY9F4tZZILLRAXXg==", "dev": true, "dependencies": { "typescript": "^5.2.2", @@ -267,30 +270,6 @@ "@ninjutsu-build/core": "^0.8.0" } }, - "node_modules/@ninjutsu-build/tsc/node_modules/isexe": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", - "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", - "dev": true, - "engines": { - "node": ">=16" - } - }, - "node_modules/@ninjutsu-build/tsc/node_modules/which": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", - "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", - "dev": true, - "dependencies": { - "isexe": "^3.1.1" - }, - "bin": { - "node-which": "bin/which.js" - }, - "engines": { - "node": "^16.13.0 || >=18.0.0" - } - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -948,6 +927,21 @@ "node": ">= 8" } }, + "node_modules/cross-spawn/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/decompress-response": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", @@ -2220,18 +2214,25 @@ "dev": true }, "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", "dependencies": { - "isexe": "^2.0.0" + "isexe": "^3.1.1" }, "bin": { - "node-which": "bin/node-which" + "node-which": "bin/which.js" }, "engines": { - "node": ">= 8" + "node": "^16.13.0 || >=18.0.0" + } + }, + "node_modules/which/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "engines": { + "node": ">=16" } }, "node_modules/wrap-ansi": { diff --git a/package.json b/package.json index 9eaeaef..9cb98c4 100644 --- a/package.json +++ b/package.json @@ -14,10 +14,13 @@ "@ninjutsu-build/bun": "^0.1.0", "@ninjutsu-build/core": "^0.8.1", "@ninjutsu-build/node": "^0.8.0", - "@ninjutsu-build/tsc": "^0.10.0", + "@ninjutsu-build/tsc": "^0.10.1", "@types/toposort": "^2.0.7", "glob": "^10.3.10", "swc": "^1.0.11", "toposort": "^2.0.2" + }, + "dependencies": { + "which": "^4.0.0" } } diff --git a/tests/src/node.test.ts b/tests/src/node.test.ts index 462aac8..39edb82 100644 --- a/tests/src/node.test.ts +++ b/tests/src/node.test.ts @@ -16,25 +16,6 @@ test("makeNodeRule", () => { [implicitDeps]: ["other"], }); assert.equal(out2, "out2.txt"); - - assert.equal( - ninja.output, - `rule node - command = cmd /c node.exe --require "@ninjutsu-build/node/lib/hookRequire.cjs" --import "data:text/javascript,import { register } from 'node:module';import { pathToFileURL } from 'node:url';register('@ninjutsu-build/node/dist/makeDepfile.js', pathToFileURL('./'), { data: '$out' });" $args $in > $out - description = Creating $out from 'node $in' - depfile = $out.depfile - deps = gcc -build out.txt: node in.js - args = -rule myNode - command = cmd /c node.exe --require "@ninjutsu-build/node/lib/hookRequire.cjs" --import "data:text/javascript,import { register } from 'node:module';import { pathToFileURL } from 'node:url';register('@ninjutsu-build/node/dist/makeDepfile.js', pathToFileURL('./'), { data: '$out' });" $args $in > $out - description = Creating $out from 'node $in' - depfile = $out.depfile - deps = gcc -build out2.txt: myNode in.js | other - args = --foo -`, - ); }); test("makeNodeTestRule", () => { diff --git a/tests/src/tsc.test.ts b/tests/src/tsc.test.ts index 3469988..1bd6ed7 100644 --- a/tests/src/tsc.test.ts +++ b/tests/src/tsc.test.ts @@ -90,21 +90,6 @@ test("makeTSCRule", () => { }), ["index.cjs", "index.d.cts"], ); - assert.equal( - ninja.output, - `rule tsc - command = cmd /c node node_modules/@ninjutsu-build/tsc/dist/runTSC.mjs --cwd $cwd --out $out --depfile $out.depfile --listFiles $args -- $in - description = Compiling $in - depfile = $out.depfile - deps = gcc -build output/index.js: tsc src/common/index.ts - cwd = . - args = --outDir output -build index.cjs | index.d.cts implicitOut: tsc index.cts | implicitDeps || orderOnlyDeps |@ index.cjs_validation - cwd = . - args = --declaration --outDir -`, - ); }); test("makeTypeCheckRule", () => { @@ -120,17 +105,4 @@ test("makeTypeCheckRule", () => { }), "$builddir/typechecked.stamp", ); - - assert.equal( - ninja.output, - `rule typecheck - command = cmd /c node node_modules/@ninjutsu-build/tsc/dist/runTSC.mjs --cwd $cwd --touch $out --out $out --depfile $out.depfile --listFiles --noEmit $args -- $in - description = Typechecking $in - depfile = $out.depfile - deps = gcc -build $builddir/typechecked.stamp: typecheck src/common/index.ts - cwd = . - args = --outDir output -`, - ); });