Skip to content

Commit 961eb02

Browse files
authored
Modernize: Node 24, jscpd 5, .NET 10, Biome, node:test (#116)
* feat: bump action runtime to node24 GitHub Actions removed the node16 runtime, so the action no longer starts on current runners. Move runs.using to node24. Claude-Session: https://claude.ai/code/session_01JxEe85CyGm5rCeoLFdUZed * build: modernize toolchain to Node 24, Biome, node:test, ESM - Move to ESM ("type": "module") with nodenext + rewriteRelativeImportExtensions and verbatimModuleSyntax so the source runs under node --test natively. - Replace ESLint 8 + Prettier with Biome (biome.json mirrors prior style). - Replace Jest/ts-jest/babel with Node's built-in test runner. - Bump @types/node 24, TypeScript 5.9, @vercel/ncc 0.44; devcontainer node 24 + .NET 10; CI setup-node 24. finalize-dist.mjs copies the problem matcher. Claude-Session: https://claude.ai/code/session_01JxEe85CyGm5rCeoLFdUZed * refactor: run jscpd 5 via CLI instead of the removed Node API jscpd 5 is a Rust CLI with no in-process Node API and @jscpd/* libs stopped exposing detectClones. duplicated.ts now prefers a jscpd/cpd binary on PATH and falls back to `npx --yes jscpd@5`, then parses the JSON report (same schema). @jscpd/core types are replaced with local interfaces in modals.ts. Claude-Session: https://claude.ai/code/session_01JxEe85CyGm5rCeoLFdUZed * fix: ESM source, native fetch, io.rmRF, and config/arg bug fixes - Drop node-fetch (native fetch); replace shelled rm -rf with io.rmRF. - Accept both isEnabled and legacy isEabled; resolve defaults without masking. - Fix --include builder (no literal "undefined"); drop duplicate git status. - ESM: .ts import extensions, import.meta.url for __dirname, enum (not const enum). Claude-Session: https://claude.ai/code/session_01JxEe85CyGm5rCeoLFdUZed * test: convert suite to node:test Rewrite the four test files for node:test + node:assert. Avoid module mocking: readConfig uses real temp files; dotnet captures stdout for the setFailed case. Adds a legacy-isEabled backward-compat case. Claude-Session: https://claude.ai/code/session_01JxEe85CyGm5rCeoLFdUZed * feat: target .NET 10 in fixtures and tests Bump test projects to net10.0, pin the SDK via global.json, and add actions/setup-dotnet@v4 (10.0.x) to the test workflow. Read the real hasChanges/hasDuplicates outputs via env vars. Claude-Session: https://claude.ai/code/session_01JxEe85CyGm5rCeoLFdUZed * docs: add modernization walkthrough and update README Document Node 24 / jscpd 5 / .NET 10 requirements, the isEnabled key, and the Biome + node:test dev workflow. Fix the "Aknowledgements" typo. Claude-Session: https://claude.ai/code/session_01JxEe85CyGm5rCeoLFdUZed * chore: rebuild dist bundle Regenerate the ncc ESM bundle for the modernized source and remove stale jscpd-v3 reporter assets (main.pug, public/, code-split chunk). Claude-Session: https://claude.ai/code/session_01JxEe85CyGm5rCeoLFdUZed
1 parent 9e8dc26 commit 961eb02

45 files changed

Lines changed: 122892 additions & 202556 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/devcontainer.json

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,22 @@
33
{
44
"name": "Node.js & TypeScript",
55
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6-
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
6+
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-24-bookworm",
77
"features": {
88
"ghcr.io/devcontainers/features/dotnet:2": {
9-
"version": "lts"
9+
"version": "10.0"
1010
},
1111
"ghcr.io/devcontainers/features/github-cli:1": {
1212
"installDirectlyFromGitHubRelease": true,
1313
"version": "latest"
14-
},
15-
"ghcr.io/devcontainers-contrib/features/jest:2": {}
14+
}
1615
},
1716

1817
// Use 'forwardPorts' to make a list of ports inside the container available locally.
1918
// "forwardPorts": [],
2019

2120
// Use 'postCreateCommand' to run commands after the container is created.
22-
// "postCreateCommand": "yarn install",
21+
// "postCreateCommand": "pnpm install",
2322

2423
"customizations": {
2524
"vscode": {
@@ -29,14 +28,11 @@
2928
"bierner.emojisense",
3029
"djlynn03.add-to-git-ignore",
3130
"EditorConfig.EditorConfig",
32-
"dbaeumer.vscode-eslint",
31+
"biomejs.biome",
3332
"mhutchie.git-graph",
3433
"GitHub.copilot",
3534
"GitHub.copilot-chat",
3635
"eamodio.gitlens",
37-
"vespa-dev-works.jestRunIt",
38-
"firsttris.vscode-jest-runner",
39-
"kavod-io.vscode-jest-test-adapter",
4036
"christian-kohler.path-intellisense",
4137
"pflannery.vscode-versionlens",
4238
"rioukkevin.vscode-git-commit",

.eslintignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 88 deletions
This file was deleted.

.github/workflows/test-dotnet-format.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ jobs:
1515
steps:
1616
- name: checkout
1717
uses: actions/checkout@v4
18+
- name: setup-dotnet
19+
uses: actions/setup-dotnet@v4
20+
with:
21+
dotnet-version: "10.0.x"
1822
- name: dotnet-format
1923
id: dotnet-format
2024
uses: ./
@@ -27,14 +31,23 @@ jobs:
2731
jscpdCheckAsError: true
2832

2933
- name: log-output
30-
run: echo "${{ steps.dotnet-format.outputs.output }}"
34+
env:
35+
HAS_CHANGES: ${{ steps.dotnet-format.outputs.hasChanges }}
36+
HAS_DUPLICATES: ${{ steps.dotnet-format.outputs.hasDuplicates }}
37+
run: |
38+
echo "hasChanges=$HAS_CHANGES"
39+
echo "hasDuplicates=$HAS_DUPLICATES"
3140
3241
dotnet-format-config:
3342
name: "🧪 Test dotnet-format with config"
3443
runs-on: ubuntu-latest
3544
steps:
3645
- name: checkout
3746
uses: actions/checkout@v4
47+
- name: setup-dotnet
48+
uses: actions/setup-dotnet@v4
49+
with:
50+
dotnet-version: "10.0.x"
3851
- name: dotnet-format
3952
id: dotnet-format
4053
uses: ./
@@ -46,4 +59,9 @@ jobs:
4659
jscpdCheckAsError: true
4760

4861
- name: log-output
49-
run: echo "${{ steps.dotnet-format.outputs.output }}"
62+
env:
63+
HAS_CHANGES: ${{ steps.dotnet-format.outputs.hasChanges }}
64+
HAS_DUPLICATES: ${{ steps.dotnet-format.outputs.hasDuplicates }}
65+
run: |
66+
echo "hasChanges=$HAS_CHANGES"
67+
echo "hasDuplicates=$HAS_DUPLICATES"

.prettierignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.prettierrc.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
{
2-
"typescript.format.semicolons": "insert",
3-
"typescript.inlayHints.enumMemberValues.enabled": true,
2+
"editor.defaultFormatter": "biomejs.biome",
3+
"editor.formatOnSave": true,
4+
"editor.codeActionsOnSave": {
5+
"source.fixAll.biome": "explicit"
6+
},
7+
"[typescript]": {
8+
"editor.defaultFormatter": "biomejs.biome"
9+
},
10+
"[javascript]": {
11+
"editor.defaultFormatter": "biomejs.biome"
12+
},
13+
"[json]": {
14+
"editor.defaultFormatter": "biomejs.biome"
15+
},
416
"typescript.implementationsCodeLens.enabled": true,
5-
"javascript.referencesCodeLens.enabled": true,
6-
"javascript.referencesCodeLens.showOnAllFunctions": true,
717
"typescript.referencesCodeLens.enabled": true,
818
"typescript.referencesCodeLens.showOnAllFunctions": true
919
}

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ Yet another dotnet format. It combines dotnet format with jscpd to provide a sin
1414
- (optional) commit changes
1515
- (optional) update existing PR comment
1616

17+
## Requirements
18+
19+
- **Node 24** runtime — the action runs on `node24` (handled automatically by GitHub).
20+
- **.NET SDK** must be available on the runner (e.g. via `actions/setup-dotnet`). The
21+
bundled example/tests target **.NET 10**.
22+
- **jscpd 5** — when `jscpdCheck` is enabled, the action uses a `jscpd`/`cpd` binary found
23+
on `PATH`, otherwise it fetches it on demand with `npx --yes jscpd@5` (a one-time download).
24+
To avoid the download, install jscpd on the runner (`npm i -g jscpd`).
25+
26+
> Note on config keys: the granular `options`/`styleOptions`/`analyzersOptions`/`whitespaceOptions`
27+
> blocks are toggled with `isEnabled`. The historical misspelling `isEabled` is still accepted for
28+
> backward compatibility.
29+
1730
## Demo
1831

1932
- generate report as comment
@@ -38,7 +51,29 @@ example:
3851
- [example jscpd config](./__tests__/dotnet/ConfigConsoleApp/.jscpd.json)
3952
- [Action input](./action.yml)
4053

41-
## Aknowledgements
54+
## Development
55+
56+
This is a TypeScript GitHub Action bundled with [`ncc`](https://github.com/vercel/ncc) into
57+
`dist/`. The toolchain is modern and dependency-light:
58+
59+
- **Node 24** (ESM, `"type": "module"`)
60+
- **[pnpm](https://pnpm.io/)** as the package manager (`packageManager` field; CI uses `pnpm/action-setup`)
61+
- **[Biome](https://biomejs.dev/)** for linting + formatting (`biome.json`)
62+
- **`node:test`** (Node's built-in runner) for tests — no Jest
63+
64+
```bash
65+
pnpm install
66+
pnpm build # tsc --noEmit typecheck
67+
pnpm lint # biome lint
68+
pnpm test # node --test
69+
pnpm package # ncc build -> dist/index.js
70+
pnpm all # everything CI runs (build, format-check, package, test, finalize dist)
71+
```
72+
73+
The committed `dist/` must stay in sync with the source — run `pnpm all` and commit `dist/`
74+
before pushing. See [WALKTHROUGH.md](./WALKTHROUGH.md) for the design rationale and migration notes.
75+
76+
## Acknowledgements
4277

4378
This project is based on / inspired by lots of other projects, including but not limited to:
4479

0 commit comments

Comments
 (0)