Skip to content

Commit

Permalink
fix: dev script crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Works committed Feb 27, 2024
1 parent a604aea commit 67aac29
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
8 changes: 7 additions & 1 deletion packages/scripts/src/bin/build.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
#!/usr/bin/env node
import { spawnSync } from 'child_process'
import { fileURLToPath } from 'url'
const child = spawnSync(
process.execPath,
['--loader', 'ts-node/esm/transpile-only', import.meta.resolve('./build.ts'), ...process.argv.slice(2)],
[
'--loader',
'ts-node/esm/transpile-only',
fileURLToPath(import.meta.resolve('./build.ts')),
...process.argv.slice(2),
],
{ stdio: 'inherit' },
)
if (child.status) process.exit(child.status)
9 changes: 8 additions & 1 deletion packages/scripts/src/bin/dev.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#!/usr/bin/env node
import { spawnSync } from 'child_process'
import { fileURLToPath } from 'url'

const child = spawnSync(
process.execPath,
['--loader', 'ts-node/esm/transpile-only', import.meta.resolve('./dev.ts'), ...process.argv.slice(2)],
[
'--loader',
'ts-node/esm/transpile-only',
fileURLToPath(import.meta.resolve('./dev.ts')),
...process.argv.slice(2),
],
{ stdio: 'inherit' },
)
if (child.status) process.exit(child.status)
2 changes: 1 addition & 1 deletion packages/scripts/src/utils/process-lock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function getProcessLock(lockName: string) {
}
export function isLocked(lockName: string) {
const lockfilePath = getLockPosition(lockName)
const result = Lock.checkSync(__filename, { lockfilePath, stale: 500 })
const result = Lock.checkSync(import.meta.filename, { lockfilePath, stale: 500 })
return result
}

Expand Down

0 comments on commit 67aac29

Please sign in to comment.