Skip to content

Commit 06143b2

Browse files
committed
fix: rollback update of commitlint to support configs that use commonjs
1 parent e15adf3 commit 06143b2

17 files changed

+3759
-5618
lines changed

.eslintrc.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,5 @@
1919
"node/no-unpublished-require": "off",
2020
"node/no-unpublished-import": "off",
2121
"node/no-unsupported-features/es-syntax": "off"
22-
},
23-
"ignorePatterns": [
24-
".github/tasks/actionYamlUpdater.js",
25-
"rollup.config.js",
26-
"fixtures"
27-
]
22+
}
2823
}

.github/tasks/actionYamlUpdater.js

+2-2
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-
exports.readVersion = (contents) =>
6+
module.exports.readVersion = (contents) =>
77
yaml.parse(contents).runs.image.match(versionRegex)[0]
88

9-
exports.writeVersion = (contents, version) => {
9+
module.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

+1-5
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,7 @@ jobs:
5353
git config user.email '[email protected]'
5454
git config user.name 'GitHub Action'
5555
- name: Update versions and changelog
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
56+
run: npx commit-and-tag-version
6157
- name: Set VERSION env var
6258
run: |
6359
version=`node -p "require('./package.json').version"`

.lintstagedrc.mjs renamed to .lintstagedrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default {
1+
module.exports = {
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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20.9.0-alpine3.17 as build
1+
FROM node:16.14.2-alpine3.14 as build
22

33
COPY package*.json /
44

@@ -12,7 +12,7 @@ FROM node:20.9.0-alpine3.17
1212

1313
RUN apk --no-cache add git
1414

15-
COPY --from=build dist/run.mjs /run.mjs
15+
COPY --from=build dist/run.js /run.js
1616

1717
COPY package*.json /
1818

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

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

44
const bodyMaxLineLength = 100
55

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

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

entrypoint.sh

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ 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-
export NODE_OPTIONS="$NODE_OPTIONS --experimental-vm-modules"
16-
17-
node /run.mjs
15+
node /run.js
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
export default {
1+
module.exports = {
22
// Automatically clear mock calls and instances between every test
3+
// preset: 'rollup-jest',
34
clearMocks: true,
45
testEnvironment: '@commitlint/test-environment',
5-
testMatch: [
6-
'**/__tests__/**/*.?(m)[jt]s?(x)',
7-
'**/?(*.)+(spec|test).?(m)[tj]s?(x)',
8-
],
96
transform: {
107
'\\.[jt]sx?$': 'babel-jest',
118
},
9+
transformIgnorePatterns: ['node_modules/(?!dargs)'],
1210
}

0 commit comments

Comments
 (0)