@@ -244,6 +244,35 @@ function updatePackageJson() {
244244 console . log ( "✅ Updated package.json" )
245245}
246246
247+ function checkNuxtInstallation ( ) {
248+ try {
249+ // Check if nuxt.config.ts exists
250+ const nuxtConfigPath = path . join ( process . cwd ( ) , "nuxt.config.ts" )
251+ if ( fs . existsSync ( nuxtConfigPath ) ) {
252+ console . log ( "✅ Nuxt is already installed" )
253+ return
254+ }
255+
256+ // Check if node_modules/nuxt exists
257+ const nuxtPath = path . join ( process . cwd ( ) , "node_modules" , "nuxt" )
258+ if ( fs . existsSync ( nuxtPath ) ) {
259+ console . log ( "✅ Nuxt is already installed" )
260+ return
261+ }
262+
263+ console . log ( "⚠️ Nuxt is not installed. Installing now..." )
264+ console . log ( "🚀 Running: npm create nuxt@latest new-nuxt-electron\n" )
265+ execSync ( "npm create nuxt@latest new-nuxt-electron" , {
266+ stdio : "inherit" ,
267+ shell : true ,
268+ } )
269+ console . log ( "\n✅ Nuxt installation complete!" )
270+ } catch ( error ) {
271+ console . error ( "❌ Failed to install Nuxt:" , error . message )
272+ process . exit ( 1 )
273+ }
274+ }
275+
247276function updateNuxtConfig ( ) {
248277 const nuxtConfigPath = path . join ( process . cwd ( ) , "nuxt.config.ts" )
249278
@@ -279,6 +308,9 @@ function updateNuxtConfig() {
279308
280309console . log ( "🚀 Initializing @atmoner/nuxt-electron...\n" )
281310
311+ // Check if Nuxt is installed
312+ checkNuxtInstallation ( )
313+
282314// Create files
283315Object . entries ( templates ) . forEach ( ( [ filename , content ] ) => {
284316 const filePath = path . join ( process . cwd ( ) , filename )
0 commit comments