Skip to content

Commit

Permalink
fix: fix backwards compatibility with people using commitlint.config.js
Browse files Browse the repository at this point in the history
  • Loading branch information
wagoid committed Mar 28, 2024
1 parent e15adf3 commit 8b31b7c
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 1 addition & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ fi
# 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
77 changes: 77 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "5.4.6",
"description": "commitlint github action",
"private": true,
"module": "./dist/run.mjs",
"main": "./dist/run.mjs",
"scripts": {
"postinstall": "husky install",
"test": "NODE_PATH=./node_modules NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" npx jest",
Expand Down Expand Up @@ -49,6 +49,7 @@
"@jest/globals": "^29.7.0",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^14.1.0",
"babel-jest": "^29.7.0",
"commit-and-tag-version": "^12.2.0",
Expand Down
9 changes: 7 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ import path from 'path'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import { babel } from '@rollup/plugin-babel'
import json from '@rollup/plugin-json'
import pkg from './package.json'

const bundledDeps = ['node_modules/dargs', 'global-directory', '@commitlint']

export default {
input: 'run.mjs',
external: (depName) =>
depName.includes('node_modules') && !depName.includes('node_modules/dargs'),
output: [{ file: pkg.module, format: 'es' }],
depName.includes('node_modules') &&
bundledDeps.every((bundledDep) => !depName.includes(bundledDep)),
output: [{ file: './dist/run.js', format: 'commonjs' }],
plugins: [
babel({
babelHelpers: 'bundled',
Expand All @@ -19,5 +23,6 @@ export default {
preferBuiltins: true,
}),
commonjs(),
json(),
],
}

0 comments on commit 8b31b7c

Please sign in to comment.