Skip to content

Commit

Permalink
build: separate spawn pkg entry
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Mar 16, 2024
1 parent e73bb7a commit 71dbf65
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
"require": "./target/cjs/index.cjs",
"import": "./target/esm/index.mjs",
"default": "./target/esm/index.mjs"
},
"./spawn": {
"types": "./target/dts/spawn.d.ts",
"require": "./target/cjs/spawn.cjs",
"import": "./target/esm/spawn.mjs",
"default": "./target/esm/spawn.mjs"
}
},
"module": "target/esm/index.mjs",
Expand All @@ -22,7 +28,7 @@
],
"scripts": {
"build": "concurrently 'npm:build:*'",
"build:js": "node ./src/scripts/build.mjs",
"build:js": "node ./src/scripts/build.mjs --entry='./src/main/ts/index.ts:./src/main/ts/spawn.ts'",
"build:dts": "tsc --emitDeclarationOnly --outDir target/dts",
"build:docs": "typedoc --options src/main/typedoc",
"build:stamp": "npx buildstamp",
Expand Down
2 changes: 2 additions & 0 deletions src/main/ts/spawn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import EventEmitter from 'node:events'
import { Readable, Writable, Stream, Transform } from 'node:stream'
import { assign, noop } from './util.js'

export * from './util.js'

export type TSpawnError = any

export type TSpawnResult = {
Expand Down
4 changes: 2 additions & 2 deletions src/main/ts/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export const buildCmd = (quote: TQuote, pieces: TemplateStringsArray, args: any[
let cmd = pieces[0], i = 0
while (i < args.length) {
const s = Array.isArray(args[i])
? args[i].map((x: any) => quote(substitute(x))).join(' ')
: quote(substitute(args[i]))
? args[i].map((x: any) => quote(subs(x))).join(' ')
: quote(subs(args[i]))

cmd += s + pieces[++i]
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/ts/x.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import {
type Promisified,
type TVoidCallback,
type TQuote,
isPromiseLike,
isStringLiteral,
assign,
Expand Down Expand Up @@ -83,8 +84,6 @@ export interface TShellSync {
(opts: TShellOptions): TShellSync
}

export type TQuote = (input: string) => string

export const $: TShell = function(this: any, pieces?: any, ...args: any): any {
const preset = this || {}

Expand Down

0 comments on commit 71dbf65

Please sign in to comment.