Commit 5f40814
Changed files (6)
.github/workflows/test.yml
@@ -38,8 +38,6 @@ jobs:
checks:
needs: build
runs-on: ubuntu-latest
- env:
- FORCE_COLOR: 3
steps:
- uses: actions/checkout@v4
with:
@@ -71,6 +69,13 @@ jobs:
- name: Circular
run: npm run test:circular
+ - name: Bundles
+ run: npm run test:it
+ timeout-minutes: 1
+
+ - name: JSR dry-run
+ run: npm run test:jsr
+
test:
needs: build
runs-on: ubuntu-latest
src/cli.ts
@@ -32,7 +32,7 @@ import {
import { installDeps, parseDeps } from './deps.js'
import { startRepl } from './repl.js'
import { randomId, bufToString } from './util.js'
-import { createRequire } from './vendor.js'
+import { createRequire, type minimist } from './vendor.js'
const EXT = '.mjs'
@@ -78,7 +78,7 @@ export function printUsage() {
}
// prettier-ignore
-export const argv = parseArgv(process.argv.slice(2), {
+export const argv: minimist.ParsedArgs = parseArgv(process.argv.slice(2), {
string: ['shell', 'prefix', 'postfix', 'eval', 'cwd', 'ext', 'registry', 'env'],
boolean: ['version', 'help', 'quiet', 'verbose', 'install', 'repl', 'experimental', 'prefer-local'],
alias: { e: 'eval', i: 'install', v: 'version', h: 'help', l: 'prefer-local', 'env-file': 'env' },
@@ -87,7 +87,7 @@ export const argv = parseArgv(process.argv.slice(2), {
camelCase: true,
})
-export async function main() {
+export async function main(): Promise<void> {
await import('./globals.js')
argv.ext = normalizeExt(argv.ext)
if (argv.cwd) $.cwd = argv.cwd
@@ -205,7 +205,7 @@ async function readScriptFromHttp(remote: string): Promise<string> {
return res.text()
}
-export function injectGlobalRequire(origin: string) {
+export function injectGlobalRequire(origin: string): void {
const __filename = path.resolve(origin)
const __dirname = path.dirname(__filename)
const require = createRequire(origin)
src/core.ts
@@ -451,7 +451,7 @@ export class ProcessPromise extends Promise<ProcessOutput> {
}
// Getters
- get id() {
+ get id(): string {
return this._id
}
@@ -617,7 +617,7 @@ export class ProcessPromise extends Promise<ProcessOutput> {
}
// Async iterator API
- async *[Symbol.asyncIterator]() {
+ async *[Symbol.asyncIterator](): AsyncIterator<string> {
let last: string | undefined
const getLines = (chunk: Buffer | string) => {
const lines = ((last || '') + bufToString(chunk)).split('\n')
@@ -918,7 +918,7 @@ export function resolveDefaults(
defs: Options = defaults,
prefix: string = ENV_PREFIX,
env = process.env
-) {
+): Options {
const allowed = new Set([
'cwd',
'preferLocal',
src/error.ts
@@ -185,7 +185,7 @@ export const formatExitMessage = (
signal: NodeJS.Signals | null,
stderr: string,
from: string
-) => {
+): string => {
let message = `exit code: ${code}`
if (code != 0 || signal != null) {
message = `${stderr || '\n'} at ${from}`
@@ -203,7 +203,7 @@ export const formatExitMessage = (
export const formatErrorMessage = (
err: NodeJS.ErrnoException,
from: string
-) => {
+): string => {
return (
`${err.message}\n` +
` errno: ${err.errno} (${getErrnoMessage(err.errno)})\n` +
@@ -212,11 +212,11 @@ export const formatErrorMessage = (
)
}
-export function getCallerLocation(err = new Error('zx error')) {
+export function getCallerLocation(err = new Error('zx error')): string {
return getCallerLocationFromString(err.stack)
}
-export function getCallerLocationFromString(stackString = 'unknown') {
+export function getCallerLocationFromString(stackString = 'unknown'): string {
return (
stackString
.split(/^\s*(at\s)?/m)
src/index.ts
@@ -29,10 +29,10 @@ export {
glob as globby,
} from './vendor.js'
-export const VERSION = fs.readJsonSync(
+export const VERSION: string = fs.readJsonSync(
new URL('../package.json', import.meta.url)
).version
-export const version = VERSION
+export const version: string = VERSION
export {
type Duration,
test/it/build-jsr.test.js
@@ -45,8 +45,8 @@ describe('jsr artifact', () => {
})
after(() => fs.remove(tmp))
- it('publish --dry-run --allow-dirty`', async () => {
+ it('publish --dry-run`', async () => {
await t$`node scripts/build-jsr.mjs`
- await t$({ quiet: false })`jsr publish --dry-run --allow-dirty`
+ await t$({ quiet: false })`jsr publish --dry-run`
})
})