Skip to content

Commit c953efb

Browse files
committed
fix: yarn build
Before this commit, and since ab8bc71, this command would fail: ``` error TS6059: File '<>/expo-server-sdk-node/eslint.config.ts' is not under 'rootDir' '<>/expo-server-sdk-node/src'. 'rootDir' is expected to contain all source files. The file is in the program because: Matched by default include pattern '**/*' ``` We want `tsconfig.json` to include `eslint.config.ts`, so that we detect type errors in it. However, we don't want `tsconfig.build.json` to include it, so that `tsc` doesn't produce build output for it. To detect this problem in the future, I added a check in the github tests workflow.
1 parent ac82bf6 commit c953efb

File tree

5 files changed

+73
-32
lines changed

5 files changed

+73
-32
lines changed

.github/workflows/tests.yml

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,46 @@
11
name: Tests
2-
on:
2+
on:
33
push:
4-
pull_request:
54
jobs:
6-
build:
5+
typecheck:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
9+
- run: corepack enable
10+
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
11+
with:
12+
cache: yarn
13+
- run: yarn
14+
- run: yarn tsc
15+
# This command builds, and then prints files which would be included in the published package
16+
- run: yarn pack --dry-run
17+
lint:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
21+
- run: corepack enable
22+
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
23+
with:
24+
node-version-file: package.json
25+
cache: yarn
26+
- run: yarn
27+
- run: yarn lint --max-warnings=0
28+
test:
729
runs-on: ubuntu-latest
830
strategy:
931
matrix:
1032
node-version: [18, 20, 22]
1133
steps:
12-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
13-
- run: corepack enable
14-
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
15-
with:
16-
node-version: ${{ matrix.node-version }}
17-
cache: yarn
18-
- run: yarn --immutable
19-
- run: yarn add -D @types/node@${{ matrix.node-version }}
20-
- run: yarn tsc
21-
- run: yarn lint --max-warnings=0
22-
- run: yarn test --coverage
23-
- uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5
24-
with:
25-
flags: "node_${{ matrix.node-version }}"
26-
env:
27-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
34+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
35+
- run: corepack enable
36+
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
37+
with:
38+
node-version: ${{ matrix.node-version }}
39+
cache: yarn
40+
- run: yarn
41+
- run: yarn test --coverage
42+
- uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5
43+
with:
44+
flags: 'node_${{ matrix.node-version }}'
45+
env:
46+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
"files": [
88
"build"
99
],
10+
"engines": {
11+
"node": ">=18"
12+
},
1013
"scripts": {
11-
"build": "tsc --project tsconfig.build.json",
14+
"build": "yarn prepack",
1215
"lint": "eslint",
13-
"prepare": "yarn build",
16+
"prepack": "tsc --project tsconfig.build.json",
1417
"test": "jest",
1518
"tsc": "tsc",
1619
"watch": "tsc --watch"
@@ -49,8 +52,9 @@
4952
"promise-retry": "^2.0.1"
5053
},
5154
"devDependencies": {
52-
"@tsconfig/node-lts": "22.0.1",
55+
"@tsconfig/node18": "^18.2.4",
5356
"@tsconfig/strictest": "2.0.5",
57+
"@types/node": "18",
5458
"@types/node-fetch": "2.6.12",
5559
"@types/promise-retry": "1.1.6",
5660
"eslint": "9.26.0",

tsconfig.build.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"outDir": "./build",
66
"rootDir": "./src"
77
},
8-
"exclude": ["node_modules", "**/__mocks__", "**/__tests__", "build", "coverage"]
8+
"include": ["src"],
9+
"exclude": ["src/__tests__"]
910
}

tsconfig.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"extends": ["@tsconfig/strictest/tsconfig.json", "@tsconfig/node-lts/tsconfig.json"],
2+
"extends": ["@tsconfig/strictest/tsconfig", "@tsconfig/node18/tsconfig"],
33
"compilerOptions": {
4-
"sourceMap": true,
5-
"composite": true,
6-
"noEmit": true
4+
"declaration": true,
5+
"noEmit": true,
6+
"sourceMap": true
77
},
88
"exclude": ["build", "coverage"]
99
}

yarn.lock

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,10 +1058,10 @@ __metadata:
10581058
languageName: node
10591059
linkType: hard
10601060

1061-
"@tsconfig/node-lts@npm:22.0.1":
1062-
version: 22.0.1
1063-
resolution: "@tsconfig/node-lts@npm:22.0.1"
1064-
checksum: 10c0/9e8dbe98daac8eaebd78fc3aea33ee479e7ec9c6f34550ca024ab48d5f9cbe225de8ab9d56e10cf7416261d3ad72b2657fbb8d560443dafb21eabf615b8ad98e
1061+
"@tsconfig/node18@npm:^18.2.4":
1062+
version: 18.2.4
1063+
resolution: "@tsconfig/node18@npm:18.2.4"
1064+
checksum: 10c0/cdfd17f212660374eb2765cd5907b2252e43cfa2623cd52307a49f004327ef49bbe7d53c78b0aca57f33e9a5cb0d7d2eb5ded9be1235e6212f65c9f0699322b6
10651065
languageName: node
10661066
linkType: hard
10671067

@@ -1194,6 +1194,15 @@ __metadata:
11941194
languageName: node
11951195
linkType: hard
11961196

1197+
"@types/node@npm:18":
1198+
version: 18.19.112
1199+
resolution: "@types/node@npm:18.19.112"
1200+
dependencies:
1201+
undici-types: "npm:~5.26.4"
1202+
checksum: 10c0/e3421fb3c755337a0477014b235026d914cac8266b67de5867d778b2d4ce2ed0c8052c922e61810f2364d6b29ee24c6ea18671c5636076371b82b0d3e480fbef
1203+
languageName: node
1204+
linkType: hard
1205+
11971206
"@types/promise-retry@npm:1.1.6":
11981207
version: 1.1.6
11991208
resolution: "@types/promise-retry@npm:1.1.6"
@@ -2912,8 +2921,9 @@ __metadata:
29122921
version: 0.0.0-use.local
29132922
resolution: "expo-server-sdk@workspace:."
29142923
dependencies:
2915-
"@tsconfig/node-lts": "npm:22.0.1"
2924+
"@tsconfig/node18": "npm:^18.2.4"
29162925
"@tsconfig/strictest": "npm:2.0.5"
2926+
"@types/node": "npm:18"
29172927
"@types/node-fetch": "npm:2.6.12"
29182928
"@types/promise-retry": "npm:1.1.6"
29192929
eslint: "npm:9.26.0"
@@ -6505,6 +6515,13 @@ __metadata:
65056515
languageName: node
65066516
linkType: hard
65076517

6518+
"undici-types@npm:~5.26.4":
6519+
version: 5.26.5
6520+
resolution: "undici-types@npm:5.26.5"
6521+
checksum: 10c0/bb673d7876c2d411b6eb6c560e0c571eef4a01c1c19925175d16e3a30c4c428181fb8d7ae802a261f283e4166a0ac435e2f505743aa9e45d893f9a3df017b501
6522+
languageName: node
6523+
linkType: hard
6524+
65086525
"undici-types@npm:~6.20.0":
65096526
version: 6.20.0
65106527
resolution: "undici-types@npm:6.20.0"

0 commit comments

Comments
 (0)