Skip to content

Commit 57c9a64

Browse files
committed
feat: upgrade commitlint to latest version
1 parent 5ce82f5 commit 57c9a64

17 files changed

+5607
-3751
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
"node/no-unpublished-require": "off",
2020
"node/no-unpublished-import": "off",
2121
"node/no-unsupported-features/es-syntax": "off"
22-
}
22+
},
23+
"ignorePatterns": [".github/tasks/actionYamlUpdater.js", "rollup.config.js"]
2324
}

.github/tasks/actionYamlUpdater.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ const yaml = require('yaml')
33

44
const versionRegex = /\d+\.\d+\.\d+/
55

6-
module.exports.readVersion = (contents) =>
6+
exports.readVersion = (contents) =>
77
yaml.parse(contents).runs.image.match(versionRegex)[0]
88

9-
module.exports.writeVersion = (contents, version) => {
9+
exports.writeVersion = (contents, version) => {
1010
const actionFile = yaml.parse(contents)
1111
actionFile.runs.image = actionFile.runs.image.replace(versionRegex, version)
1212

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ jobs:
5353
git config user.email '[email protected]'
5454
git config user.name 'GitHub Action'
5555
- name: Update versions and changelog
56-
run: npx commit-and-tag-version
56+
run: |
57+
# remove `"type": "module"` from package.json since `commit-and-tag-version` doesn't support it
58+
sed -i '/"type": "module",/c\' package.json
59+
npx commit-and-tag-version
60+
git checkout package.json
5761
- name: Set VERSION env var
5862
run: |
5963
version=`node -p "require('./package.json').version"`

.lintstagedrc.js renamed to .lintstagedrc.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
'*.{ts,tsx,vue,css,less,scss,html,htm,md,markdown}': 'prettier --write',
33
'*.{json,yml,yaml}': ['prettier --write', () => 'npm run test'],
44
'*.{js,jsx}': ['eslint --fix', () => 'npm run test'],

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:16.14.2-alpine3.14 as build
1+
FROM node:20.9.0-alpine3.17 as build
22

33
COPY package*.json /
44

commitlint.config.js renamed to commitlint.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable import/no-extraneous-dependencies */
2-
const { maxLineLength } = require('@commitlint/ensure')
2+
import { maxLineLength } from '@commitlint/ensure'
33

44
const bodyMaxLineLength = 100
55

@@ -14,7 +14,7 @@ const validateBodyMaxLengthIgnoringDeps = (parsedCommit) => {
1414
]
1515
}
1616

17-
module.exports = {
17+
export default {
1818
extends: ['@commitlint/config-conventional'],
1919
plugins: ['commitlint-plugin-function-rules'],
2020
rules: {

entrypoint.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ set -e
55
if [ -z "$NODE_PATH" ]; then
66
export NODE_PATH=/node_modules
77
else
8-
export NODE_PATH=$NODE_PATH:/node_modules
8+
export NODE_PATH="$NODE_PATH":/node_modules
99
fi
1010

1111
# Since actions/checkout can be setup with a different user ID, we need to set the workspace as safe inside this action
1212
# Info about the vunlerability: https://github.blog/2022-04-12-git-security-vulnerability-announced/
1313
git config --global --add safe.directory "$GITHUB_WORKSPACE"
1414

15-
node /run.js
15+
export NODE_OPTIONS="$NODE_OPTIONS --experimental-vm-modules"
16+
17+
node /run.mjs
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
module.exports = {
1+
export default {
22
// Automatically clear mock calls and instances between every test
3-
// preset: 'rollup-jest',
43
clearMocks: true,
54
testEnvironment: '@commitlint/test-environment',
5+
testMatch: [
6+
'**/__tests__/**/*.?(m)[jt]s?(x)',
7+
'**/?(*.)+(spec|test).?(m)[tj]s?(x)',
8+
],
69
transform: {
710
'\\.[jt]sx?$': 'babel-jest',
811
},
9-
transformIgnorePatterns: ['node_modules/(?!dargs)'],
1012
}

0 commit comments

Comments
 (0)