Skip to content

Commit

Permalink
Fix(Techor): techor pack -w doesn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Mar 28, 2023
1 parent 5425f91 commit 61a6990
Show file tree
Hide file tree
Showing 4 changed files with 215 additions and 16 deletions.
197 changes: 196 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/techor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
},
"devDependencies": {
"dedent": "^0.7.0",
"execa": "^7.1.1",
"pkg-types": "^1.0.1",
"pretty-bytes": "^6.1.0"
}
Expand Down
28 changes: 14 additions & 14 deletions packages/techor/src/commands/pack.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { program } from 'commander'
import fg from 'fast-glob'
import { execSync } from 'child_process'
import { execaCommand } from 'execa'
import { type BuildOptions, context, Metafile } from 'esbuild'
import log, { chalk } from '@techor/log'
import path from 'upath'
Expand Down Expand Up @@ -294,19 +294,19 @@ program.command('pack [entryPaths...]')
platform: 'type',
format: 'dts'
},
run: () => new Promise<void>((resolve, reject) => {
const runTsc = () => {
try {
execSync(line`npx tsc --emitDeclarationOnly --preserveWatchOutput --declaration --outDir ${options.outdir} ${options.watch && '--watch'}`, {
stdio: 'inherit'
})
} catch (error) {
if (error) {
reject(error.toString())
}
}
resolve()
}
run: () => new Promise<void>((resolve) => {
const runTsc = () => execaCommand(line`
npx tsc --emitDeclarationOnly --preserveWatchOutput --declaration
--outDir ${options.outdir}
${options.watch && '--watch'}
`, {
stdio: 'inherit',
stripFinalNewline: false
})
.catch((reason) => {
process.exit()
})
.finally(resolve)
if (options.watch) {
setTimeout(runTsc, 100)
} else {
Expand Down
5 changes: 4 additions & 1 deletion packages/techor/tests/standard/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
export * from './options'
export * from './options'

const a = 1236324243223423
console.log(a)

0 comments on commit 61a6990

Please sign in to comment.