Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rollback update of commitlint to support configs that use commonjs #761

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,5 @@
"node/no-unpublished-require": "off",
"node/no-unpublished-import": "off",
"node/no-unsupported-features/es-syntax": "off"
},
"ignorePatterns": [
".github/tasks/actionYamlUpdater.js",
"rollup.config.js",
"fixtures"
]
}
}
4 changes: 2 additions & 2 deletions .github/tasks/actionYamlUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ const yaml = require('yaml')

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

exports.readVersion = (contents) =>
module.exports.readVersion = (contents) =>
yaml.parse(contents).runs.image.match(versionRegex)[0]

exports.writeVersion = (contents, version) => {
module.exports.writeVersion = (contents, version) => {
const actionFile = yaml.parse(contents)
actionFile.runs.image = actionFile.runs.image.replace(versionRegex, version)

Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
DOCKER_REGISTRY_URL: registry.hub.docker.com
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: '20.9.0'
Expand All @@ -53,11 +55,7 @@ jobs:
git config user.email 'github-action@users.noreply.github.com'
git config user.name 'GitHub Action'
- name: Update versions and changelog
run: |
# remove `"type": "module"` from package.json since `commit-and-tag-version` doesn't support it
sed -i '/"type": "module",/c\' package.json
npx commit-and-tag-version
git checkout package.json
run: npx commit-and-tag-version
- name: Set VERSION env var
run: |
version=`node -p "require('./package.json').version"`
Expand Down
2 changes: 1 addition & 1 deletion .lintstagedrc.mjs → .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
module.exports = {
'*.{ts,tsx,vue,css,less,scss,html,htm,md,markdown}': 'prettier --write',
'*.{json,yml,yaml}': ['prettier --write', () => 'npm run test'],
'*.{js,jsx}': ['eslint --fix', () => 'npm run test'],
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20.9.0-alpine3.17 as build
FROM node:16.14.2-alpine3.14 as build

COPY package*.json /

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

RUN apk --no-cache add git

COPY --from=build dist/run.mjs /run.mjs
COPY --from=build dist/run.js /run.js

COPY package*.json /

Expand Down
4 changes: 2 additions & 2 deletions commitlint.config.mjs → commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable import/no-extraneous-dependencies */
import { maxLineLength } from '@commitlint/ensure'
const { maxLineLength } = require('@commitlint/ensure')

const bodyMaxLineLength = 100

Expand All @@ -14,7 +14,7 @@ const validateBodyMaxLengthIgnoringDeps = (parsedCommit) => {
]
}

export default {
module.exports = {
extends: ['@commitlint/config-conventional'],
plugins: ['commitlint-plugin-function-rules'],
rules: {
Expand Down
6 changes: 2 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ set -e
if [ -z "$NODE_PATH" ]; then
export NODE_PATH=/node_modules
else
export NODE_PATH="$NODE_PATH":/node_modules
export NODE_PATH=$NODE_PATH:/node_modules
fi

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

export NODE_OPTIONS="$NODE_OPTIONS --experimental-vm-modules"

node /run.mjs
node /run.js
8 changes: 3 additions & 5 deletions jest.config.mjs → jest.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
export default {
module.exports = {
// Automatically clear mock calls and instances between every test
// preset: 'rollup-jest',
clearMocks: true,
testEnvironment: '@commitlint/test-environment',
testMatch: [
'**/__tests__/**/*.?(m)[jt]s?(x)',
'**/?(*.)+(spec|test).?(m)[tj]s?(x)',
],
transform: {
'\\.[jt]sx?$': 'babel-jest',
},
transformIgnorePatterns: ['node_modules/(?!dargs)'],
}
Loading
Loading