Skip to content

Commit a7b849e

Browse files
committed
fix(cli): typecheck + lint after rebase on cli-subprocess
- spawnChild is now sync (matches cli-subprocess); update WatchOpts type and watch loop accordingly. - Bail with handleCancel when no env can be resolved (was passing string | undefined into typed APIs). - Add explicit return type on the keyring factory closure. - Auto-fixed quote style in secret-refs.
1 parent af6266e commit a7b849e

4 files changed

Lines changed: 9 additions & 6 deletions

File tree

packages/cli/src/commands/run.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export default defineCommand({
9898
let projectData: Project | null = null
9999
let environment: Environment | null = null
100100
const envName = runArgs.env || defaultEnv
101+
if (!envName) handleCancel('No environment specified. Pass --env or set `defaultEnv` in shelve.json.')
101102
const cacheInput = (env: string): CacheKeyInput => ({
102103
url,
103104
teamSlug: slug,
@@ -297,7 +298,7 @@ type WatchOpts = {
297298
template: ParsedTemplate | null
298299
restartOnChange: boolean
299300
getChild: () => ChildProcess
300-
spawnNew: (env: NodeJS.ProcessEnv) => Promise<ChildProcess>
301+
spawnNew: (env: NodeJS.ProcessEnv) => ChildProcess
301302
}
302303

303304
function fingerprint(variables: EnvVarExport[]): string {
@@ -330,11 +331,13 @@ function startWatch(opts: WatchOpts): void {
330331
if (opts.restartOnChange) {
331332
const child = opts.getChild()
332333
if (child.pid && process.platform !== 'win32') {
333-
try { process.kill(-child.pid, 'SIGTERM') } catch { /* ignore */ }
334+
try {
335+
process.kill(-child.pid, 'SIGTERM')
336+
} catch { /* ignore */ }
334337
} else {
335338
child.kill('SIGTERM')
336339
}
337-
await opts.spawnNew(env)
340+
opts.spawnNew(env)
338341
} else {
339342
const child = opts.getChild()
340343
try {

packages/cli/src/services/credentials.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async function loadKeyring(): Promise<((service: string, account: string) => Key
3030

3131
try {
3232
const mod = await import('@napi-rs/keyring')
33-
keyringFactory = (service, account) => new mod.Entry(service, account) as unknown as KeyringEntry
33+
keyringFactory = (service: string, account: string): KeyringEntry => new mod.Entry(service, account) as unknown as KeyringEntry
3434
} catch (err) {
3535
if (DEBUG) consola.warn(`Keyring unavailable, falling back to file storage: ${err}`)
3636
keyringFactory = null

packages/cli/src/utils/ignore-files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function upsertBlock(existing: string): string {
4444
return existing + sep + (existing.length === 0 ? '' : '\n') + block
4545
}
4646
const footerIdx = existing.indexOf(FOOTER_TAG, headerIdx)
47-
if (footerIdx === -1) return existing + '\n' + block
47+
if (footerIdx === -1) return `${existing }\n${ block}`
4848
const before = existing.slice(0, headerIdx)
4949
const after = existing.slice(footerIdx + FOOTER_TAG.length).replace(/^\n/, '')
5050
return before + block + after

packages/cli/src/utils/secret-refs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function parseEnvTemplate(content: string): ParsedTemplate {
3838
let value = line.slice(eqIdx + 1).trim()
3939
if (
4040
(value.startsWith('"') && value.endsWith('"'))
41-
|| (value.startsWith("'") && value.endsWith("'"))
41+
|| (value.startsWith('\'') && value.endsWith('\''))
4242
) {
4343
value = value.slice(1, -1)
4444
}

0 commit comments

Comments
 (0)