Skip to content

Commit d4bf280

Browse files
committed
Change the way ts utilities are run for latest typescript in Node 20+
1 parent 54f2ea1 commit d4bf280

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "authorization-management-component",
33
"version": "0.1.1",
44
"private": true,
5+
"type": "module",
56
"scripts": {
67
"build": "next build",
78
"prepare:e2e": "cd e2e/test-app ; npm ci; npm run build",
@@ -17,11 +18,11 @@
1718
"start": "next start",
1819
"test": "TZ=UTC jest --runInBand",
1920
"test:e2e": "playwright test",
20-
"update-clientId": "npm ci && npx ts-node --skip-project scripts/updateClientId.ts",
21+
"update-clientId": "npm ci && node --experimental-specifier-resolution=node --loader ts-node/esm/transpile-only scripts/updateClientId.ts",
2122
"bump-version": "changeset add",
2223
"version": "changeset version",
2324
"release": "changeset publish",
24-
"preparePurposes": "npx ts-node --skip-project scripts/preparePurposes.ts"
25+
"preparePurposes": "node --experimental-specifier-resolution=node --loader ts-node/esm/transpile-only scripts/preparePurposes.ts"
2526
},
2627
"dependencies": {
2728
"@changesets/changelog-github": "^0.5.0",

scripts/preparePurposes.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@
1919
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2020
//
2121
import fs from "fs";
22-
import path from "path";
22+
import path, { dirname } from "path";
23+
import { fileURLToPath } from "url";
2324
import { addToCache, defaultUrls } from "../src/session/PurposeCache";
2425

26+
const __filename = fileURLToPath(import.meta.url);
27+
const __dirname = dirname(__filename);
28+
2529
// Undici struggles to follow these redirects for some reason,
2630
// but the browser handles it fine
2731
const redirected = {
@@ -52,6 +56,6 @@ async function main() {
5256
}
5357

5458
main().catch((e) => {
55-
console.log("Error occured preparing purposes", e);
59+
console.log("Error occurred preparing purposes", e);
5660
process.exit(1);
5761
});

0 commit comments

Comments
 (0)