Skip to content

Commit c8a89fa

Browse files
Update toolchain to match latest template
Includes some v fussy lint fixes in the README.
1 parent c4bf059 commit c8a89fa

21 files changed

+41013
-35076
lines changed

.checkov.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# See: https://www.checkov.io/1.Welcome/Quick%20Start.html
2+
3+
compact: true
4+
quiet: true
5+
skip-path:
6+
- coverage
7+
- node_modules

.eslintignore

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

.github/workflows/check-dist.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
name: Check Transpiled JavaScript
1111

1212
on:
13+
pull_request:
14+
branches:
15+
- main
1316
push:
1417
branches:
15-
- '**'
18+
- main
1619

1720
permissions:
1821
contents: read
@@ -25,11 +28,11 @@ jobs:
2528
steps:
2629
- name: Checkout
2730
id: checkout
28-
uses: actions/checkout@v4
31+
uses: actions/checkout@v5
2932

3033
- name: Setup Node.js
3134
id: setup-node
32-
uses: actions/setup-node@v4
35+
uses: actions/setup-node@v6
3336
with:
3437
node-version-file: .node-version
3538
cache: npm
@@ -47,6 +50,11 @@ jobs:
4750
- name: Compare Directories
4851
id: diff
4952
run: |
53+
if [ ! -d dist/ ]; then
54+
echo "Expected dist/ directory does not exist. See status below:"
55+
ls -la ./
56+
exit 1
57+
fi
5058
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
5159
echo "Detected uncommitted changes after build. See status below:"
5260
git diff --ignore-space-at-eol --text dist/
@@ -58,7 +66,7 @@ jobs:
5866
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
5967
name: Upload Artifact
6068
id: upload
61-
uses: actions/upload-artifact@v4
69+
uses: actions/upload-artifact@v5
6270
with:
6371
name: dist
6472
path: dist/

.github/workflows/ci.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
name: Continuous Integration
22

33
on:
4+
pull_request:
5+
branches:
6+
- main
47
push:
58
branches:
6-
- '**'
9+
- main
710

811
permissions:
912
contents: read
@@ -16,11 +19,11 @@ jobs:
1619
steps:
1720
- name: Checkout
1821
id: checkout
19-
uses: actions/checkout@v4
22+
uses: actions/checkout@v5
2023

2124
- name: Setup Node.js
2225
id: setup-node
23-
uses: actions/setup-node@v4
26+
uses: actions/setup-node@v6
2427
with:
2528
node-version-file: .node-version
2629
cache: npm
@@ -40,16 +43,3 @@ jobs:
4043
- name: Test
4144
id: npm-ci-test
4245
run: npm run ci-test
43-
44-
test-action:
45-
name: GitHub Actions Test
46-
runs-on: ubuntu-latest
47-
48-
steps:
49-
- name: Checkout
50-
id: checkout
51-
uses: actions/checkout@v4
52-
53-
- name: Test Local Action
54-
id: test-action
55-
uses: ./

.github/workflows/codeql-analysis.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: CodeQL
22

33
on:
4+
pull_request:
5+
branches:
6+
- main
47
push:
58
branches:
69
- main
@@ -22,24 +25,25 @@ jobs:
2225
fail-fast: false
2326
matrix:
2427
language:
25-
- TypeScript
28+
- typescript
2629

2730
steps:
2831
- name: Checkout
2932
id: checkout
30-
uses: actions/checkout@v4
33+
uses: actions/checkout@v5
3134

3235
- name: Initialize CodeQL
3336
id: initialize
34-
uses: github/codeql-action/init@v3
37+
uses: github/codeql-action/init@v4
3538
with:
39+
config-file: .github/codeql/codeql-config.yml
3640
languages: ${{ matrix.language }}
3741
source-root: src
3842

3943
- name: Autobuild
4044
id: autobuild
41-
uses: github/codeql-action/autobuild@v3
45+
uses: github/codeql-action/autobuild@v4
4246

4347
- name: Perform CodeQL Analysis
4448
id: analyze
45-
uses: github/codeql-action/analyze@v3
49+
uses: github/codeql-action/analyze@v4

.github/workflows/linter.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
# This workflow will lint the entire codebase using the
2+
# `super-linter/super-linter` action.
3+
#
4+
# For more information, see the super-linter repository:
5+
# https://github.com/super-linter/super-linter
16
name: Lint Codebase
27

38
on:
9+
pull_request:
10+
branches:
11+
- main
412
push:
513
branches:
6-
- '**'
14+
- main
715

816
permissions:
917
contents: read
@@ -18,13 +26,13 @@ jobs:
1826
steps:
1927
- name: Checkout
2028
id: checkout
21-
uses: actions/checkout@v4
29+
uses: actions/checkout@v5
2230
with:
2331
fetch-depth: 0
2432

2533
- name: Setup Node.js
2634
id: setup-node
27-
uses: actions/setup-node@v4
35+
uses: actions/setup-node@v6
2836
with:
2937
node-version-file: .node-version
3038
cache: npm
@@ -35,12 +43,18 @@ jobs:
3543

3644
- name: Lint Codebase
3745
id: super-linter
38-
uses: super-linter/super-linter/slim@v6
46+
uses: super-linter/super-linter/slim@v8
3947
env:
48+
CHECKOV_FILE_NAME: .checkov.yml
4049
DEFAULT_BRANCH: main
4150
FILTER_REGEX_EXCLUDE: dist/**/*
4251
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43-
TYPESCRIPT_DEFAULT_STYLE: prettier
52+
LINTER_RULES_PATH: .
4453
VALIDATE_ALL_CODEBASE: true
45-
VALIDATE_JAVASCRIPT_STANDARD: false
54+
VALIDATE_BIOME_FORMAT: false
55+
VALIDATE_BIOME_LINT: false
56+
VALIDATE_GITHUB_ACTIONS_ZIZMOR: false
57+
VALIDATE_JAVASCRIPT_ES: false
4658
VALIDATE_JSCPD: false
59+
VALIDATE_TYPESCRIPT_ES: false
60+
VALIDATE_JSON: false

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20.6.0
1+
24.1.0

README.md

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# NPM package versioner GitHub action
1+
# npm package versioner GitHub Action
22

33
[![GitHub Super-Linter](https://github.com/actions/typescript-action/actions/workflows/linter.yml/badge.svg)](https://github.com/super-linter/super-linter)
44
![CI](https://github.com/actions/typescript-action/actions/workflows/ci.yml/badge.svg)
55
[![Check dist/](https://github.com/actions/typescript-action/actions/workflows/check-dist.yml/badge.svg)](https://github.com/actions/typescript-action/actions/workflows/check-dist.yml)
66
[![CodeQL](https://github.com/actions/typescript-action/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/actions/typescript-action/actions/workflows/codeql-analysis.yml)
77
[![Coverage](./badges/coverage.svg)](./badges/coverage.svg)
88

9-
A GitHub Action that automatically manages semantic versioning for NPM packages
9+
A GitHub Action that automatically manages semantic versioning for npm packages
1010
based on your CI/CD context.
1111

1212
## Purpose
@@ -16,9 +16,9 @@ file based on the GitHub Actions environment. It generates semantic version
1616
numbers appropriate to your build context:
1717

1818
- **Tags**: Uses the tag name as the version (e.g., `v1.2.3` becomes `1.2.3`)
19-
- **Branches**: Creates pre-release versions with the branch name and build
19+
- **Branches**: Creates prerelease versions with the branch name and build
2020
number (e.g., `1.0.0-feature.123.456`)
21-
- **Local development**: Adds a `-local` pre-release identifier
21+
- **Local development**: Adds a `-local` prerelease identifier
2222

2323
This eliminates manual version management and ensures consistent versioning
2424
across your CI/CD pipeline.
@@ -86,33 +86,56 @@ This makes it clear that:
8686

8787
- The version is automatically managed by the CI/CD pipeline
8888
- The checked-in version is not intended for publication
89-
- Local development will use the `-local` pre-release identifier
89+
- Local development will use the `-local` prerelease identifier
9090

9191
The action will overwrite this placeholder with the appropriate version during
9292
your CI/CD workflow.
9393

9494
## Development
9595

96-
1. :hammer_and_wrench: Install the dependencies
96+
### Prerequisites
97+
98+
- Node.js 24.x or later
99+
- npm
100+
101+
### Setup and Building
102+
103+
1. Install the dependencies
97104

98105
```bash
99106
npm install
100107
```
101108

102-
1. Format, test, and build the action
109+
2. Format, test, and build the action
103110

104111
```bash
105112
npm run all
106113
```
107114

108-
> This step is important! It will run [`ncc`](https://github.com/vercel/ncc)
109-
> to build the final JavaScript action code with all dependencies included.
110-
> If you do not run this step, your action will not work correctly when it is
111-
> used in a workflow. This step also includes the `--license` option for
112-
> `ncc`, which will create a license file for all of the production node
113-
> modules used in your project.
114-
115-
This generates files that must be committed.
115+
This will:
116+
- Format code with Prettier
117+
- Lint with ESLint
118+
- Run tests with Jest
119+
- Generate coverage reports
120+
- Build the distribution bundle with Rollup
121+
122+
> **Important:** The build step uses [Rollup](https://rollupjs.org/) to
123+
> bundle the TypeScript source into a single ES module at `dist/index.js`
124+
> with all dependencies included. You must run `npm run all` (or
125+
> `npm run package`) before committing to ensure the `dist/` directory is up
126+
> to date.
127+
128+
### Available Scripts
129+
130+
- `npm run format:write` - Format code with Prettier
131+
- `npm run format:check` - Check code formatting
132+
- `npm run lint` - Lint code with ESLint
133+
- `npm test` - Run tests
134+
- `npm run coverage` - Generate coverage badge
135+
- `npm run package` - Build the distribution bundle
136+
- `npm run all` - Run all of the above
137+
138+
The generated `dist/` directory must be committed to the repository.
116139

117140
## License
118141

__tests__/index.test.ts

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

__tests__/version.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
/* eslint-disable @typescript-eslint/no-floating-promises */
2-
import { contextFromEnvironment, generateVersion } from '../src/version'
1+
import { contextFromEnvironment, generateVersion } from '../src/version.js'
32

43
describe(`generateVersion`, () => {
54
const defaultContext = {

0 commit comments

Comments
 (0)