Skip to content

Commit 34c75ba

Browse files
committed
Native ESM
Signed-off-by: Sora Morimoto <sora@morimoto.io>
1 parent 9a8ccd0 commit 34c75ba

31 files changed

Lines changed: 2307 additions & 6567 deletions

.eslintrc.json

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Example Dependency Submission
2-
on:
3-
push
2+
3+
on: push
44

55
permissions:
66
contents: write
@@ -9,21 +9,19 @@ jobs:
99
example-submission:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: 'Checkout Repository'
13-
uses: actions/checkout@v4
12+
- uses: actions/checkout@v4
13+
1414
- uses: actions/setup-node@v4
15-
# As of 2023-02-22, the ubuntu-latest image uses npm v8.3.1. This version
16-
# has a bug that prevents loading dependency-submission-toolkit in the
17-
# 'example/' project. npm v8.4.1 (same version in Codespace created on
18-
# same date) is known to work. Not pinned to latest to avoid
19-
# reproducibility issues.
20-
- run: npm install npm@8.4.1 -g
21-
- name: Install NPM dependencies
22-
run: npm ci
23-
- name: Run all NPM build/test actions
24-
run: npm -w:example rebuild && npm run all -w:example
15+
with:
16+
node-version: 20
17+
18+
- run: npm ci
19+
20+
- run: npm run all
21+
22+
- run: npm run all:example
23+
2524
- name: Run dependency submission
2625
uses: ./
27-
id: example
2826
with:
2927
npm-package-directory: ./

.github/workflows/publish.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,21 @@ jobs:
88
publish-npm:
99
runs-on: ubuntu-latest
1010
steps:
11-
- name: Checkout the project
12-
uses: actions/checkout@v4
13-
- name: Use Node.js 16.x (LTS)
14-
uses: actions/setup-node@v4
11+
- uses: actions/checkout@v4
12+
13+
- uses: actions/setup-node@v4
1514
with:
16-
node-version: 16.x
17-
registry-url: https://registry.npmjs.org/
18-
cache: npm
15+
node-version: 20
16+
registry-url: https://registry.npmjs.org
17+
1918
- run: npm ci
19+
2020
- run: npm test
21+
2122
- run: npm version ${TAG_NAME} --git-tag-version=false --allow-same-version
2223
env:
2324
TAG_NAME: ${{ github.event.release.tag_name }}
25+
2426
- run: npm whoami; npm publish --access public
2527
env:
26-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
28+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}

.github/workflows/test.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
1-
name: 'build-test'
1+
name: build-test
2+
23
on: # rebuild any PRs and main branch changes
34
pull_request:
4-
branches:
5+
branches:
56
- main
6-
- 'releases/*'
7+
- releases/*
78
push:
89
branches:
910
- main
10-
- 'releases/*'
11+
- releases/*
1112

1213
jobs:
1314
build: # make sure build/ci work properly
1415
runs-on: ubuntu-latest
1516
steps:
1617
- uses: actions/checkout@v4
17-
# As of 2023-02-22, the ubuntu-latest image uses npm v8.3.1. This version
18-
# has a bug that prevents loading dependency-submission-toolkit in the
19-
# 'example/' project. npm v8.4.1 (same version in Codespace created on
20-
# same date) is known to work. Not pinned to latest to avoid
21-
# reproducibility issues.
22-
- run: npm install npm@8.4.1 -g
23-
- name: Install NPM dependencies
24-
run: npm ci
25-
- run: npm install
26-
- name: Run all NPM build/test actions
27-
run: npm rebuild && npm run all
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
23+
- run: npm ci
24+
25+
- run: npm run all

.npmignore

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

.prettierignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.prettierrc

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

action.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
name: 'Example Dependency Submission Action'
2-
description: 'Example action using the dependency-submission-toolkit and npm'
1+
name: Example Dependency Submission Action
2+
description: Example action using the dependency-submission-toolkit and npm
33
inputs:
44
token:
5-
description: "GitHub Personal Access Token (PAT). Defaults to PAT provided by Action runner"
5+
description: GitHub Personal Access Token (PAT). Defaults to PAT provided by Action runner
66
required: false
77
default: ${{ github.token }}
88
npm-package-directory:
9-
description: 'NPM package directory (directory with package.json)'
9+
description: NPM package directory (directory with package.json)
1010
required: true
11-
default: './'
11+
default: ./
1212
runs:
13-
using: 'node16'
14-
main: 'example/action-dist/index.js'
13+
using: node20
14+
main: example/dist/index.js

biome.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "node_modules/@biomejs/biome/configuration_schema.json",
3+
"files": {
4+
"ignoreUnknown": true
5+
},
6+
"formatter": {
7+
"enabled": true,
8+
"indentStyle": "space"
9+
},
10+
"javascript": {
11+
"formatter": {
12+
"quoteStyle": "single",
13+
"semicolons": "asNeeded",
14+
"trailingComma": "none"
15+
}
16+
},
17+
"linter": {
18+
"enabled": true,
19+
"rules": {
20+
"recommended": true
21+
}
22+
},
23+
"organizeImports": {
24+
"enabled": true
25+
},
26+
"vcs": {
27+
"clientKind": "git",
28+
"enabled": true,
29+
"useIgnoreFile": true
30+
}
31+
}

example/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import { main } from './npm-detector'
1+
import { main } from './npm-detector.js'
22

33
main()

0 commit comments

Comments
 (0)