diff --git a/.devcontainer/quick-setup/devcontainer.json b/.devcontainer/quick-setup/devcontainer.json index 54438f8f7..ecc905018 100644 --- a/.devcontainer/quick-setup/devcontainer.json +++ b/.devcontainer/quick-setup/devcontainer.json @@ -1,5 +1,5 @@ { - "postCreateCommand": "npm install --global bun && make quick-setup", + "postCreateCommand": "npm install --global bun && make setup", "features": { "ghcr.io/devcontainers/features/node:1": { "version": "19" diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index bf7bdab72..48cddf42f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -83,7 +83,7 @@ jobs: - run: make test-dist-sites-experiments - run: make clean - test-quick-setup: + test-make-test-fast: runs-on: ubuntu-latest steps: @@ -91,7 +91,7 @@ jobs: with: lfs: 'true' - uses: oven-sh/setup-bun@v1 - - run: make quick-setup + - run: make setup - name: Set up `node` uses: actions/setup-node@v4 with: diff --git a/Makefile b/Makefile index 1e4ca4452..072614bdd 100644 --- a/Makefile +++ b/Makefile @@ -34,10 +34,10 @@ build: clean build-lib build-bin build-sites .PHONY: build-lib build-lib: build-lib-js build-lib-types .PHONY: build-lib-js -build-lib-js: +build-lib-js: update-dependencies ${BUN_RUN} ./script/build/lib/build-lib-js.ts .PHONY: build-lib-types -build-lib-types: +build-lib-types: update-dependencies ${BUN_RUN} ./script/build/lib/build-lib-types.ts .PHONY: build-bin build-bin: build-lib-js @@ -46,19 +46,19 @@ build-bin: build-lib-js .PHONY: build-sites build-sites: build-site-twizzle build-site-experiments .PHONY: build-site-twizzle -build-site-twizzle: +build-site-twizzle: update-dependencies ${BUN_RUN} ./script/build/sites/build-site-twizzle.ts .PHONY: build-site-experiments -build-site-experiments: +build-site-experiments: update-dependencies ${BUN_RUN} ./script/build/sites/build-site-experiments.ts .PHONY: build-site-docs -build-site-docs: +build-site-docs: update-dependencies rm -rf ./dist/sites/js.cubing.net/ ${BUNX} typedoc src/cubing/*/index.ts cp -R ./src/docs/js.cubing.net/* ./dist/sites/js.cubing.net/ @echo "\n\nNote: The js.cubing.net docs are deployed to GitHub Pages using GitHub Actions when a commit is pushed to the \`main\` branch:\nhttps://github.com/cubing/cubing.js/actions/workflows/pages.yml" .PHONY: dev -dev: quick-setup +dev: update-dependencies ${BUN_RUN} ./script/build/sites/dev.ts .PHONY: link link: build @@ -99,7 +99,7 @@ test-info: # The following deps are in a custom order so that the more "useful" tests are first. # In case of failure, this is likely to be more helpful. .PHONY: test-fast -test-fast: quick-setup \ +test-fast: update-dependencies \ build-lib-js test-spec-bun-fast build-bin build-sites \ lint \ test-src-import-restrictions test-src-scripts-consistency \ @@ -109,7 +109,7 @@ test-fast: quick-setup \ .PHONY: test-all test-all: test-src test-build test-dist .PHONY: test-src -test-src: \ +test-src: update-dependencies \ test-spec \ lint-ci \ test-src-tsc \ @@ -118,34 +118,34 @@ test-src: \ .PHONY: test-spec test-spec: test-spec-bun test-spec-dom .PHONY: test-spec-bun -test-spec-bun: +test-spec-bun: update-dependencies ${BUN} test .PHONY: test-spec-bun-fast -test-spec-bun-fast: +test-spec-bun-fast: update-dependencies env CUBING_JS_SKIP_SLOW_TESTS=true ${BUN} test .PHONY: test-spec-bun-with-coverage -test-spec-bun-with-coverage: +test-spec-bun-with-coverage: update-dependencies ${BUN} test .PHONY: test-spec-dom -test-spec-dom: +test-spec-dom: update-dependencies ${WEB_TEST_RUNNER} .PHONY: test-spec-dom-with-coverage -test-spec-dom-with-coverage: +test-spec-dom-with-coverage: update-dependencies ${WEB_TEST_RUNNER} --coverage .PHONY: playwright-install playwright-install: ${BUNX} playwright install .PHONY: test-src-import-restrictions -test-src-import-restrictions: +test-src-import-restrictions: update-dependencies ${BUN_RUN} ./script/test/src/import-restrictions/main.ts .PHONY: test-src-tsc -test-src-tsc: +test-src-tsc: update-dependencies ${BUNX} tsc --project ./tsconfig.json .PHONY: test-src-scripts-consistency -test-src-scripts-consistency: +test-src-scripts-consistency: update-dependencies ${BUN_RUN} ./script/test/src/scripts-consistency/main.ts .PHONY: fix-src-scripts-consistency -fix-src-scripts-consistency: +fix-src-scripts-consistency: update-dependencies ${BUN_RUN} ./script/test/src/scripts-consistency/main.ts --fix .PHONY: test-build test-build: \ @@ -198,23 +198,26 @@ test-dist-bin-shebang: build-bin test-dist-bin-npm-exec: build-bin time ${NPM} exec scramble -- 222 .PHONY: format -format: +format: update-dependencies ${BIOME} check --write .PHONY: setup -setup: +setup: update-dependencies +.PHONY: update-dependencies +update-dependencies: ${BUN} install --no-save # TODO: was `npm ci` .PHONY: quick-setup -quick-setup: | node_modules +quick-setup: + @echo "make quick-setup is no longer supported. Dependencies will automatically be kept up to date." .PHONY: lint -lint: +lint: update-dependencies ${BIOME} check .PHONY: lint-ci -lint-ci: +lint-ci: update-dependencies ${BIOME} ci .PHONY: prepack prepack: clean build test-dist-lib-node-import test-dist-lib-node-scramble test-dist-lib-plain-esbuild-compat .PHONY: prepublishOnly -prepublishOnly: +prepublishOnly: update-dependencies # Lucas is usually the one publishing, and `mak` is over twice as fast. So we use it when available. # https://github.com/lgarron/mak mak test-all || make test-all @@ -254,10 +257,6 @@ update-cdn: ######## Only in `Makefile` ######## -# Not .PHONY(!) -node_modules: - ${BUN_RUN} ./script/quick-setup/main.ts - .PHONY: publish .PHONY: publish publish: diff --git a/package.json b/package.json index 3f3d41f23..137d5bb05 100644 --- a/package.json +++ b/package.json @@ -85,14 +85,6 @@ "typedoc": "^0.26.7", "typescript": "^5.6.2" }, - "minimalDevDependencies": [ - "getbuiltinmodule-ponyfill", - "barely-a-dev-server", - "esbuild", - "jszip", - "@biomejs/biome", - "cmd-ts-too" - ], "engines": { "node": ">=20.16.0", "bun": ">=1.0.30" @@ -149,6 +141,7 @@ "test-dist-bin-npm-exec": "make test-dist-bin-npm-exec", "format": "make format", "setup": "make setup", + "update-dependencies": "make update-dependencies", "quick-setup": "make quick-setup", "lint": "make lint", "lint-ci": "make lint-ci", diff --git a/script/quick-setup/main.ts b/script/quick-setup/main.ts deleted file mode 100644 index 560e181ae..000000000 --- a/script/quick-setup/main.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { - existsSync, - mkdirSync, - readFileSync, - renameSync, - writeFileSync, -} from "node:fs"; -import { cp } from "node:fs/promises"; -import { join } from "node:path"; -import { execPromise } from "../lib/execPromise"; - -const TEMP_ROOT = "./.temp/quick-setup"; -const TARGET_NODE_MODULES_PATH = "./node_modules"; - -if (existsSync(TARGET_NODE_MODULES_PATH)) { - process.exit(0); -} - -console.log( - ` -Automatically installing a subset of dependencies. - -Note that you have to run \`make setup\` manually if you pull new code or want to run any tests.`, -); - -const packageJSON = JSON.parse(readFileSync("package.json", "utf8")); -const oldDevDependencies = packageJSON.devDependencies; -packageJSON.devDependencies = {}; -for (const name of packageJSON.minimalDevDependencies) { - packageJSON.devDependencies[name] = oldDevDependencies[name]; -} -mkdirSync(TEMP_ROOT, { recursive: true }); -writeFileSync( - join(TEMP_ROOT, "package.json"), - JSON.stringify(packageJSON, null, " "), -); -cp("bun.lockb", join(TEMP_ROOT, "bun.lockb")); -console.log(await execPromise(`cd ${TEMP_ROOT} && bun install --no-save`)); -renameSync(join(TEMP_ROOT, "node_modules"), TARGET_NODE_MODULES_PATH);