Skip to content

Commit

Permalink
Migrate to ESM (update-outdated-pull-request-branch)
Browse files Browse the repository at this point in the history
  • Loading branch information
int128 committed Nov 21, 2024
1 parent b86d8ce commit f80c630
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"private": true,
"name": "monorepo-deploy-actions",
"license": "MIT",
"type": "module",
"devDependencies": {
"@eslint/js": "9.15.0",
"@tsconfig/recommended": "1.0.8",
Expand Down
12 changes: 7 additions & 5 deletions update-outdated-pull-request-branch/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
module.exports = {
preset: 'ts-jest',
/** @type {import('ts-jest').JestConfigWithTsJest} */
export default {
preset: 'ts-jest/presets/default-esm',
clearMocks: true,
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
verbose: true,
// https://kulshekhar.github.io/ts-jest/docs/guides/esm-support/
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
}
1 change: 1 addition & 0 deletions update-outdated-pull-request-branch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "update-outdated-pull-request-branch",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"build": "ncc build --source-map --license licenses.txt src/main.ts",
"test": "jest"
Expand Down
2 changes: 1 addition & 1 deletion update-outdated-pull-request-branch/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as core from '@actions/core'
import * as github from '@actions/github'
import { run } from './run'
import { run } from './run.js'
import assert from 'assert'

const main = async (): Promise<void> => {
Expand Down
2 changes: 1 addition & 1 deletion update-outdated-pull-request-branch/tests/run.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isExpired } from '../src/run'
import { isExpired } from '../src/run.js'

describe('isExpired', () => {
const now = () => Date.parse('2021-02-03T04:05:06Z')
Expand Down

0 comments on commit f80c630

Please sign in to comment.