Skip to content

Commit 274b506

Browse files
authored
Switch to yarn (lucacome#325)
1 parent 521ecae commit 274b506

27 files changed

+7264
-58647
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ dist/
22
lib/
33
node_modules/
44
jest.config.js
5+
/.yarn/

.eslintrc.json

+26-47
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,39 @@
11
{
2-
"plugins": ["jest", "@typescript-eslint", "prettier"],
2+
"env": {
3+
"node": true,
4+
"es6": true,
5+
"jest": true
6+
},
37
"extends": [
48
"eslint:recommended",
9+
"plugin:@typescript-eslint/eslint-recommended",
510
"plugin:@typescript-eslint/recommended",
11+
"plugin:import/errors",
12+
"plugin:import/typescript",
13+
"plugin:import/warnings",
614
"plugin:jest/recommended",
715
"plugin:prettier/recommended"
816
],
917
"parser": "@typescript-eslint/parser",
1018
"parserOptions": {
11-
"ecmaVersion": 9,
12-
"sourceType": "module",
13-
"project": "./tsconfig.json"
19+
"ecmaVersion": 2023,
20+
"sourceType": "module"
1421
},
22+
"plugins": [
23+
"@typescript-eslint",
24+
"jest",
25+
"prettier"
26+
],
1527
"rules": {
16-
"i18n-text/no-en": "off",
17-
"eslint-comments/no-use": "off",
18-
"import/no-namespace": "off",
19-
"no-unused-vars": "off",
20-
"@typescript-eslint/no-unused-vars": "error",
21-
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
22-
"@typescript-eslint/no-require-imports": "error",
23-
"@typescript-eslint/array-type": "error",
24-
"@typescript-eslint/await-thenable": "error",
25-
"@typescript-eslint/ban-ts-comment": "error",
26-
"camelcase": "off",
27-
"@typescript-eslint/consistent-type-assertions": "error",
28-
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
29-
"@typescript-eslint/func-call-spacing": ["error", "never"],
30-
"@typescript-eslint/no-array-constructor": "error",
31-
"@typescript-eslint/no-empty-interface": "error",
32-
"@typescript-eslint/no-explicit-any": "error",
33-
"@typescript-eslint/no-extraneous-class": "error",
34-
"@typescript-eslint/no-for-in-array": "error",
35-
"@typescript-eslint/no-inferrable-types": "error",
36-
"@typescript-eslint/no-misused-new": "error",
37-
"@typescript-eslint/no-namespace": "error",
38-
"@typescript-eslint/no-non-null-assertion": "warn",
39-
"@typescript-eslint/no-unnecessary-qualifier": "error",
40-
"@typescript-eslint/no-unnecessary-type-assertion": "error",
41-
"@typescript-eslint/no-useless-constructor": "error",
42-
"@typescript-eslint/no-var-requires": "error",
43-
"@typescript-eslint/prefer-for-of": "warn",
44-
"@typescript-eslint/prefer-function-type": "warn",
45-
"@typescript-eslint/prefer-includes": "error",
46-
"@typescript-eslint/prefer-string-starts-ends-with": "error",
47-
"@typescript-eslint/promise-function-async": "error",
48-
"@typescript-eslint/require-array-sort-compare": "error",
49-
"@typescript-eslint/restrict-plus-operands": "error",
50-
"semi": "off",
51-
"@typescript-eslint/semi": ["error", "never"],
52-
"@typescript-eslint/type-annotation-spacing": "error",
53-
"@typescript-eslint/unbound-method": "error"
54-
},
55-
"env": {
56-
"node": true,
57-
"es2022": true,
58-
"jest/globals": true
28+
"import/no-unresolved": [
29+
"error",
30+
{
31+
"ignore": [
32+
"csv-parse/sync",
33+
"@octokit/openapi-types"
34+
]
35+
}
36+
],
37+
"jest/no-disabled-tests": 0
5938
}
6039
}

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dist/** -diff linguist-generated=true
1+
dist/** -diff linguist-generated=true

.github/workflows/check-dist.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,25 @@ on:
1818

1919
jobs:
2020
check-dist:
21-
runs-on: ubuntu-latest
21+
runs-on: ubuntu-22.04
2222

2323
steps:
24-
- uses: actions/checkout@v4
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
2526

26-
- name: Set Node.js 16.x
27+
- name: Set Node.js
2728
uses: actions/setup-node@v4
2829
with:
29-
node-version: 16.x
30+
node-version-file: .nvmrc
3031

3132
- name: Install dependencies
32-
run: npm ci
33+
run: |
34+
corepack yarn install
3335
3436
- name: Rebuild the dist/ directory
3537
run: |
36-
npm run build
37-
npm run package
38+
corepack yarn build
39+
3840
3941
- name: Compare the expected and actual dist/ directories
4042
run: |

.github/workflows/codeql.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
jobs:
2424
analyze:
2525
name: Analyze
26-
runs-on: ubuntu-latest
26+
runs-on: ubuntu-22.04
2727
permissions:
2828
actions: read
2929
contents: read

.github/workflows/dependabot-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defaults:
1515
jobs:
1616
build:
1717
if: ${{ github.actor == 'dependabot[bot]' }}
18-
runs-on: ubuntu-latest
18+
runs-on: ubuntu-22.04
1919
steps:
2020
- name: Fetch Dependabot metadata
2121
id: dependabot-metadata

.github/workflows/labeler.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
permissions:
1111
contents: read
1212
pull-requests: write
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-22.04
1414
steps:
1515
- uses: actions/labeler@v5
1616
with:

.github/workflows/lint.yml

+28-8
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,35 @@ on:
88

99
jobs:
1010
lint:
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-22.04
1212
steps:
13-
- uses: actions/checkout@v4
14-
- run: |
15-
npm ci
16-
- run: |
17-
npm run format-check
18-
- run: |
19-
npm run lint
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version-file: .nvmrc
20+
21+
- name: Install dependencies
22+
run: |
23+
corepack yarn install
24+
25+
- name: Lint the code
26+
run: |
27+
corepack yarn run lint
28+
29+
- name: Run format check
30+
run: |
31+
corepack yarn run format
32+
33+
- name: Check for uncommitted changes
34+
run: |
35+
if [ "$(git diff --ignore-space-at-eol | wc -l)" -gt "0" ]; then
36+
echo "Detected uncommitted changes after linting. See status below:"
37+
git diff
38+
exit 1
39+
fi
2040
2141
actionlint:
2242
name: Actionlint

.github/workflows/test-workflow.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88

99
test: # make sure the action works on a clean machine without building
10-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-22.04
1111
steps:
1212
- uses: actions/checkout@v4
1313
- uses: ./
@@ -41,7 +41,7 @@ jobs:
4141
echo "Release Sections: ${{ steps.draft-release.outputs.release-sections }}"
4242
4343
test-dry-run-config:
44-
runs-on: ubuntu-latest
44+
runs-on: ubuntu-22.04
4545
steps:
4646
- uses: actions/checkout@v4
4747
- uses: ./

.github/workflows/test.yml

+12-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@ on:
77

88
jobs:
99
build:
10-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-22.04
1111
steps:
12-
- uses: actions/checkout@v4
12+
- name: Checkout repository
13+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
14+
15+
- name: Set Node.js
16+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
17+
with:
18+
node-version-file: .nvmrc
19+
1320
- run: |
14-
npm ci
21+
corepack yarn install
22+
1523
- run: |
16-
npm run test
24+
corepack yarn run test

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,10 @@ Thumbs.db
9797
# Ignore built ts files
9898
__tests__/runner/*
9999
lib/**/*
100+
101+
# yarn
102+
.yarn/cache
103+
.yarn/unplugged
104+
.yarn/build-state.yml
105+
.yarn/install-state.gz
106+
.pnp.*

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

.pre-commit-config.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
exclude: ^$|^(dist|node_modules)/
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v4.6.0
7+
hooks:
8+
- id: trailing-whitespace
9+
- id: end-of-file-fixer
10+
- id: check-yaml
11+
args: [--allow-multiple-documents]
12+
- id: check-added-large-files
13+
- id: check-merge-conflict
14+
- id: check-case-conflict
15+
- id: check-vcs-permalinks
16+
- id: check-json
17+
- id: pretty-format-json
18+
args: [--autofix, --no-sort-keys, --no-ensure-ascii]
19+
- id: mixed-line-ending
20+
args: [--fix=lf]

.prettierignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
dist/
22
lib/
3-
node_modules/
3+
node_modules/

.prettierrc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"singleQuote": true,
77
"trailingComma": "all",
88
"bracketSpacing": false,
9-
"arrowParens": "always"
9+
"arrowParens": "always",
10+
"parser": "typescript"
1011
}

.yarnrc.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
logFilters:
2+
- code: YN0013
3+
level: discard
4+
- code: YN0019
5+
level: discard
6+
- code: YN0076
7+
level: discard
8+
9+
nodeLinker: node-modules
10+
11+
npmAuthToken: "${NODE_AUTH_TOKEN:-fallback}"

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ on:
2626

2727
jobs:
2828
draft-release:
29-
runs-on: ubuntu-latest
29+
runs-on: ubuntu-22.04
3030
steps:
3131
- uses: actions/checkout@v3
3232
- uses: lucacome/[email protected]
@@ -88,7 +88,7 @@ permissions:
8888
8989
jobs:
9090
draft-release:
91-
runs-on: ubuntu-latest
91+
runs-on: ubuntu-22.04
9292
permissions:
9393
contents: write
9494
steps:
@@ -121,7 +121,7 @@ permissions:
121121
122122
jobs:
123123
draft-release:
124-
runs-on: ubuntu-latest
124+
runs-on: ubuntu-22.04
125125
permissions:
126126
contents: write
127127
steps:

__tests__/notes.test.ts

+10-12
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,27 @@ import {describe, expect, test, it} from '@jest/globals'
22
import {parseNotes, generateReleaseNotes, splitMarkdownSections} from '../src/notes'
33
import * as github from '@actions/github'
44
import {Inputs} from '../src/context'
5-
import {helpers} from 'handlebars'
6-
import {Category} from '../src/version'
75

86
jest.mock('@actions/core')
97
jest.mock('@actions/github')
108

119
let gh: ReturnType<typeof github.getOctokit>
1210

1311
describe('parseNotes', () => {
14-
test('should return patch with empty labels', () => {
15-
let version = parseNotes('### 🐛 Bug Fixes', '', '')
12+
test('should return patch for bug fixes and empty labels', () => {
13+
const version = parseNotes('### 🐛 Bug Fixes', '', '')
1614
expect(version).toEqual('patch')
1715
})
18-
test('should return patch with empty labels', () => {
19-
let version = parseNotes('### 🚀 Features', '', '')
16+
test('should return patch for features and empty labels', () => {
17+
const version = parseNotes('### 🚀 Features', '', '')
2018
expect(version).toEqual('patch')
2119
})
2220
test('should return patch if minor and major are not in notes', () => {
23-
let version = parseNotes('### 🚀 Features', '💣 Breaking Changes', '🐛 Bug Fixes')
21+
const version = parseNotes('### 🚀 Features', '💣 Breaking Changes', '🐛 Bug Fixes')
2422
expect(version).toEqual('patch')
2523
})
2624
test('should return minor', () => {
27-
let version = parseNotes(
25+
const version = parseNotes(
2826
`
2927
### 🚀 Features
3028
some feaures
@@ -38,7 +36,7 @@ describe('parseNotes', () => {
3836
expect(version).toEqual('minor')
3937
})
4038
test('should return minor if major is empty', () => {
41-
let version = parseNotes(
39+
const version = parseNotes(
4240
`
4341
### 💣 Breaking Changes
4442
some breaking changes
@@ -52,7 +50,7 @@ describe('parseNotes', () => {
5250
expect(version).toEqual('minor')
5351
})
5452
test('should return major', () => {
55-
let version = parseNotes(
53+
const version = parseNotes(
5654
`
5755
### 💣 Breaking Changes
5856
some breaking changes
@@ -91,7 +89,7 @@ describe('generateReleaseNotes', () => {
9189
branch: 'main',
9290
nextRelease: 'v1.1.0',
9391
}
94-
92+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
9593
const mockResponse: any = {
9694
data: {
9795
body: 'This is the body',
@@ -131,7 +129,7 @@ describe('generateReleaseNotes', () => {
131129
branch: 'main',
132130
nextRelease: 'v1.1.0',
133131
}
134-
132+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
135133
const mockResponse: any = {
136134
data: {
137135
body: `## What's Changed

0 commit comments

Comments
 (0)