Skip to content

Commit ab0730f

Browse files
authored
chore: switch codebase to default esm (#3959)
1 parent c020bbb commit ab0730f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+306
-205
lines changed

.github/scripts/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "commonjs"
3+
}

layers/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
},
77
"private": true,
88
"description": "This CDK app is meant to be used to publish Powertools for AWS Lambda (TypeScript) Lambda Layer. It is composed of a single stack deploying the Layer into the target account.",
9+
"type": "module",
910
"scripts": {
1011
"test": "vitest --run tests/unit",
1112
"test:unit": "vitest --run tests/unit",

layers/tests/e2e/layerPublisher.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { TestNodejsFunction } from '@aws-lambda-powertools/testing-utils/resourc
99
import { App } from 'aws-cdk-lib';
1010
import { LayerVersion } from 'aws-cdk-lib/aws-lambda';
1111
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';
12-
import packageJson from '../../package.json';
12+
import packageJson from '../../package.json' with { type: 'json' };
1313
import { LayerPublisherStack } from '../../src/layer-publisher-stack.js';
1414
import { RESOURCE_NAME_PREFIX } from './constants.js';
1515

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"packages/event-handler",
2020
"packages/validation"
2121
],
22+
"type": "module",
2223
"scripts": {
2324
"test": "npm t -ws",
2425
"test:parallel": "lerna exec --no-bail --no-sort --stream --concurrency 8 -- npm run test",

packages/batch/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"test:e2e:nodejs20x": "echo 'Not Implemented'",
1919
"test:e2e:nodejs22x": "echo 'Not Implemented'",
2020
"test:e2e": "echo 'Not Implemented'",
21-
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
22-
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
21+
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
22+
"build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
2323
"build": "npm run build:esm & npm run build:cjs",
2424
"lint": "biome lint .",
2525
"lint:fix": "biome check --write .",

packages/batch/tsconfig.cjs.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../../tsconfig.cjs.json",
3+
"compilerOptions": {
4+
"composite": true,
5+
"declaration": true,
6+
"outDir": "./lib/cjs/",
7+
"rootDir": "./src",
8+
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
9+
},
10+
"include": [
11+
"./src/**/*"
12+
]
13+
}

packages/batch/tsconfig.esm.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/batch/tsconfig.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "./lib/cjs/",
4+
"baseUrl": ".",
5+
"outDir": "./lib/esm",
56
"rootDir": "./src",
6-
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
7+
"tsBuildInfoFile": ".tsbuildinfo/esm.json",
8+
"composite": true,
9+
"declaration": true
710
},
8-
"include": ["./src/**/*"]
9-
}
11+
"include": [
12+
"./src/**/*"
13+
]
14+
}

packages/commons/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"test:unit:types": "vitest --run tests/types --typecheck",
1717
"test:e2e": "echo 'Not Applicable'",
1818
"generateVersionFile": "echo \"// this file is auto generated, do not modify\nexport const PT_VERSION = '$(jq -r '.version' package.json)';\" > src/version.ts",
19-
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
20-
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
19+
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
20+
"build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
2121
"build": "npm run build:esm & npm run build:cjs",
2222
"lint": "biome lint .",
2323
"lint:fix": "biome check --write .",

packages/commons/tsconfig.cjs.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../../tsconfig.cjs.json",
3+
"compilerOptions": {
4+
"composite": true,
5+
"declaration": true,
6+
"outDir": "./lib/cjs/",
7+
"rootDir": "./src",
8+
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
9+
},
10+
"include": [
11+
"./src/**/*"
12+
]
13+
}

0 commit comments

Comments
 (0)