Skip to content

Commit 2e57812

Browse files
committed
fix: build the action with rollup
On v4, we used the default nodejs resolution logic to allow ES modules in dependencies. This created a breaking change of forcing users of this action to use the .cjs extension instead of .js in config files. With this fix, we now bundle the action with rollup to allow ES modules in dependencies, while keeping the support for .js config files. With this change, the default config file was returned back to .js instead of .cjs. Fixes #194
1 parent 0cb522a commit 2e57812

23 files changed

+16051
-220
lines changed

.dockerignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
node_modules
2-
commitlint.config.cjs
2+
commitlint.config.js
33
action.yml
44
.github
55
CHANGELOG.md

.eslintrc.json

+1-7
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@
1818
"no-process-exit": "off",
1919
"node/no-unpublished-require": "off",
2020
"node/no-unpublished-import": "off",
21-
"node/no-unsupported-features/es-syntax": "off",
22-
"import/extensions": [
23-
"error",
24-
{
25-
"js": "always"
26-
}
27-
]
21+
"node/no-unsupported-features/es-syntax": "off"
2822
}
2923
}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ typings/
5959

6060
# next.js build output
6161
.next
62+
63+
# Dist files
64+
dist
File renamed without changes.

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16
1+
16.5.0

.versionrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"package-lock.json",
66
{
77
"filename": "action.yml",
8-
"updater": "./.github/tasks/actionYamlUpdater.cjs"
8+
"updater": "./.github/tasks/actionYamlUpdater.js"
99
}
1010
],
1111
"releaseCommitMessageFormat": "chore(release): publish {{currentTag}} [skip-ci]"

CHANGELOG.md

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ All notable changes to this project will be documented in this file. See [standa
1818

1919
* Node.js version used on the action updated from 12 to
2020
16
21-
* Config files now need to be renamed from .js to .cjs
2221

2322
### Features
2423

Dockerfile

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
1-
FROM node:16-alpine3.13
1+
FROM node:16.5.0-alpine3.14 as build
2+
3+
COPY package*.json /
4+
5+
RUN npm ci --ignore-scripts
6+
7+
COPY . .
8+
9+
RUN npm run build
10+
11+
FROM node:16.5.0-alpine3.14
212

313
RUN apk --no-cache add git
414

15+
COPY --from=build dist/run.js /run.js
16+
517
COPY package*.json /
618

719
RUN npm ci --production --ignore-scripts
820

9-
COPY . .
21+
COPY entrypoint.sh /entrypoint.sh
1022

1123
ENTRYPOINT ["/entrypoint.sh"]

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ You can supply these inputs to the `wagoid/commitlint-github-action@v3` step.
3232

3333
The path to your commitlint config file.
3434

35-
Default: `commitlint.config.cjs`
35+
Default: `commitlint.config.js`
3636

3737
If the config file doesn't exist, [config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional) settings will be loaded as a default fallback.
3838

action.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@ description: Lints Pull Request commit messages with commitlint
33
author: Wagner Santos
44
inputs:
55
configFile:
6-
description: Commitlint config file. If the file doesn't exist, config-conventional settings will be
6+
description:
7+
Commitlint config file. If the file doesn't exist, config-conventional settings will be
78
loaded as a fallback.
8-
default: ./commitlint.config.cjs
9+
default: ./commitlint.config.js
910
required: false
1011
firstParent:
1112
description: >
1213
When set to true, we follow only the first parent commit when seeing a merge commit. More info
1314
in git-log docs https://git-scm.com/docs/git-log#Documentation/git-log.txt---first-parent
14-
default: "true"
15+
default: 'true'
1516
required: false
1617
failOnWarnings:
1718
description: Whether you want to fail on warnings or not
18-
default: "false"
19+
default: 'false'
1920
required: false
2021
helpURL:
2122
description: Link to a page explaining your commit message convention

babel.config.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"presets": [["@babel/preset-env"]],
3+
"targets": {
4+
"node": "16.5.0"
5+
}
6+
}
File renamed without changes.

jest.config.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +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-
transform: {},
6+
transform: {
7+
'\\.[jt]sx?$': 'babel-jest',
8+
},
9+
transformIgnorePatterns: ['node_modules/(?!dargs)'],
610
}

0 commit comments

Comments
 (0)