Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit ea392ae

Browse files
chore(ci): drop lerna for nx (#3769)
Replacing Lerna by NX - allow to cache parts of the build (local runs) --------- Co-authored-by: Nadav Sinai <[email protected]>
1 parent 3549bc1 commit ea392ae

File tree

14 files changed

+1587
-2540
lines changed

14 files changed

+1587
-2540
lines changed

Diff for: .vscode/gh-runners.code-workspace

+2-22
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,8 @@
55
"path": ".."
66
},
77
{
8-
"name": "🚀 @lambda/functions/ami-housekeeper",
9-
"path": "../lambdas/functions/ami-housekeeper"
10-
},
11-
{
12-
"name": "🚀 @lambda/functions/control-plane",
13-
"path": "../lambdas/functions/control-plane"
14-
},
15-
{
16-
"name": "🚀 @lambda/functions/gh-agent-syncer",
17-
"path": "../lambdas/functions/gh-agent-syncer"
18-
},
19-
{
20-
"name": "🚀 @lambda/functions/webhook",
21-
"path": "../lambdas/functions/webhook"
22-
},
23-
{
24-
"name": "📦 @lambda/libs/aws-ssm-util",
25-
"path": "../lambdas/libs/aws-ssm-util"
26-
},
27-
{
28-
"name": "📦 @lambdas/libs/aws-powertools-util",
29-
"path": "../lambdas/libs/aws-powertools-util"
8+
"name": "🚀 lambdas",
9+
"path": "../lambdas"
3010
}
3111
],
3212
"settings": {

Diff for: lambdas/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ dist/
66
# Ignore all yarn.lock files except the one in the root
77
**/yarn.lock
88
!/yarn.lock
9+
10+
11+
.nx/cache

Diff for: lambdas/.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18
1+
v20

Diff for: lambdas/.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Add files here to ignore them from prettier formatting
2+
/dist
3+
/coverage
4+
/.nx/cache

Diff for: lambdas/functions/ami-housekeeper/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"license": "MIT",
66
"scripts": {
77
"start": "ts-node-dev src/local.ts",
8-
"test": "NODE_ENV=test jest",
9-
"test:watch": "NODE_ENV=test jest --watch",
8+
"test": "NODE_ENV=test nx test",
9+
"test:watch": "NODE_ENV=test nx test --watch",
1010
"lint": "yarn eslint src",
1111
"watch": "ts-node-dev --respawn --exit-child src/local.ts",
1212
"build": "ncc build src/lambda.ts -o dist",
@@ -44,5 +44,8 @@
4444
"@terraform-aws-github-runner/aws-ssm-util": "*",
4545
"cron-parser": "^4.8.1",
4646
"typescript": "^5.3.3"
47+
},
48+
"nx": {
49+
"includedScripts": ["build","dist","format","format-check","start","watch","all"]
4750
}
4851
}

Diff for: lambdas/functions/control-plane/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"license": "MIT",
66
"scripts": {
77
"start": "ts-node-dev src/local.ts",
8-
"test": "NODE_ENV=test jest",
9-
"test:watch": "NODE_ENV=test jest --watch",
8+
"test": "NODE_ENV=test nx test",
9+
"test:watch": "NODE_ENV=test nx test --watch",
1010
"lint": "yarn eslint src",
1111
"watch": "ts-node-dev --respawn --exit-child src/local-ssm-housekeeper.ts",
1212
"build": "ncc build src/lambda.ts -o dist",
@@ -49,5 +49,8 @@
4949
"axios": "^1.6.2",
5050
"cron-parser": "^4.8.1",
5151
"typescript": "^5.3.3"
52+
},
53+
"nx": {
54+
"includedScripts": ["build","dist","format","format-check","start","watch","all"]
5255
}
5356
}

Diff for: lambdas/functions/gh-agent-syncer/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"license": "MIT",
66
"scripts": {
77
"start": "ts-node-dev src/local.ts",
8-
"test": "NODE_ENV=test jest",
9-
"test:watch": "NODE_ENV=test jest --watch",
8+
"test": "NODE_ENV=test nx test",
9+
"test:watch": "NODE_ENV=test nx test --watch",
1010
"lint": "yarn eslint src",
1111
"watch": "ts-node-dev --respawn --exit-child src/local.ts",
1212
"build": "ncc build src/lambda.ts -o dist",
@@ -43,5 +43,8 @@
4343
"@middy/core": "^4.7.0",
4444
"@terraform-aws-github-runner/aws-powertools-util": "*",
4545
"axios": "^1.6.2"
46+
},
47+
"nx": {
48+
"includedScripts": ["build","dist","format","format-check","start","watch","all"]
4649
}
4750
}

Diff for: lambdas/functions/webhook/package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "@terraform-aws-github-runner/function-webhook",
2+
"name": "@terraform-aws-github-runner/webhook",
33
"version": "1.0.0",
44
"main": "lambda.ts",
55
"license": "MIT",
66
"scripts": {
77
"start": "ts-node-dev src/local.ts",
8-
"test": "NODE_ENV=test jest",
9-
"test:watch": "NODE_ENV=test jest --watch",
8+
"test": "NODE_ENV=test nx test",
9+
"test:watch": "NODE_ENV=test nx test --watch",
1010
"lint": "yarn eslint src",
1111
"watch": "ts-node-dev --respawn --exit-child src/local.ts",
1212
"build": "ncc build src/lambda.ts -o dist",
@@ -46,5 +46,8 @@
4646
"@terraform-aws-github-runner/aws-powertools-util": "*",
4747
"@terraform-aws-github-runner/aws-ssm-util": "*",
4848
"aws-lambda": "^1.0.7"
49+
},
50+
"nx": {
51+
"includedScripts": ["build","dist","format","format-check","start","watch","all"]
4952
}
5053
}

Diff for: lambdas/lerna.json

-4
This file was deleted.

Diff for: lambdas/libs/aws-powertools-util/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"license": "MIT",
66
"scripts": {
77
"start": "ts-node-dev src/local.ts",
8-
"test": "NODE_ENV=test jest",
9-
"test:watch": "NODE_ENV=test jest --watch",
8+
"test": "NODE_ENV=test nx test",
9+
"test:watch": "NODE_ENV=test nx test --watch",
1010
"lint": "yarn eslint src",
1111
"watch": "ts-node-dev --respawn --exit-child src/local.ts",
1212
"format": "prettier --write \"**/*.ts\"",
@@ -39,5 +39,8 @@
3939
"@aws-lambda-powertools/logger": "^1.17.0",
4040
"@aws-lambda-powertools/tracer": "^1.14.0",
4141
"aws-lambda": "^1.0.7"
42+
},
43+
"nx": {
44+
"includedScripts": ["build","dist","format","format-check","start","watch","all"]
4245
}
4346
}

Diff for: lambdas/libs/aws-ssm-util/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"license": "MIT",
66
"scripts": {
77
"start": "ts-node-dev src/local.ts",
8-
"test": "NODE_ENV=test jest",
9-
"test:watch": "NODE_ENV=test jest --watch",
8+
"test": "NODE_ENV=test nx test",
9+
"test:watch": "NODE_ENV=test nx test --watch",
1010
"lint": "yarn eslint src",
1111
"watch": "ts-node-dev --respawn --exit-child src/local.ts",
1212
"format": "prettier --write \"**/*.ts\"",
@@ -39,5 +39,8 @@
3939
"@aws-sdk/client-ssm": "^3.477.0",
4040
"@aws-sdk/types": "^3.433.0",
4141
"@terraform-aws-github-runner/aws-powertools-util": "*"
42+
},
43+
"nx": {
44+
"includedScripts": ["build","dist","format","format-check","start","watch","all"]
4245
}
4346
}

Diff for: lambdas/nx.json

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"$schema": "./node_modules/nx/schemas/nx-schema.json",
3+
"affected": {
4+
"defaultBase": "main"
5+
},
6+
"workspaceLayout": {
7+
"libsDir": "libs",
8+
"appsDir": "functions"
9+
},
10+
"plugins": [
11+
12+
{
13+
"plugin": "@nx/jest/plugin",
14+
"options": {
15+
"targetName": "test"
16+
}
17+
},
18+
{
19+
"plugin": "@nx/eslint/plugin",
20+
"options": {
21+
"targetName": "lint"
22+
}
23+
}
24+
],
25+
"targetDefaults": {
26+
"build": {
27+
"inputs": ["{projectRoot}/src/index.ts"],
28+
"dependsOn": ["default", "^default","^build"],
29+
"executor": "@nx/workspace:run-commands",
30+
"cache": true
31+
},
32+
"dist":{
33+
"outputs": ["{projectRoot}/dist/**/*"],
34+
"dependsOn": ["build"],
35+
"executor": "@nx/workspace:run-commands",
36+
"cache": true
37+
}
38+
}
39+
40+
}

Diff for: lambdas/package.json

+21-10
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,29 @@
66
"libs/*"
77
],
88
"scripts": {
9-
"bootstrap": "lerna bootstrap",
10-
"build": "lerna run build",
11-
"dist": "lerna run build && lerna run dist",
12-
"format": "lerna run format",
13-
"format-check": "lerna run format-check",
14-
"lint": "lerna run lint",
15-
"test": "lerna run test"
16-
},
17-
"devDependencies": {
18-
"lerna": "^8.0.1"
9+
"build": "nx run-many --target=build --all",
10+
"affected:build": "nx affected:build --parallel",
11+
"dist": "nx run-many --target=dist --all",
12+
"format": "nx run-many --target=format --all",
13+
"format-check": "nx run-many --target=format-check --all",
14+
"affected:format-check": "nx affected:format-check --parallel",
15+
"lint": "nx run-many --target=lint --all",
16+
"affected:lint": "nx affected:lint --parallel",
17+
"test": "nx run-many --target=test --all",
18+
"affected:test": "nx affected:test --parallel"
1919
},
2020
"resolutions": {
2121
"@octokit/types": "^12.0.0"
22+
},
23+
"devDependencies": {
24+
"@nx/eslint": "18.0.4",
25+
"@nx/jest": "18.0.4",
26+
"@nx/js": "^18.0.4",
27+
"@swc-node/register": "~1.8.0",
28+
"@swc/core": "~1.3.85",
29+
"@swc/helpers": "~0.5.2",
30+
"jest": "^29.4.1",
31+
"nx": "18.0.4",
32+
"prettier": "^2.6.2"
2233
}
2334
}

0 commit comments

Comments
 (0)