Skip to content

Commit 7b3e0f9

Browse files
committed
chore: typescript maintenance
- Combined the jsconfig files in to a single one. - Disable declaration sourcemaps - Correctly set module to NodeNext and resolve inconsistencies. - Removes types from the repo and .gitignore them for the next commits - Adds TSC run in CI - Runs tsc in prepublishOnly, so we can still include .d.ts files in to the published NPM packages
1 parent 6037fa0 commit 7b3e0f9

File tree

318 files changed

+3907
-13944
lines changed

Some content is hidden

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

318 files changed

+3907
-13944
lines changed

.github/workflows/main-checks.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,35 @@ on:
44
branches: [main]
55

66
jobs:
7+
types:
8+
permissions:
9+
contents: read
10+
timeout-minutes: 15
11+
strategy:
12+
matrix:
13+
node: [20]
14+
runs-on: ubuntu-latest
15+
env:
16+
CI: true
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
21+
- name: Node.js ${{ matrix.node }}
22+
uses: actions/setup-node@v3.7.0
23+
with:
24+
node-version: ${{ matrix.node }}
25+
cache: "npm"
26+
27+
- name: Install dependencies
28+
run: |
29+
npm ci
30+
31+
- name: Generate and run types
32+
run: |
33+
npx compas generate --skip-tsc --skip-lint
34+
npx compas run types
35+
736
test:
837
permissions:
938
contents: read

.github/workflows/pr-checks.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,35 @@ jobs:
3434
CI=false npx compas generate --skip-tsc
3535
npx compas lint
3636
37+
types:
38+
permissions:
39+
contents: read
40+
timeout-minutes: 15
41+
strategy:
42+
matrix:
43+
node: [20]
44+
runs-on: ubuntu-latest
45+
env:
46+
CI: true
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v3
50+
51+
- name: Node.js ${{ matrix.node }}
52+
uses: actions/setup-node@v3.7.0
53+
with:
54+
node-version: ${{ matrix.node }}
55+
cache: "npm"
56+
57+
- name: Install dependencies
58+
run: |
59+
npm ci
60+
61+
- name: Generate and run types
62+
run: |
63+
npx compas generate --skip-tsc --skip-lint
64+
npx compas run types
65+
3766
test:
3867
permissions:
3968
contents: read

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ coverage
4444

4545
# Types
4646
**.d.ts.map
47+
**.d.ts
48+
!advanced-types.d.ts
49+
!common/types.d.ts
4750

4851
# Examples
4952
# Ignore any generated output of examples

jsconfig.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
"compilerOptions": {
33
"target": "esnext",
44
"lib": ["esnext"],
5-
"noEmit": true,
6-
"module": "esnext",
5+
"module": "NodeNext",
76
"checkJs": true,
87
"maxNodeModuleJsDepth": 0,
98
"baseUrl": "./",
10-
"moduleResolution": "node",
119
"strict": true,
12-
"noImplicitAny": false
10+
"noImplicitAny": false,
11+
"declaration": true,
12+
"noEmit": false,
13+
"emitDeclarationOnly": true,
14+
"extendedDiagnostics": true
1315
},
1416
"typeAcquisition": {
1517
"enable": true
1618
},
17-
"include": ["**/*.js", "**/types/**/*.d.ts"],
18-
"exclude": ["**/*.test.js", "**/*.bench.js"]
19+
"include": ["packages/**/*"],
20+
"exclude": ["packages/eslint-plugin/**/*", "**/*.test.js", "**/*.bench.js"]
1921
}

jsconfig.types.json

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

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"private": true,
44
"type": "module",
55
"scripts": {
6+
"prepublishOnly": "compas run types",
7+
"postpublish": "compas run types --script-args='clean'",
68
"docs:dev": "vitepress dev docs",
79
"docs:build": "vitepress build docs",
810
"docs:serve": "vitepress serve docs"

packages/cli/index.d.ts

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

packages/cli/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
/**
2-
* @typedef {import("./src/generated/common/types").CliCommandDefinitionInput} CliCommandDefinitionInput
2+
* @typedef {import("./src/generated/common/types.js").CliCommandDefinitionInput} CliCommandDefinitionInput
33
*/
44

55
/**
6-
* @typedef {import("./src/generated/common/types").CliCompletion} CliCompletion
6+
* @typedef {import("./src/generated/common/types.js").CliCompletion} CliCompletion
77
*/
88

99
/**
10-
* @typedef {import("./src/cli/types").CliResult} CliResult
10+
* @typedef {import("./src/cli/types.js").CliResult} CliResult
1111
*/
1212

1313
/**
14-
* @typedef {import("./src/cli/types").CliExecutorState} CliExecutorState
14+
* @typedef {import("./src/cli/types.js").CliExecutorState} CliExecutorState
1515
*/
1616

1717
/**

packages/cli/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
"name": "@compas/cli",
33
"version": "0.6.0",
44
"description": "CLI containing utilities and simple script runner",
5-
"main": "./index.js",
65
"exports": {
7-
".": "./index.js",
6+
".": {
7+
"import": {
8+
"types": "./index.d.ts",
9+
"default": "./index.js"
10+
}
11+
},
812
"./package.json": "./package.json"
913
},
10-
"types": "./index.d.ts",
1114
"type": "module",
1215
"bin": {
1316
"compas": "src/compas/index.js"

packages/cli/src/benchmarking/index.d.ts

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

0 commit comments

Comments
 (0)