Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions src/globals-jsr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,52 @@

import * as _ from './index.ts'
Object.assign(globalThis, _)

declare global {
type ProcessPromise = _.ProcessPromise
type ProcessOutput = _.ProcessOutput
var ProcessPromise: typeof _.ProcessPromise
var ProcessOutput: typeof _.ProcessOutput
var $: typeof _.$
var argv: typeof _.argv
var cd: typeof _.cd
var chalk: typeof _.chalk
var defaults: typeof _.defaults
var dotenv: typeof _.dotenv
var echo: typeof _.echo
var expBackoff: typeof _.expBackoff
var fs: typeof _.fs
var glob: typeof _.glob
var globby: typeof _.globby
var kill: typeof _.kill
var log: typeof _.log
var minimist: typeof _.minimist
var nothrow: typeof _.nothrow
var os: typeof _.os
var parseArgv: typeof _.parseArgv
var path: typeof _.path
var ps: typeof _.ps
var question: typeof _.question
var quiet: typeof _.quiet
var quote: typeof _.quote
var quotePowerShell: typeof _.quotePowerShell
var resolveDefaults: typeof _.resolveDefaults
var retry: typeof _.retry
var sleep: typeof _.sleep
var spinner: typeof _.spinner
var stdin: typeof _.stdin
var syncProcessCwd: typeof _.syncProcessCwd
var tempdir: typeof _.tempdir
var tempfile: typeof _.tempfile
var tmpdir: typeof _.tempdir
var tmpfile: typeof _.tempfile
var updateArgv: typeof _.updateArgv
var usePowerShell: typeof _.usePowerShell
var usePwsh: typeof _.usePwsh
var useBash: typeof _.useBash
var version: typeof _.version
var VERSION: typeof _.VERSION
var which: typeof _.which
var within: typeof _.within
var YAML: typeof _.YAML
}
2 changes: 1 addition & 1 deletion src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import * as _ from './index.ts'

Object.assign(globalThis, _)
// TODO: global types not working with jsr.io

declare global {
type ProcessPromise = _.ProcessPromise
type ProcessOutput = _.ProcessOutput
Expand Down
6 changes: 4 additions & 2 deletions test/export.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,15 @@ describe('index', () => {
assert.equal(typeof index.fs, 'object', 'index.fs')
assert.equal(typeof index.fs.Dir, 'function', 'index.fs.Dir')
assert.equal(typeof index.fs.Dirent, 'function', 'index.fs.Dirent')
assert.equal(typeof index.fs.F_OK, 'number', 'index.fs.F_OK')
assert.equal(typeof index.fs.FileReadStream, 'function', 'index.fs.FileReadStream')
assert.equal(typeof index.fs.FileWriteStream, 'function', 'index.fs.FileWriteStream')
assert.equal(typeof index.fs.R_OK, 'number', 'index.fs.R_OK')
assert.equal(typeof index.fs.ReadStream, 'function', 'index.fs.ReadStream')
assert.equal(typeof index.fs.Stats, 'function', 'index.fs.Stats')
assert.equal(typeof index.fs.Utf8Stream, 'function', 'index.fs.Utf8Stream')
assert.equal(typeof index.fs.W_OK, 'number', 'index.fs.W_OK')
assert.equal(typeof index.fs.WriteStream, 'function', 'index.fs.WriteStream')
assert.equal(typeof index.fs.X_OK, 'number', 'index.fs.X_OK')
assert.equal(typeof index.fs._toUnixTimestamp, 'function', 'index.fs._toUnixTimestamp')
assert.equal(typeof index.fs.access, 'function', 'index.fs.access')
assert.equal(typeof index.fs.accessSync, 'function', 'index.fs.accessSync')
Expand Down Expand Up @@ -323,7 +326,6 @@ describe('index', () => {
assert.equal(typeof index.fs.mkdirs, 'function', 'index.fs.mkdirs')
assert.equal(typeof index.fs.mkdirsSync, 'function', 'index.fs.mkdirsSync')
assert.equal(typeof index.fs.mkdtemp, 'function', 'index.fs.mkdtemp')
assert.equal(typeof index.fs.mkdtempDisposableSync, 'function', 'index.fs.mkdtempDisposableSync')
assert.equal(typeof index.fs.mkdtempSync, 'function', 'index.fs.mkdtempSync')
assert.equal(typeof index.fs.move, 'function', 'index.fs.move')
assert.equal(typeof index.fs.moveSync, 'function', 'index.fs.moveSync')
Expand Down
2 changes: 1 addition & 1 deletion test/it/build-jsr.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ describe('jsr artifact', () => {

it('publish --dry-run`', async () => {
await t$`node scripts/build-jsr.mjs`
await t$({ quiet: false })`jsr publish --dry-run`
await t$({ quiet: false })`jsr publish --dry-run --allow-slow-types`
})
})
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
"types": ["node", "fs-extra"]
},
"include": ["./src/**/*"],
"exclude": ["./src/globals.ts"]
"exclude": ["./src/globals.ts", "./src/globals-jsr.ts"]
}
// globals-jsr.ts is excluded to prevent "Duplicate identifier" errors with globals.ts during the main build.
// It is used specifically for the JSR distribution.