@@ -4,8 +4,8 @@ import { Integrations, Supported, integrations, setRootFile } from "../lib/integ
44import * as p from "@clack/prompts" ;
55import color from "picocolors" ;
66import { primitives , loadPrimitives } from "@solid-cli/utils/primitives" ;
7- import { t } from "@solid-cli/utils" ;
8- import { fileExists , getRootFile , getAppConfig , validateFilePath } from "../lib/utils/helpers" ;
7+ import { isSolidStart , t } from "@solid-cli/utils" ;
8+ import { fileExists , getRootFile , getConfigFile , validateFilePath } from "../lib/utils/helpers" ;
99import { writeFile , readFile } from "@solid-cli/utils/fs" ;
1010import { transformPlugins , type PluginOptions } from "@solid-cli/utils/transform" ;
1111import {
@@ -43,8 +43,9 @@ const handleAutocompleteAdd = async () => {
4343 { label : t . NO , value : false } ,
4444 { label : t . YES_FORCE , value : [ true , "force" ] } ,
4545 ] ,
46- message : `${ t . CONFIRM_INSTALL ( a . length ) } \n${ color . red ( S_BAR ) } \n${ color . red ( S_BAR ) } ${ " " + color . yellow ( a . map ( ( opt ) => opt . label ) . join ( " " ) ) + " "
47- } \n${ color . red ( S_BAR ) } `,
46+ message : `${ t . CONFIRM_INSTALL ( a . length ) } \n${ color . red ( S_BAR ) } \n${ color . red ( S_BAR ) } ${
47+ " " + color . yellow ( a . map ( ( opt ) => opt . label ) . join ( " " ) ) + " "
48+ } \n${ color . red ( S_BAR ) } `,
4849 } ) ,
4950 ) ;
5051
@@ -109,6 +110,10 @@ export const handleAdd = async (packages?: string[], forceTransform: boolean = f
109110 } )
110111 . filter ( ( p ) => p ) as Configs ;
111112
113+ const configType = ( await isSolidStart ( ) ) ? "app" : "vite" ;
114+
115+ const configFile = await getConfigFile ( configType ) ;
116+
112117 for ( let i = 0 ; i < configs . length ; i ++ ) {
113118 const config = configs [ i ] ;
114119 config . installs . forEach ( ( p ) => queueUpdate ( { type : "package" , name : p , dev : false } ) ) ;
@@ -122,20 +127,19 @@ export const handleAdd = async (packages?: string[], forceTransform: boolean = f
122127 if ( ! configs . length ) return ;
123128 const pluginOptions = configs . map ( ( c ) => c . pluginOptions ) . filter ( Boolean ) as PluginOptions [ ] ;
124129 if ( pluginOptions . length ) {
125- const appConfig = await getAppConfig ( ) ;
126130 await spinnerify ( {
127- startText : "Processing config" ,
128- finishText : "Config processed" ,
129- fn : async ( ) => {
130- const code = await transformPlugins (
131- configs . map ( ( c ) => c . pluginOptions ) . filter ( Boolean ) as PluginOptions [ ] ,
132- { name : appConfig , contents : ( await readFile ( appConfig ) ) . toString ( ) } ,
133- forceTransform ,
134- undefined ,
135- ) ;
136- await writeFile ( appConfig , code ) ;
137- } ,
138- } ) ;
131+ startText : "Processing config" ,
132+ finishText : "Config processed" ,
133+ fn : async ( ) => {
134+ const code = await transformPlugins (
135+ configs . map ( ( c ) => c . pluginOptions ) . filter ( Boolean ) as PluginOptions [ ] ,
136+ { type : configType , name : configFile , contents : ( await readFile ( configFile ) ) . toString ( ) } ,
137+ forceTransform ,
138+ undefined ,
139+ ) ;
140+ await writeFile ( configFile , code ) ;
141+ } ,
142+ } ) ;
139143 }
140144
141145 p . log . info ( "Preparing post install steps for integrations" ) ;
0 commit comments