Skip to content

chore: switch codebase to default esm #3959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 23, 2025
Merged
3 changes: 3 additions & 0 deletions .github/scripts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
1 change: 1 addition & 0 deletions layers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"private": true,
"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.",
"type": "module",
"scripts": {
"test": "vitest --run tests/unit",
"test:unit": "vitest --run tests/unit",
Expand Down
2 changes: 1 addition & 1 deletion layers/tests/e2e/layerPublisher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { TestNodejsFunction } from '@aws-lambda-powertools/testing-utils/resourc
import { App } from 'aws-cdk-lib';
import { LayerVersion } from 'aws-cdk-lib/aws-lambda';
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';
import packageJson from '../../package.json';
import packageJson from '../../package.json' with { type: 'json' };
import { LayerPublisherStack } from '../../src/layer-publisher-stack.js';
import { RESOURCE_NAME_PREFIX } from './constants.js';

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"packages/event-handler",
"packages/validation"
],
"type": "module",
"scripts": {
"test": "npm t -ws",
"test:parallel": "lerna exec --no-bail --no-sort --stream --concurrency 8 -- npm run test",
Expand Down
4 changes: 2 additions & 2 deletions packages/batch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"test:e2e:nodejs20x": "echo 'Not Implemented'",
"test:e2e:nodejs22x": "echo 'Not Implemented'",
"test:e2e": "echo 'Not Implemented'",
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build": "npm run build:esm & npm run build:cjs",
"lint": "biome lint .",
"lint:fix": "biome check --write .",
Expand Down
13 changes: 13 additions & 0 deletions packages/batch/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.cjs.json",
"compilerOptions": {
"composite": true,
"declaration": true,
"outDir": "./lib/cjs/",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
},
"include": [
"./src/**/*"
]
}
10 changes: 0 additions & 10 deletions packages/batch/tsconfig.esm.json

This file was deleted.

13 changes: 9 additions & 4 deletions packages/batch/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./lib/cjs/",
"baseUrl": ".",
"outDir": "./lib/esm",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
"tsBuildInfoFile": ".tsbuildinfo/esm.json",
"composite": true,
"declaration": true
},
"include": ["./src/**/*"]
}
"include": [
"./src/**/*"
]
}
4 changes: 2 additions & 2 deletions packages/commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"test:unit:types": "vitest --run tests/types --typecheck",
"test:e2e": "echo 'Not Applicable'",
"generateVersionFile": "echo \"// this file is auto generated, do not modify\nexport const PT_VERSION = '$(jq -r '.version' package.json)';\" > src/version.ts",
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build": "npm run build:esm & npm run build:cjs",
"lint": "biome lint .",
"lint:fix": "biome check --write .",
Expand Down
13 changes: 13 additions & 0 deletions packages/commons/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.cjs.json",
"compilerOptions": {
"composite": true,
"declaration": true,
"outDir": "./lib/cjs/",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
},
"include": [
"./src/**/*"
]
}
10 changes: 0 additions & 10 deletions packages/commons/tsconfig.esm.json

This file was deleted.

13 changes: 9 additions & 4 deletions packages/commons/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./lib/cjs/",
"baseUrl": ".",
"outDir": "./lib/esm",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
"tsBuildInfoFile": ".tsbuildinfo/esm.json",
"composite": true,
"declaration": true
},
"include": ["./src/**/*"]
}
"include": [
"./src/**/*"
]
}
4 changes: 2 additions & 2 deletions packages/event-handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"test:e2e:nodejs20x": "echo \"Not implemented\"",
"test:e2e:nodejs22x": "echo \"Not implemented\"",
"test:e2e": "echo \"Not implemented\"",
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build": "npm run build:esm & npm run build:cjs",
"lint": "biome lint .",
"lint:fix": "biome check --write .",
Expand Down
13 changes: 13 additions & 0 deletions packages/event-handler/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.cjs.json",
"compilerOptions": {
"composite": true,
"declaration": true,
"outDir": "./lib/cjs/",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
},
"include": [
"./src/**/*"
]
}
10 changes: 0 additions & 10 deletions packages/event-handler/tsconfig.esm.json

This file was deleted.

13 changes: 9 additions & 4 deletions packages/event-handler/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./lib/cjs/",
"baseUrl": ".",
"outDir": "./lib/esm",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
"tsBuildInfoFile": ".tsbuildinfo/esm.json",
"composite": true,
"declaration": true
},
"include": ["./src/**/*"]
}
"include": [
"./src/**/*"
]
}
4 changes: 2 additions & 2 deletions packages/idempotency/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"test:e2e:nodejs20x": "RUNTIME=nodejs20x vitest --run tests/e2e",
"test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e",
"test:e2e": "vitest --run tests/e2e",
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build": "npm run build:esm & npm run build:cjs",
"lint": "biome lint .",
"lint:fix": "biome check --write .",
Expand Down
13 changes: 13 additions & 0 deletions packages/idempotency/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.cjs.json",
"compilerOptions": {
"outDir": "./lib/cjs",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json",
"composite": true,
"declaration": true
},
"include": [
"./src/**/*"
]
}
12 changes: 0 additions & 12 deletions packages/idempotency/tsconfig.esm.json

This file was deleted.

21 changes: 12 additions & 9 deletions packages/idempotency/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./lib/cjs",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
},
"include": [
"./src/**/*"
],
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"outDir": "./lib/esm",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/esm.json",
"composite": true,
"declaration": true
},
"include": [
"./src/**/*"
]
}
4 changes: 2 additions & 2 deletions packages/jmespath/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"test:unit:coverage": "vitest --run tests/unit --coverage.enabled --coverage.thresholds.100 --coverage.include='src/**'",
"test:unit:types": "echo 'Not applicable for this package'",
"test:e2e": "echo 'Not applicable for this package'",
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build": "npm run build:esm & npm run build:cjs",
"lint": "biome lint .",
"lint:fix": "biome check --write .",
Expand Down
13 changes: 13 additions & 0 deletions packages/jmespath/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.cjs.json",
"compilerOptions": {
"composite": true,
"declaration": true,
"outDir": "./lib/cjs/",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
},
"include": [
"./src/**/*"
]
}
10 changes: 0 additions & 10 deletions packages/jmespath/tsconfig.esm.json

This file was deleted.

11 changes: 7 additions & 4 deletions packages/jmespath/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./lib/cjs/",
"baseUrl": ".",
"outDir": "./lib/esm",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
"tsBuildInfoFile": ".tsbuildinfo/esm.json"
},
"include": ["./src/**/*"]
}
"include": [
"./src/**/*"
]
}
4 changes: 2 additions & 2 deletions packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"test:e2e:nodejs20x": "RUNTIME=nodejs20x vitest --run tests/e2e",
"test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e",
"test:e2e": "vitest --run tests/e2e",
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build": "npm run build:esm & npm run build:cjs",
"lint": "biome lint .",
"lint:fix": "biome check --write .",
Expand Down
13 changes: 13 additions & 0 deletions packages/logger/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.cjs.json",
"compilerOptions": {
"composite": true,
"declaration": true,
"outDir": "./lib/cjs/",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
},
"include": [
"./src/**/*"
]
}
10 changes: 0 additions & 10 deletions packages/logger/tsconfig.esm.json

This file was deleted.

13 changes: 9 additions & 4 deletions packages/logger/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./lib/cjs/",
"baseUrl": ".",
"outDir": "./lib/esm",
"rootDir": "./src",
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
"tsBuildInfoFile": ".tsbuildinfo/esm.json",
"composite": true,
"declaration": true
},
"include": ["./src/**/*"]
}
"include": [
"./src/**/*"
]
}
4 changes: 2 additions & 2 deletions packages/metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"test:e2e:nodejs20x": "RUNTIME=nodejs20x vitest --run tests/e2e",
"test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e",
"test:e2e": "vitest --run tests/e2e",
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"build": "npm run build:esm & npm run build:cjs",
"lint": "biome lint .",
"lint:fix": "biome check --write .",
Expand Down
Loading