From 68fbc45aafac6d54063a43d0e3a75f147b281364 Mon Sep 17 00:00:00 2001 From: Pelle Wessman Date: Fri, 18 Nov 2022 15:44:38 +0100 Subject: [PATCH] Make published type test work again (#61) --- .github/workflows/ts-internal.yml | 2 +- .github/workflows/ts.yml | 3 ++- .gitignore | 1 + declaration.tsconfig.json | 3 ++- package.json | 7 ++++--- test-published-types/.npmrc | 1 + test-published-types/index.js | 2 +- test-published-types/package.json | 13 +++++++++++++ test-published-types/tsconfig.json | 7 ++++--- tsconfig.json | 3 +++ 10 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 test-published-types/.npmrc create mode 100644 test-published-types/package.json diff --git a/.github/workflows/ts-internal.yml b/.github/workflows/ts-internal.yml index fd1bef7..9280415 100644 --- a/.github/workflows/ts-internal.yml +++ b/.github/workflows/ts-internal.yml @@ -19,5 +19,5 @@ jobs: type-check: uses: voxpelli/ghatemplates/.github/workflows/type-check.yml@main with: - ts-versions: ${{ github.event.schedule && 'next' || '4.6,4.7,4.8,4.9,next' }} + ts-versions: ${{ github.event.schedule && 'next' || '4.9,next' }} ts-libs: 'es2020' diff --git a/.github/workflows/ts.yml b/.github/workflows/ts.yml index d5eaf59..3208f15 100644 --- a/.github/workflows/ts.yml +++ b/.github/workflows/ts.yml @@ -19,8 +19,9 @@ jobs: type-check: uses: voxpelli/ghatemplates/.github/workflows/type-check.yml@main with: + ts-prebuild: true ts-versions: ${{ github.event.schedule && 'next' || '4.5,4.6,4.7,4.8,4.9,next' }} # Can add the "es2020,es2022.error,es2021.promise" once 4.5 isn't included # ts-libs: 'es2020;esnext;es2020,es2022.error,es2021.promise' ts-libs: 'es2020;esnext' - ts-projects: 'test-published-types' + ts-working-directory: 'test-published-types' diff --git a/.gitignore b/.gitignore index 18a5e81..87eb251 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ *.mjs !test/**/*.mjs !*compat.d.ts +/test-published-types/node_modules diff --git a/declaration.tsconfig.json b/declaration.tsconfig.json index 0d0bedc..3008b3d 100644 --- a/declaration.tsconfig.json +++ b/declaration.tsconfig.json @@ -2,7 +2,8 @@ { "extends": "./tsconfig", "exclude": [ - "test/**/*.js" + "test/**/*.js", + "test-published-types/**/*" ], "compilerOptions": { "declaration": true, diff --git a/package.json b/package.json index a01107b..7f89e5c 100644 --- a/package.json +++ b/package.json @@ -12,14 +12,15 @@ "types": "index.d.ts", "typesVersions": { "~4.6 || ~4.7": { - "index.d.ts": [ + ".": [ "compat.d.ts" ] } }, "exports": { ".": { - "types@<4.8": "./compat.d.ts", + "types@~4.6": "./compat.d.ts", + "types@~4.7": "./compat.d.ts", "types": "./index.d.ts", "import": "./index.mjs", "require": "./index.js" @@ -80,7 +81,7 @@ "@types/node": "^14.18.33", "@types/verror": "^1.10.6", "@voxpelli/eslint-config": "^15.2.0", - "@voxpelli/tsconfig": "^6.0.0", + "@voxpelli/tsconfig": "^6.1.0", "c8": "^7.12.0", "chai": "^4.3.7", "chai-string": "^1.5.0", diff --git a/test-published-types/.npmrc b/test-published-types/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/test-published-types/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/test-published-types/index.js b/test-published-types/index.js index e748992..97d728f 100644 --- a/test-published-types/index.js +++ b/test-published-types/index.js @@ -1,3 +1,3 @@ -const { ErrorWithCause } = require('..'); +const { ErrorWithCause } = require('pony-cause'); throw new ErrorWithCause('Wow', { cause: new Error('Yay') }); diff --git a/test-published-types/package.json b/test-published-types/package.json new file mode 100644 index 0000000..3317575 --- /dev/null +++ b/test-published-types/package.json @@ -0,0 +1,13 @@ +{ + "name": "pony-cause", + "version": "0.0.0", + "scripts": { + "test": "tsc" + }, + "dependencies": { + "pony-cause": "file:.." + }, + "devDependencies": { + "typescript": "~4.6.0" + } +} diff --git a/test-published-types/tsconfig.json b/test-published-types/tsconfig.json index 34e148a..5310c0e 100644 --- a/test-published-types/tsconfig.json +++ b/test-published-types/tsconfig.json @@ -1,9 +1,10 @@ { - "extends": "@voxpelli/tsconfig/node14.json", + "extends": "@voxpelli/tsconfig/legacy.json", + "files": [ - "index.js", + "index.js" ], - "include": [], + "compilerOptions": { "lib": ["esnext"], "types": [] diff --git a/tsconfig.json b/tsconfig.json index 6f0f59c..7757245 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,5 +5,8 @@ ], "include": [ "test/**/*.js", + ], + "exclude": [ + "test-published-types/**/*" ] }