( environment: Environment, targetDir: string, options: Options, )
| 5 | import type { Environment, Options } from '../types.js' |
| 6 | |
| 7 | export async function setupIntent( |
| 8 | environment: Environment, |
| 9 | targetDir: string, |
| 10 | options: Options, |
| 11 | ) { |
| 12 | if (!options.intent) { |
| 13 | return |
| 14 | } |
| 15 | |
| 16 | const s = environment.spinner() |
| 17 | s.start('Setting up TanStack Intent skill mappings...') |
| 18 | environment.startStep({ |
| 19 | id: 'setup-intent', |
| 20 | type: 'command', |
| 21 | message: 'Setting up TanStack Intent skill mappings...', |
| 22 | }) |
| 23 | |
| 24 | try { |
| 25 | await packageManagerExecute( |
| 26 | environment, |
| 27 | resolve(targetDir), |
| 28 | options.packageManager, |
| 29 | '@tanstack/intent', |
| 30 | ['install', '--map'], |
| 31 | ) |
| 32 | environment.finishStep('setup-intent', 'TanStack Intent configured') |
| 33 | s.stop('TanStack Intent configured') |
| 34 | } catch (error) { |
| 35 | const message = |
| 36 | error instanceof Error ? error.message : 'Unknown error' |
| 37 | environment.finishStep( |
| 38 | 'setup-intent', |
| 39 | `TanStack Intent setup skipped: ${message}`, |
| 40 | ) |
| 41 | s.stop('TanStack Intent setup skipped') |
| 42 | environment.warn( |
| 43 | 'TanStack Intent setup failed', |
| 44 | `Continuing without it. You can run it later with: npx @tanstack/intent install\n\n${message}`, |
| 45 | ) |
| 46 | } |
| 47 | } |
nothing calls this directly
no test coverage detected