Skip to content

Commit 5c25a82

Browse files
committed
Add check for import without globals
1 parent 8d67731 commit 5c25a82

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

.github/workflows/check.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ name: Check
33
on: [push, pull_request]
44

55
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- run: npm i
11+
- run: npm run build:check
12+
613
coverage:
714
runs-on: ubuntu-latest
815
steps:
@@ -26,4 +33,4 @@ jobs:
2633
- uses: actions/checkout@v3
2734
- run: npm i
2835
- run: npm run build
29-
- run: npm run tsd
36+
- run: npm run test:types

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@
3737
"scripts": {
3838
"fmt": "prettier --write .",
3939
"fmt:check": "prettier --check .",
40-
"build": "tsc",
41-
"test": "tsc && PATH=$(env -i bash -c 'echo $PATH') node_modules/.bin/uvu test -i fixtures",
42-
"tsd": "tsd",
40+
"build": "tsc --project tsconfig.prod.json",
41+
"build:check": "tsc",
42+
"test": "npm run build && PATH=$(env -i bash -c 'echo $PATH') node_modules/.bin/uvu test -i fixtures",
43+
"test:types": "tsd",
4344
"coverage": "c8 --check-coverage npm test -- -i package",
4445
"mutation": "stryker run"
4546
},

src/cli.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ import { createRequire } from 'node:module'
1919
import { tmpdir } from 'node:os'
2020
import { basename, dirname, extname, join, resolve } from 'node:path'
2121
import url from 'node:url'
22-
import './globals.js'
2322
import { updateArgv } from './goods.js'
2423
import { $, argv, chalk, fetch, ProcessOutput } from './index.js'
2524
import { startRepl } from './repl.js'
2625
import { randomId } from './util.js'
2726

2827
await (async function main() {
28+
const globals = './globals.js'
29+
await import(globals)
2930
$.verbose = !argv.quiet
3031
if (typeof argv.shell === 'string') {
3132
$.shell = argv.shell

tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
"outDir": "./build",
99
"declaration": true
1010
},
11-
"include": ["./src/**/*"]
11+
"include": ["./src/**/*"],
12+
"exclude": ["./src/globals.ts"]
1213
}

tsconfig.prod.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"exclude": []
4+
}

0 commit comments

Comments
 (0)