Skip to content

Commit f1c0fc4

Browse files
committed
Attempt to fix published version not running
1 parent ff49b92 commit f1c0fc4

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

programs/cli/commands/dev.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,17 @@ export function registerDevCommand(program: Command, telemetry: any) {
140140
devOptions.watchSource = true
141141
}
142142

143-
// Ensure we load the exact matching develop package version to avoid
144-
// runtime mismatches between the CLI and the develop module when used
145-
// from different working directories (e.g., examples workspaces).
146-
const versionSpec = String(packageJson.version)
147-
const {extensionDev} = await requireOrDlx(
148-
'extension-develop',
149-
versionSpec
150-
)
143+
// Prefer exact prerelease when available; fall back to compatible major
144+
const versionExact = String(packageJson.version)
145+
const major = String(packageJson.version).split('.')[0] || '2'
146+
147+
let extensionDev: any
148+
try {
149+
;({extensionDev} = await requireOrDlx('extension-develop', versionExact))
150+
} catch {
151+
;({extensionDev} = await requireOrDlx('extension-develop', major))
152+
}
153+
151154
for (const vendor of list) {
152155
const vendorStart = Date.now()
153156
telemetry.track('cli_vendor_start', {command: 'dev', vendor})

programs/cli/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ extensionJs
2323
.option('--no-telemetry', 'disable anonymous telemetry for this run')
2424
.option('--ai-help', 'show AI-assistant oriented help and tips')
2525
.addHelpText('after', messages.programUserHelp())
26+
.showHelpAfterError(true)
27+
.showSuggestionAfterError(true)
2628

2729
registerCreateCommand(extensionJs, telemetry)
2830
registerDevCommand(extensionJs, telemetry)
@@ -36,4 +38,10 @@ extensionJs.on('option:ai-help', function () {
3638
process.exit(0)
3739
})
3840

41+
// Show help when invoked with no args (e.g., `npx extension`)
42+
if (process.argv.length <= 2) {
43+
extensionJs.outputHelp()
44+
process.exit(0)
45+
}
46+
3947
extensionJs.parse()

0 commit comments

Comments
 (0)