1
1
import * as vscode from 'vscode' ;
2
2
import { promisify } from 'util' ;
3
- import { spawn , spawnSync } from 'child_process' ;
3
+ import { spawnSync } from 'child_process' ;
4
4
import * as path from 'path' ;
5
5
import * as fs from 'fs' ;
6
6
@@ -49,11 +49,10 @@ function isNpmInstalled(): boolean {
49
49
}
50
50
}
51
51
52
- async function installVueCLI ( ) : Promise < boolean > {
52
+ async function installVueCLI ( ) : Promise < boolean > {
53
53
try {
54
- vscode . window . showInformationMessage ( 'Vue sendo instalado caralho' ) ;
55
- await exec ( 'npm init -y' ) ;
56
- await exec ( 'npm install vue@latest' ) ;
54
+ vscode . window . showInformationMessage ( 'Vue CLI is being installed.' ) ;
55
+ await exec ( 'npm install -g @vue/cli' ) ;
57
56
vscode . window . showInformationMessage ( 'Vue CLI has been installed successfully.' ) ;
58
57
return true ;
59
58
} catch ( error : any ) {
@@ -66,8 +65,8 @@ async function createVueProject(projectFolderName: string): Promise<boolean> {
66
65
const projectFolderPath = path . join ( vscode . workspace . rootPath || '' , projectFolderName ) ;
67
66
68
67
try {
69
- fs . mkdirSync ( projectFolderPath ) ;
70
- await exec ( `vue create ${ projectFolderName } ` , { cwd : vscode . workspace . rootPath } ) ;
68
+ vscode . window . showInformationMessage ( 'Creating Vue.js project...' ) ;
69
+ await exec ( `vue create --preset default ${ projectFolderName } ` , { cwd : vscode . workspace . rootPath } ) ;
71
70
return true ;
72
71
} catch ( error : any ) {
73
72
vscode . window . showErrorMessage ( 'Error creating the Vue.js project: ' + error . message ) ;
0 commit comments