diff --git a/package.json b/package.json index 9031b1f..8512d02 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,8 @@ "@rollup/plugin-swc": "^0.3.0", "@rollup/plugin-typescript": "^11.1.6", "@rollup/pluginutils": "^5.1.0", - "cross-env": "^7.0.3" + "cross-env": "^7.0.3", + "get-tsconfig": "^4.7.2", + "ts-jest": "^29.1.2" } } \ No newline at end of file diff --git a/packages/conventional-changelog-config/package.json b/packages/conventional-changelog-config/package.json index 930944c..6e98bf6 100644 --- a/packages/conventional-changelog-config/package.json +++ b/packages/conventional-changelog-config/package.json @@ -1,5 +1,6 @@ { "name": "conventional-changelog-techor", + "type": "module", "scripts": { "build:main": "rollup --config rollup.config.mjs", "build:type": "tsc --emitDeclarationOnly --preserveWatchOutput", @@ -37,6 +38,8 @@ "preset" ], "main": "./dist/index.js", + "module": "./dist/index.js", + "exports": "./dist/index.js", "types": "./dist/index.d.ts", "files": [ "dist" diff --git a/packages/conventional-changelog-config/rollup.config.mjs b/packages/conventional-changelog-config/rollup.config.mjs index 300da91..75faf87 100644 --- a/packages/conventional-changelog-config/rollup.config.mjs +++ b/packages/conventional-changelog-config/rollup.config.mjs @@ -4,5 +4,5 @@ import defineConfig from '../../rollup.config.mjs' export default { ...defineConfig(), input: 'src/index.ts', - output: { file: 'dist/index.js', format: 'cjs' }, + output: { file: 'dist/index.js', format: 'esm' }, } \ No newline at end of file diff --git a/packages/conventional-changelog-config/src/index.ts b/packages/conventional-changelog-config/src/index.ts index b1996dc..25e7816 100644 --- a/packages/conventional-changelog-config/src/index.ts +++ b/packages/conventional-changelog-config/src/index.ts @@ -3,9 +3,11 @@ import parserOpts from './parser-opts' import recommendedBumpOpts from './recommended-bump' import writerOpts from './writer-opts' -export default async () => ({ - conventionalChangelog, - parserOpts, - recommendedBumpOpts, - writerOpts -}) \ No newline at end of file +export default async function createPreset() { + return { + conventionalChangelog, + parserOpts, + recommendedBumpOpts, + writerOpts + } +} \ No newline at end of file diff --git a/packages/semantic-release-config/jest.config.ts b/packages/semantic-release-config/jest.config.ts index 93ee4d5..23edbd8 100644 --- a/packages/semantic-release-config/jest.config.ts +++ b/packages/semantic-release-config/jest.config.ts @@ -1,4 +1,4 @@ /** @type {import('jest').Config} */ export default { - preset: '@techor/jest' + preset: '@techor/jest', } diff --git a/packages/semantic-release-config/package.json b/packages/semantic-release-config/package.json index 94fce33..6bd2ed9 100644 --- a/packages/semantic-release-config/package.json +++ b/packages/semantic-release-config/package.json @@ -6,7 +6,7 @@ "build:type": "tsc --emitDeclarationOnly --preserveWatchOutput", "build": "pnpm run \"/^build:.*/\"", "dev": "pnpm run \"/^build:.*/\" --watch", - "test": "jest", + "test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest", "type-check": "tsc --noEmit", "lint": "eslint src" }, @@ -22,17 +22,10 @@ "url": "https://github.com/techor-dev/techor/issues" }, "sideEffects": false, - "main": "./dist/index.cjs", - "esnext": "./dist/index.mjs", + "main": "./dist/index.mjs", "module": "./dist/index.mjs", + "exports": "./dist/index.mjs", "types": "./dist/index.d.ts", - "exports": { - ".": { - "require": "./dist/index.cjs", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" - } - }, "publishConfig": { "access": "public", "provenance": true @@ -63,7 +56,10 @@ "techor-conventional-commits": "workspace:^" }, "peerDependencies": { - "semantic-release": "^23.0.0", - "@semantic-release/exec": "^6.0.3" + "@semantic-release/exec": "^6.0.3", + "semantic-release": "^23.0.0" + }, + "devDependencies": { + "@semantic-release/commit-analyzer": "^12.0.0" } } \ No newline at end of file diff --git a/packages/semantic-release-config/tests/publish/test.ts b/packages/semantic-release-config/tests/publish/test.ts index e9acd76..6280079 100644 --- a/packages/semantic-release-config/tests/publish/test.ts +++ b/packages/semantic-release-config/tests/publish/test.ts @@ -1,4 +1,6 @@ import configure from '../../src/configure' +import path from 'path'; +const __dirname = path.dirname(new URL(import.meta.url).pathname); it('only publishs the public packages', () => { process.chdir(__dirname) diff --git a/packages/semantic-release-config/tests/rules.test.ts b/packages/semantic-release-config/tests/rules.test.ts index 240ab37..987476a 100644 --- a/packages/semantic-release-config/tests/rules.test.ts +++ b/packages/semantic-release-config/tests/rules.test.ts @@ -1,6 +1,7 @@ import { analyzeCommits } from '@semantic-release/commit-analyzer' import commitFalsely from '../../../utils/commit-falsely' import releaseRules from '../src/rules' +import { jest } from '@jest/globals' const createLogSpy = () => jest.spyOn(console, 'log').mockImplementation(() => null) diff --git a/packages/techor/tests/pnpm-lock.yaml b/packages/techor/tests/pnpm-lock.yaml index a0b2394..c77415e 100644 --- a/packages/techor/tests/pnpm-lock.yaml +++ b/packages/techor/tests/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: '6.0' +lockfileVersion: '9.0' settings: autoInstallPeers: true @@ -110,123 +110,192 @@ importers: packages: - /@techor/extend@3.0.10: + '@techor/extend@3.0.10': resolution: {integrity: sha512-8psJSywby7aHLVsG7rPiXe/Sc83uq/M8HwpXFLeah+DvAtcKo2tRsdYcAPuZG8hwGcrfCklSVhzO92SZlHW3bQ==} - dev: false - /@techor/is-plain-obj@3.0.10: + '@techor/is-plain-obj@3.0.10': resolution: {integrity: sha512-Fvxccj6Z9O32zs4AkcSjgZCHFbN7eXE9QvVhV6SJqDHMCqMOBMpMUSL/44gpb0wGiqllFExQAhrEdXLJC39roQ==} - dev: true - /@techor/log@3.0.10: + '@techor/log@3.0.10': resolution: {integrity: sha512-9vBoG8kyw9fptnoyNPvRRZ0896wdP6f9Ryl/4tMVKVFEw23jaT5VBL8NIUdFlEZzapw+ClAJ3awmDTK+ilfU4w==} - dev: false - /@types/prop-types@15.7.11: + '@types/prop-types@15.7.11': resolution: {integrity: sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==} - dev: true - /@types/react@18.2.57: + '@types/react@18.2.57': resolution: {integrity: sha512-ZvQsktJgSYrQiMirAN60y4O/LRevIV8hUzSOSNB6gfR3/o3wCBFQx3sPwIYtuDMeiVgsSS3UzCV26tEzgnfvQw==} - dependencies: - '@types/prop-types': 15.7.11 - '@types/scheduler': 0.16.8 - csstype: 3.1.3 - dev: true - /@types/scheduler@0.16.8: + '@types/scheduler@0.16.8': resolution: {integrity: sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==} - dev: true - /ansi-regex@6.0.1: + ansi-regex@6.0.1: resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} engines: {node: '>=12'} - dev: false - /chalk@5.3.0: + chalk@5.3.0: resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==} engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} - dev: false - /cli-cursor@4.0.0: + cli-cursor@4.0.0: resolution: {integrity: sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - restore-cursor: 4.0.0 - dev: false - /cli-spinners@2.9.2: + cli-spinners@2.9.2: resolution: {integrity: sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==} engines: {node: '>=6'} - dev: false - /csstype@3.1.3: + csstype@3.1.3: resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} - dev: true - /emoji-regex@10.3.0: + emoji-regex@10.3.0: resolution: {integrity: sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==} - dev: false - /get-east-asian-width@1.2.0: + get-east-asian-width@1.2.0: resolution: {integrity: sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==} engines: {node: '>=18'} - dev: false - /is-interactive@2.0.0: + is-interactive@2.0.0: resolution: {integrity: sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==} engines: {node: '>=12'} - dev: false - /is-obj@3.0.0: + is-obj@3.0.0: resolution: {integrity: sha512-IlsXEHOjtKhpN8r/tRFj2nDyTmHvcfNeu/nrRIcXE17ROeatXchkojffa1SpdqW4cr/Fj6QkEf/Gn4zf6KKvEQ==} engines: {node: '>=12'} - dev: false - /is-unicode-supported@1.3.0: + is-unicode-supported@1.3.0: resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==} engines: {node: '>=12'} - dev: false - /is-unicode-supported@2.0.0: + is-unicode-supported@2.0.0: resolution: {integrity: sha512-FRdAyx5lusK1iHG0TWpVtk9+1i+GjrzRffhDg4ovQ7mcidMQ6mj+MhKPmvh7Xwyv5gIS06ns49CA7Sqg7lC22Q==} engines: {node: '>=18'} - dev: false - /js-tokens@4.0.0: + js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - dev: false - /log-symbols@6.0.0: + log-symbols@6.0.0: resolution: {integrity: sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw==} engines: {node: '>=18'} - dependencies: - chalk: 5.3.0 - is-unicode-supported: 1.3.0 - dev: false - /loose-envify@1.4.0: + loose-envify@1.4.0: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} hasBin: true - dependencies: - js-tokens: 4.0.0 - dev: false - /mimic-fn@2.1.0: + mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} - dev: false - /onetime@5.1.2: + onetime@5.1.2: resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} engines: {node: '>=6'} - dependencies: - mimic-fn: 2.1.0 - dev: false - /ora@8.0.1: + ora@8.0.1: resolution: {integrity: sha512-ANIvzobt1rls2BDny5fWZ3ZVKyD6nscLvfFRpQgfWsythlcsVUC9kL0zq6j2Z5z9wwp1kd7wpsD/T9qNPVLCaQ==} engines: {node: '>=18'} + + pretty-bytes@6.1.1: + resolution: {integrity: sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ==} + engines: {node: ^14.13.1 || >=16.0.0} + + react-dom@18.2.0: + resolution: {integrity: sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==} + peerDependencies: + react: ^18.2.0 + + react@18.2.0: + resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==} + engines: {node: '>=0.10.0'} + + restore-cursor@4.0.0: + resolution: {integrity: sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + + scheduler@0.23.0: + resolution: {integrity: sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==} + + server-only@0.0.1: + resolution: {integrity: sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA==} + + signal-exit@3.0.7: + resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + + stdin-discarder@0.2.2: + resolution: {integrity: sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==} + engines: {node: '>=18'} + + string-width@7.1.0: + resolution: {integrity: sha512-SEIJCWiX7Kg4c129n48aDRwLbFb2LJmXXFrWBG4NGaRtMQ3myKPKbwrD1BKqQn74oCoNMBVrfDEr5M9YxCsrkw==} + engines: {node: '>=18'} + + strip-ansi@7.1.0: + resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} + engines: {node: '>=12'} + + typescript@4.9.5: + resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} + engines: {node: '>=4.2.0'} + hasBin: true + +snapshots: + + '@techor/extend@3.0.10': {} + + '@techor/is-plain-obj@3.0.10': {} + + '@techor/log@3.0.10': {} + + '@types/prop-types@15.7.11': {} + + '@types/react@18.2.57': + dependencies: + '@types/prop-types': 15.7.11 + '@types/scheduler': 0.16.8 + csstype: 3.1.3 + + '@types/scheduler@0.16.8': {} + + ansi-regex@6.0.1: {} + + chalk@5.3.0: {} + + cli-cursor@4.0.0: + dependencies: + restore-cursor: 4.0.0 + + cli-spinners@2.9.2: {} + + csstype@3.1.3: {} + + emoji-regex@10.3.0: {} + + get-east-asian-width@1.2.0: {} + + is-interactive@2.0.0: {} + + is-obj@3.0.0: {} + + is-unicode-supported@1.3.0: {} + + is-unicode-supported@2.0.0: {} + + js-tokens@4.0.0: {} + + log-symbols@6.0.0: + dependencies: + chalk: 5.3.0 + is-unicode-supported: 1.3.0 + + loose-envify@1.4.0: + dependencies: + js-tokens: 4.0.0 + + mimic-fn@2.1.0: {} + + onetime@5.1.2: + dependencies: + mimic-fn: 2.1.0 + + ora@8.0.1: dependencies: chalk: 5.3.0 cli-cursor: 4.0.0 @@ -237,75 +306,42 @@ packages: stdin-discarder: 0.2.2 string-width: 7.1.0 strip-ansi: 7.1.0 - dev: false - /pretty-bytes@6.1.1: - resolution: {integrity: sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ==} - engines: {node: ^14.13.1 || >=16.0.0} - dev: true + pretty-bytes@6.1.1: {} - /react-dom@18.2.0(react@18.2.0): - resolution: {integrity: sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==} - peerDependencies: - react: ^18.2.0 + react-dom@18.2.0(react@18.2.0): dependencies: loose-envify: 1.4.0 react: 18.2.0 scheduler: 0.23.0 - dev: false - /react@18.2.0: - resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==} - engines: {node: '>=0.10.0'} + react@18.2.0: dependencies: loose-envify: 1.4.0 - dev: false - /restore-cursor@4.0.0: - resolution: {integrity: sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + restore-cursor@4.0.0: dependencies: onetime: 5.1.2 signal-exit: 3.0.7 - dev: false - /scheduler@0.23.0: - resolution: {integrity: sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==} + scheduler@0.23.0: dependencies: loose-envify: 1.4.0 - dev: false - /server-only@0.0.1: - resolution: {integrity: sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA==} - dev: false + server-only@0.0.1: {} - /signal-exit@3.0.7: - resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} - dev: false + signal-exit@3.0.7: {} - /stdin-discarder@0.2.2: - resolution: {integrity: sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==} - engines: {node: '>=18'} - dev: false + stdin-discarder@0.2.2: {} - /string-width@7.1.0: - resolution: {integrity: sha512-SEIJCWiX7Kg4c129n48aDRwLbFb2LJmXXFrWBG4NGaRtMQ3myKPKbwrD1BKqQn74oCoNMBVrfDEr5M9YxCsrkw==} - engines: {node: '>=18'} + string-width@7.1.0: dependencies: emoji-regex: 10.3.0 get-east-asian-width: 1.2.0 strip-ansi: 7.1.0 - dev: false - /strip-ansi@7.1.0: - resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} - engines: {node: '>=12'} + strip-ansi@7.1.0: dependencies: ansi-regex: 6.0.1 - dev: false - /typescript@4.9.5: - resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} - engines: {node: '>=4.2.0'} - hasBin: true - dev: true + typescript@4.9.5: {} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab508d9..733ca80 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,6 +26,12 @@ importers: cross-env: specifier: ^7.0.3 version: 7.0.3 + get-tsconfig: + specifier: ^4.7.2 + version: 4.7.3 + ts-jest: + specifier: ^29.1.2 + version: 29.1.2(@babel/core@7.24.5)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.5))(jest@29.7.0(@types/node@20.12.8)(ts-node@10.9.2(@swc/core@1.4.17)(@types/node@20.12.8)(typescript@5.4.5)))(typescript@5.4.5) devDependencies: '@techor/jest': specifier: workspace:^ @@ -289,6 +295,10 @@ importers: techor-conventional-commits: specifier: workspace:^ version: link:../conventional-commits + devDependencies: + '@semantic-release/commit-analyzer': + specifier: ^12.0.0 + version: 12.0.0(semantic-release@23.0.8(typescript@5.4.5)) packages/techor: dependencies: