Skip to content

Commit 4683764

Browse files
authored
Switch from yarn to npm and refactor the action code (#34)
1 parent 1173e98 commit 4683764

24 files changed

+1363
-946
lines changed

.devcontainer/devcontainer.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.base.schema.json",
3+
"name": "default",
4+
"image": "node:20-bookworm",
5+
"features": {
6+
"ghcr.io/devcontainers/features/github-cli:1": {},
7+
"ghcr.io/devcontainers/features/sshd:1": {}
8+
},
9+
"customizations": {
10+
"vscode": {
11+
"extensions": [
12+
"streetsidesoftware.code-spell-checker"
13+
]
14+
}
15+
},
16+
"postCreateCommand": "npm install"
17+
}

.editorconfig

+7
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,10 @@ insert_final_newline = true
99
indent_style = space
1010
indent_size = 2
1111
trim_trailing_whitespace = true
12+
13+
[{*.yml,*.yaml}]
14+
ij_any_spaces_within_braces = false
15+
ij_any_spaces_within_brackets = false
16+
17+
[Makefile]
18+
indent_style = tab

.eslintrc.json

-19
This file was deleted.

.gitattributes

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dist/** -diff linguist-generated=true
1+
* text=auto
22

3-
# Disable next extensions in project "used languages" list
3+
dist/** -diff linguist-generated=true
44
Makefile linguist-detectable=false

.github/dependabot.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Docs: <https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/customizing-dependency-updates>
1+
# yaml-language-server: $schema=https://json.schemastore.org/dependabot-2.0.json
2+
# docs: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/customizing-dependency-updates
23

34
version: 2
45

.github/release.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-release-config.json
2+
# docs: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
3+
4+
changelog:
5+
categories:
6+
- title: 🛠 Fixes
7+
labels: [type:fix, type:bug]
8+
- title: 🚀 Features
9+
labels: [type:feature, type:feature_request]
10+
- title: 📦 Dependency updates
11+
labels: [dependencies]
12+
- title: Other Changes
13+
labels: ['*']

.github/workflows/dependabot.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
name: dependabot
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
# docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
3+
4+
name: 🤖 Dependabot
25

36
on:
47
pull_request: {}
@@ -9,15 +12,15 @@ permissions:
912

1013
jobs:
1114
dependabot: # https://tinyurl.com/e69djmen
15+
name: Enable auto-merge for Dependabot PRs
1216
runs-on: ubuntu-latest
1317
if: ${{ github.actor == 'dependabot[bot]' }}
1418
steps:
1519
- uses: dependabot/fetch-metadata@v2
1620
id: metadata
1721
with: {github-token: "${{ secrets.GITHUB_TOKEN }}"}
1822

19-
- name: Enable auto-merge for Dependabot PRs
20-
if: ${{ contains(fromJSON('["version-update:semver-minor", "version-update:semver-patch"]'), steps.metadata.outputs.update-type) }}
23+
- if: ${{ contains(fromJSON('["version-update:semver-minor", "version-update:semver-patch"]'), steps.metadata.outputs.update-type) }}
2124
run: gh pr merge --auto --merge "$PR_URL"
2225
env:
2326
PR_URL: ${{ github.event.pull_request.html_url }}

.github/workflows/release.yml

+8-12
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
1-
name: release
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
# docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
3+
4+
name: 🚀 Release
25

36
on:
47
release: # Docs: <https://help.github.com/en/articles/events-that-trigger-workflows#release-event-release>
58
types: [published]
69

710
jobs:
8-
update-git-tag: # Reason: <https://github.com/actions/toolkit/blob/main/docs/action-versioning.md#recommendations>
11+
update-git-tag: # Reason: <https://github.com/actions/toolkit/blob/master/docs/action-versioning.md#recommendations>
912
name: Update latest major git tag
10-
runs-on: ubuntu-20.04
11-
permissions: write-all
13+
runs-on: ubuntu-latest
1214
steps:
1315
- uses: actions/checkout@v4
14-
15-
- uses: gacts/github-slug@v1
16-
id: slug
17-
18-
- name: Setup git
19-
env: {REPO_PATH: "${{ github.repository_owner }}/${{ github.event.repository.name }}"}
16+
- {uses: gacts/github-slug@v1, id: slug}
17+
- env: {REPO_PATH: "${{ github.repository_owner }}/${{ github.event.repository.name }}"}
2018
run: |
2119
git config --local user.email '[email protected]'
2220
git config --local user.name "${{ github.actor }}"
2321
git remote set-url origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/$REPO_PATH.git"
24-
2522
- name: Update major tag
2623
env: {VERSION: "${{ steps.slug.outputs.version-major }}"}
2724
run: |
2825
git tag -fa "v$VERSION" -m "Update v$VERSION tag (using GitHub actions)"
2926
git push --set-upstream origin "v$VERSION" --force
30-
3127
- name: Update minor tag
3228
env: {VERSION: "${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}"}
3329
run: |

.github/workflows/tests.yml

+33-58
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,72 @@
1-
name: tests
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
# docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
3+
4+
name: 🧪 Tests
25

36
on:
47
push:
5-
branches: [ master, main ]
6-
tags-ignore: [ '**' ]
7-
paths-ignore: [ '**.md' ]
8+
branches: [master, main]
9+
tags-ignore: ['**']
10+
paths-ignore: ['**.md']
811
pull_request:
9-
paths-ignore: [ '**.md' ]
12+
paths-ignore: ['**.md']
13+
14+
concurrency:
15+
group: ${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
env: {FORCE_COLOR: 'true'}
1019

1120
jobs:
1221
gitleaks:
13-
name: Gitleaks
14-
runs-on: ubuntu-20.04
22+
name: Check for GitLeaks
23+
runs-on: ubuntu-latest
1524
steps:
16-
- uses: actions/checkout@v4
17-
with: { fetch-depth: 0 }
18-
19-
- name: Check for GitLeaks
20-
uses: gacts/gitleaks@v1 # Action page: <https://github.com/gacts/gitleaks>
25+
- {uses: actions/checkout@v4, with: {fetch-depth: 0}}
26+
- uses: gacts/gitleaks@v1
2127

2228
eslint:
23-
name: Run eslint
24-
runs-on: ubuntu-20.04
25-
env: { FORCE_COLOR: 'true' }
29+
name: Run code linter
30+
runs-on: ubuntu-latest
2631
steps:
2732
- uses: actions/checkout@v4
28-
29-
- uses: actions/setup-node@v4
30-
with: { node-version: '20' }
31-
32-
- uses: actions/cache@v4
33-
id: yarn-cache
34-
with:
35-
path: '**/node_modules'
36-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
37-
restore-keys: ${{ runner.os }}-yarn-
38-
39-
- if: steps.yarn-cache.outputs.cache-hit != 'true'
40-
run: yarn install --frozen-lockfile --no-progress --non-interactive
41-
42-
- run: yarn lint
33+
- {uses: gacts/setup-node-with-cache@v1, with: {node-version: 20}}
34+
- run: npm install
35+
- run: npm run lint
4336

4437
dist-built:
4538
name: Check distributive built state
46-
runs-on: ubuntu-20.04
39+
runs-on: ubuntu-latest
4740
outputs:
4841
dist-changed: ${{ steps.state.outputs.changed }}
49-
env: { FORCE_COLOR: 'true' }
5042
steps:
5143
- uses: actions/checkout@v4
52-
53-
- uses: actions/setup-node@v4
54-
with: { node-version: '20' }
55-
56-
- uses: actions/cache@v4
57-
id: yarn-cache
58-
with:
59-
path: '**/node_modules'
60-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
61-
restore-keys: ${{ runner.os }}-yarn-
62-
63-
- if: steps.yarn-cache.outputs.cache-hit != 'true'
64-
run: yarn install --frozen-lockfile --no-progress --non-interactive
65-
66-
- run: yarn build
67-
44+
- {uses: gacts/setup-node-with-cache@v1, with: {node-version: 20}}
45+
- run: npm install
46+
- run: npm run build
6847
- uses: actions/upload-artifact@v4
69-
with: { name: dist, path: ./dist/, retention-days: 1 }
70-
48+
with: {name: dist, path: ./dist/, retention-days: 1}
7149
- id: state
7250
run: echo "changed=`git diff --diff-filter=ACMUXTR --name-only | grep dist/ > /dev/null && echo 'true' || echo 'false'`" >> $GITHUB_OUTPUT
7351

7452
commit-and-push-fresh-dist:
7553
name: Commit and push fresh distributive
76-
needs: [ dist-built ]
54+
needs: [dist-built]
7755
if: ${{ needs.dist-built.outputs.dist-changed == 'true' }}
78-
runs-on: ubuntu-20.04
56+
runs-on: ubuntu-latest
7957
permissions:
8058
contents: write
8159
pull-requests: write
8260
steps:
8361
- uses: actions/checkout@v4
84-
8562
- uses: actions/download-artifact@v4
86-
with: { name: dist, path: ./dist/ }
87-
63+
with: {name: dist, path: ./dist/}
8864
- uses: stefanzweifel/git-auto-commit-action@v5
89-
with:
90-
commit_message: Automatic distributive rebuild
65+
with: {commit_message: Automatic distributive rebuild}
9166

9267
run-this-action:
9368
name: Run action
94-
runs-on: ubuntu-20.04
69+
runs-on: ubuntu-latest
9570
steps:
9671
- uses: actions/checkout@v4
9772

.gitignore

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88
# Environment files
99
*.env
1010

11-
# npm lock file (use yarn only)
12-
package-lock.json
11+
# yarn lock file (use npm only)
12+
yarn.lock
1313

1414
# Logs
1515
logs
1616
*.log
17-
yarn-debug.log*
18-
yarn-error.log*
1917

2018
# Temp dirs & trash
2119
/temp

CHANGELOG.md

-66
This file was deleted.

0 commit comments

Comments
 (0)