diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 72855f7d..6d4b8662 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -40,7 +40,7 @@ jobs: node-version: 24.x - run: pnpm install --no-frozen-lockfile - run: pnpm -r --filter='./packages/*' --filter='./plugins/*' --fail-if-no-match run build-mod --output-dir ../../dist - - run: node ./publish.js factorio ./dist + - run: node ./scripts/publish.js factorio ./dist env: FACTORIO_TOKEN: ${{ secrets.FACTORIO_TOKEN }} - uses: softprops/action-gh-release@v3 diff --git a/AGENTS.md b/AGENTS.md index c386f2b7..d46c97c8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -30,7 +30,7 @@ Use the detailed guides for the affected area: The harness needs Factorio, recreates `temp/test/`, and shares ports 8880/4443; do not run competing suites. - Report checks, failures, skips, and unverified behavior precisely. Documentation-only changes need path, command, and formatting checks. -- Preview cleanup with `node clean.js --dry-run`; see the [cleanup scopes](docs/contributing.md#cleaning-generated-and-runtime-files). +- Preview cleanup with `node scripts/clean.js --dry-run`; see the [cleanup scopes](docs/contributing.md#cleaning-generated-and-runtime-files). Runtime-data deletion and release publication require explicit authorization. Keep local configs, credentials, runtime data, and generated output out of commits. - Follow the [PR template](.github/pull_request_template.md), including `### Changelog` (`None.` when appropriate). diff --git a/docs/contributing.md b/docs/contributing.md index 684b2e57..1853ee15 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -229,13 +229,13 @@ For documentation changes, check that links, paths, and example commands are cor ### Cleaning generated and runtime files -Inspect `node clean.js --help` and preview the selected scope with `--dry-run` before cleaning. +Inspect `node scripts/clean.js --help` and preview the selected scope with `--dry-run` before cleaning. | Command | Removal scope | | --- | --- | -| `node clean.js --dry-run` | Preview workspace package/plugin build output and Vite dependency caches; omit `--dry-run` to clean, or use `pnpm clean`. | -| `node clean.js tests --dry-run` | Also preview root `.nyc_output/`, `coverage/`, the whole `temp/` directory, and `static/`. | -| `node clean.js all --dry-run` | Also preview runtime databases, instances, logs, mods, local configs, `FactorioAdminToken.txt`, and `plugin-list.json`. | +| `node scripts/clean.js --dry-run` | Preview workspace package/plugin build output and Vite dependency caches; omit `--dry-run` to clean, or use `pnpm clean`. | +| `node scripts/clean.js tests --dry-run` | Also preview root `.nyc_output/`, `coverage/`, the whole `temp/` directory, and `static/`. | +| `node scripts/clean.js all --dry-run` | Also preview runtime databases, instances, logs, mods, local configs, `FactorioAdminToken.txt`, and `plugin-list.json`. | `all` deletes cluster runtime data, including configurations and saves; back up anything you want to keep before using it. The cleaner excludes `external_plugins/` and does not remove mod archives in root `dist/`. diff --git a/docs/release-workflow.md b/docs/release-workflow.md index a6d7c887..84100618 100644 --- a/docs/release-workflow.md +++ b/docs/release-workflow.md @@ -62,7 +62,7 @@ The steps below describe publishing npm packages manually instead. The repository does not track `pnpm-lock.yaml`, so allow pnpm to generate or update it during installation. ```sh - node clean.js --dry-run + node scripts/clean.js --dry-run pnpm clean pnpm install --no-frozen-lockfile pnpm -r --filter='./packages/*' --filter='./plugins/*' --fail-if-no-match publish diff --git a/package.json b/package.json index b8fdd877..485cf328 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "ci-cover": "c8 --reporter=lcovonly pnpm test", "lint": "oxlint packages plugins test", "lint-fix": "oxlint --fix packages plugins test", - "clean": "node ./clean.js", + "clean": "node ./scripts/clean.js", "bundle-dependencies": "bundle-dependencies" }, "c8": { diff --git a/clean.js b/scripts/clean.js similarity index 97% rename from clean.js rename to scripts/clean.js index a45e3ac1..e4137b54 100644 --- a/clean.js +++ b/scripts/clean.js @@ -10,7 +10,7 @@ import path from "node:path"; import fs from "node:fs/promises"; import yargs from "yargs"; -import npmPackage from "./package.json" with { type: "json" }; +import npmPackage from "../package.json" with { type: "json" }; const workspaces = npmPackage.workspaces .map(p => p.slice(0, -2)) .filter(p => !p.includes("external_plugins")); diff --git a/publish.js b/scripts/publish.js similarity index 100% rename from publish.js rename to scripts/publish.js diff --git a/test/publish.js b/test/publish.js index 5066af4a..91adee24 100644 --- a/test/publish.js +++ b/test/publish.js @@ -4,7 +4,7 @@ import fs from "node:fs/promises"; import path from "node:path"; import { promisify } from "node:util"; -import { publishMods, uploadModRelease } from "../publish.js"; +import { publishMods, uploadModRelease } from "../scripts/publish.js"; const execFileAsync = promisify(execFile); @@ -94,7 +94,7 @@ describe("mod publishing", function() { `; const { stdout, stderr } = await execFileAsync(process.execPath, [ "--import", `data:text/javascript,${encodeURIComponent(mockFetch)}`, - "publish.js", "factorio", directory, "--dry-run", + "scripts/publish.js", "factorio", directory, "--dry-run", ]); assert.equal(stderr, ""); assert(stdout.includes("Requesting current releases of cli_publish_test"));