Skip to content

Commit 26ffecb

Browse files
committed
chore: migrate to ts project reference, new eslint config, and swc compiler
1 parent d337acf commit 26ffecb

File tree

132 files changed

+1715
-442
lines changed

Some content is hidden

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

132 files changed

+1715
-442
lines changed

.github/workflows/smoke-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
1515
npm_config_registry: http://localhost:4873
1616
YARN_REGISTRY: http://localhost:4873
17+
NODE_OPTIONS: '--max-old-space-size=32768'
1718
timeout-minutes: 60
1819
strategy:
1920
matrix:

.gitignore

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
# See http://help.github.com/ignore-files/ for more about ignoring files.
22

33
# compiled output
4-
/dist
4+
dist
55
tmp
6-
/out-tsc
7-
/bin
6+
out-tsc
87

98
# dependencies
10-
/node_modules
11-
.pnpm-store
9+
node_modules
1210

1311
# IDEs and editors
1412
/.idea

bun.lockb

2.67 KB
Binary file not shown.

e2e/nx-flutter-e2e/tsconfig.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
"files": [],
44
"include": [],
55
"references": [
6+
{
7+
"path": "../../packages/common"
8+
},
9+
{
10+
"path": "../../packages/common-cli"
11+
},
612
{
713
"path": "./tsconfig.spec.json"
814
}

e2e/nx-ktor-e2e/tsconfig.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
"files": [],
44
"include": [],
55
"references": [
6+
{
7+
"path": "../../packages/common-jvm"
8+
},
9+
{
10+
"path": "../../packages/common-cli"
11+
},
612
{
713
"path": "./tsconfig.spec.json"
814
}

e2e/nx-melos-e2e/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"files": [],
44
"include": [],
55
"references": [
6+
{
7+
"path": "../../packages/common"
8+
},
69
{
710
"path": "./tsconfig.spec.json"
811
}

e2e/nx-micronaut-e2e/tsconfig.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
"files": [],
44
"include": [],
55
"references": [
6+
{
7+
"path": "../../packages/common-jvm"
8+
},
9+
{
10+
"path": "../../packages/common-cli"
11+
},
612
{
713
"path": "./tsconfig.spec.json"
814
}

e2e/nx-quarkus-e2e/tsconfig.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
"files": [],
44
"include": [],
55
"references": [
6+
{
7+
"path": "../../packages/common-jvm"
8+
},
9+
{
10+
"path": "../../packages/common-cli"
11+
},
612
{
713
"path": "./tsconfig.spec.json"
814
}

e2e/nx-spring-boot-e2e/tsconfig.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
"files": [],
44
"include": [],
55
"references": [
6+
{
7+
"path": "../../packages/common-jvm"
8+
},
9+
{
10+
"path": "../../packages/common-cli"
11+
},
612
{
713
"path": "./tsconfig.spec.json"
814
}

e2e/smoke/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"files": [],
44
"include": [],
55
"references": [
6+
{
7+
"path": "../../packages/common"
8+
},
69
{
710
"path": "./tsconfig.spec.json"
811
}

nx.json

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"preVersionCommand": "bunx nx run-many -t build",
1616
"conventionalCommits": true,
1717
"generatorOptions": {
18-
"packageRoot": "dist/packages/{projectName}",
1918
"updateDependents": "auto"
2019
}
2120
}
@@ -36,6 +35,7 @@
3635
"$schema": "./node_modules/nx/schemas/nx-schema.json",
3736
"targetDefaults": {
3837
"test": {
38+
"dependsOn": ["^build"],
3939
"options": {
4040
"passWithNoTests": true,
4141
"detectOpenHandles": true,
@@ -48,6 +48,9 @@
4848
}
4949
}
5050
},
51+
"test-ci--**/**": {
52+
"dependsOn": ["^build"]
53+
},
5154
"e2e": {
5255
"inputs": ["e2eInputs", "^production"],
5356
"options": {
@@ -70,34 +73,33 @@
7073
"parallelism": false,
7174
"dependsOn": ["nxrocks:populate-local-registry"]
7275
},
73-
"nx-release-publish": {
74-
"options": {
75-
"packageRoot": "dist/packages/{projectName}"
76-
}
77-
},
78-
"@nx/js:tsc": {
76+
"@nx/js:swc": {
7977
"cache": true,
8078
"dependsOn": ["^build"],
8179
"inputs": ["production", "^production"]
82-
},
83-
"@nx/eslint:lint": {
84-
"cache": true,
85-
"inputs": [
86-
"default",
87-
"{workspaceRoot}/.eslintrc.json",
88-
"{workspaceRoot}/.eslintignore",
89-
"{workspaceRoot}/eslint.config.js"
90-
]
9180
}
9281
},
9382
"nxCloudAccessToken": "ZDRmZDczZWUtMDU2My00YzQ0LTlkMWEtZjM2YjZlZWNmNGIxfHJlYWQ=",
9483
"parallel": 1,
9584
"plugins": [
85+
{
86+
"plugin": "@nx/js/typescript",
87+
"options": {
88+
"typecheck": {
89+
"targetName": "typecheck"
90+
},
91+
"build": {
92+
"targetName": "build",
93+
"configName": "tsconfig.lib.json",
94+
"buildDepsName": "build-deps",
95+
"watchDepsName": "watch-deps"
96+
}
97+
}
98+
},
9699
{
97100
"plugin": "@nx/eslint/plugin",
98101
"options": {
99-
"targetName": "lint",
100-
"extensions": ["ts", "tsx", "js", "jsx", "html", "vue"]
102+
"targetName": "lint"
101103
}
102104
},
103105
{
@@ -147,7 +149,7 @@
147149
"production": [
148150
"default",
149151
"!{projectRoot}/.eslintrc.json",
150-
"!{projectRoot}/eslint.config.js",
152+
"!{projectRoot}/eslint.config.mjs",
151153
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
152154
"!{projectRoot}/tsconfig.spec.json",
153155
"!{projectRoot}/jest.config.[jt]s",
@@ -183,6 +185,5 @@
183185
"defaultBase": "develop",
184186
"cli": {
185187
"packageManager": "bun"
186-
},
187-
"useLegacyCache": false
188+
}
188189
}

package.json

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,19 @@
2121
"run-migrate": "nx migrate --run-migrations --if-exists",
2222
"graph": "nx graph",
2323
"help": "nx help",
24-
"release": "nx release --dry-run -- --skip-nx-cache",
24+
"release": "nx release --dry-run --verbose",
2525
"prepare": "husky",
2626
"smoke": "FORCE_SMOKE_TESTS=true nx e2e smoke",
2727
"smoke-keep": "KEEP_SMOKE_TESTS_DIR=true bun smoke",
2828
"sync-preset-schemas": "ts-node -P ./tools/tsconfig.tools.json ./tools/scripts/sync-preset-schemas.ts",
29-
"nuke": "rm -rf tmp/ dist/ ~/.bun/install/cache && find ./e2e -type d -name \"tmp\" -exec rm -rf {} + && nx reset && git gc",
29+
"nuke": "rm -rf tmp/ dist/ ~/.bun/install/cache && find ./e2e -type d -name \"tmp\" -exec rm -rf {} + && find ./packages -type d -name \"dist\" -exec rm -rf {} + && find ./packages -type d -name \"out-tsc\" -exec rm -rf {} + && nx reset",
3030
"run-local-registry": "ts-node -P ./tools/tsconfig.tools.json ./tools/scripts/run-local-registry.ts",
3131
"start-local-registry": "ts-node -P ./tools/tsconfig.tools.json -e \"(async () => { try { const m = await import('./tools/scripts/start-local-registry'); await m.default(); process.exit(0); } catch (err) { console.error(err); process.exit(1); } })()\"",
3232
"stop-local-registry": "ts-node -P ./tools/tsconfig.tools.json -e \"import('./tools/scripts/stop-local-registry').then(m => m.default()).catch(console.error)\""
3333
},
3434
"private": true,
3535
"dependencies": {
3636
"@clack/prompts": "^0.10.0",
37-
"@swc/helpers": "0.5.11",
3837
"@nx/devkit": "20.6.2",
3938
"create-nx-workspace": "20.6.2",
4039
"enquirer": "^2.4.1",
@@ -43,7 +42,6 @@
4342
"minimatch": "^9.0.3",
4443
"node-fetch": "^2.6.12",
4544
"terminal-link": "^2.1.1",
46-
"tslib": "^2.6.1",
4745
"unzipper": "^0.12.3",
4846
"xmlbuilder2": "^3.1.1",
4947
"xpath": "^0.0.34",
@@ -54,15 +52,18 @@
5452
"@commitlint/cli": "^19.3.0",
5553
"@commitlint/config-angular": "^19.3.0",
5654
"@jest/globals": "29.7.0",
55+
"@nx/eslint": "20.6.2",
5756
"@nx/eslint-plugin": "20.6.2",
5857
"@nx/jest": "20.6.2",
5958
"@nx/js": "20.6.2",
6059
"@nx/node": "20.6.2",
6160
"@nx/plugin": "20.6.2",
6261
"@nx/workspace": "20.6.2",
63-
"@swc-node/register": "1.9.1",
64-
"@swc/cli": "0.3.12",
65-
"@swc/core": "1.5.7",
62+
"@swc-node/register": "~1.9.1",
63+
"@swc/cli": "~0.3.12",
64+
"@swc/core": "~1.5.7",
65+
"@swc/helpers": "~0.5.11",
66+
"@swc/jest": "~0.2.36",
6667
"@types/fs-extra": "^9.0.13",
6768
"@types/jest": "29.5.12",
6869
"@types/node": "18.16.9",
@@ -71,8 +72,6 @@
7172
"@types/unzipper": "^0.10.5",
7273
"@types/xmldoc": "^1.1.6",
7374
"@types/yargs": "^17.0.26",
74-
"@typescript-eslint/eslint-plugin": "^7.3.0",
75-
"@typescript-eslint/parser": "^7.3.0",
7675
"eslint": "^9.8.0",
7776
"eslint-config-prettier": "^9.0.0",
7877
"fs-extra": "^10.1.0",
@@ -81,7 +80,6 @@
8180
"jest-environment-jsdom": "29.7.0",
8281
"jest-environment-node": "^29.7.0",
8382
"jsonc-eslint-parser": "^2.1.0",
84-
"jest-mock": "29.7.0",
8583
"lint-staged": "^15.2.7",
8684
"nx": "20.6.2",
8785
"prettier": "2.6.2",
@@ -98,6 +96,10 @@
9896
"nx": {
9997
"includedScripts": []
10098
},
99+
"workspaces": [
100+
"packages/**",
101+
"e2e/**"
102+
],
101103
"patchedDependencies": {
102104
103105
}

packages/common-cli/.spec.swcrc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"jsc": {
3+
"target": "es2017",
4+
"parser": {
5+
"syntax": "typescript",
6+
"decorators": true,
7+
"dynamicImport": true
8+
},
9+
"transform": {
10+
"decoratorMetadata": true,
11+
"legacyDecorator": true
12+
},
13+
"keepClassNames": true,
14+
"externalHelpers": true,
15+
"loose": true
16+
},
17+
"module": {
18+
"type": "es6"
19+
},
20+
"sourceMaps": true,
21+
"exclude": []
22+
}

packages/common-cli/.swcrc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"jsc": {
3+
"target": "es2017",
4+
"parser": {
5+
"syntax": "typescript",
6+
"decorators": true,
7+
"dynamicImport": true
8+
},
9+
"transform": {
10+
"decoratorMetadata": true,
11+
"legacyDecorator": true
12+
},
13+
"keepClassNames": true,
14+
"externalHelpers": true,
15+
"loose": true
16+
},
17+
"module": {
18+
"type": "es6"
19+
},
20+
"sourceMaps": true,
21+
"exclude": [
22+
"jest.config.ts",
23+
".*\\.spec.tsx?$",
24+
".*\\.test.tsx?$",
25+
"./src/jest-setup.ts$",
26+
"./**/jest-setup.ts$",
27+
".*.js$"
28+
]
29+
}

packages/common-cli/jest.config.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
/* eslint-disable */
2+
import { readFileSync } from 'fs';
3+
4+
// Reading the SWC compilation config for the spec files
5+
const swcJestConfig = JSON.parse(
6+
readFileSync(`${__dirname}/.spec.swcrc`, 'utf-8')
7+
);
8+
9+
// Disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves
10+
swcJestConfig.swcrc = false;
11+
212
export default {
313
displayName: 'common-cli',
414
preset: '../../jest.preset.js',
515
testEnvironment: 'node',
616
transform: {
7-
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
17+
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
818
},
919
moduleFileExtensions: ['ts', 'js', 'html'],
10-
coverageDirectory: '../../coverage/packages/common-cli',
20+
coverageDirectory: 'test-output/jest/coverage',
1121
};

0 commit comments

Comments
 (0)