diff --git a/src/Main/IPC/GameProject/createProject.ts b/src/Main/IPC/GameProject/createProject.ts index fc4175b..18b5d48 100644 --- a/src/Main/IPC/GameProject/createProject.ts +++ b/src/Main/IPC/GameProject/createProject.ts @@ -46,7 +46,7 @@ export async function handler(directoryPath: string, config: Engine.GameProject. const projectDirName = parseProperty(PROJECT_DIRECTORY_NAME, config) const projectDirPath = path.resolve(directoryPath, projectDirName) - const projectEnsure = await ensureProject(projectDirPath, config) + const projectEnsure = await ensureProject(projectDirPath, config, false) if (!projectEnsure.success) { return projectEnsure as Engine.GameProject.CreateProjectFail } diff --git a/src/Main/IPC/GameProject/ensureProject.ts b/src/Main/IPC/GameProject/ensureProject.ts index fca442b..893884f 100644 --- a/src/Main/IPC/GameProject/ensureProject.ts +++ b/src/Main/IPC/GameProject/ensureProject.ts @@ -59,10 +59,11 @@ interface FileWriteQueue { content: string|((path?: string) => Promise) } -async function ensureRequireModules(projectDirPath: string): Promise { +async function ensureRequireModules(projectDirPath: string, forceUpdate: boolean = false): Promise { try { + const command = forceUpdate ? 'npm update' : 'npm i' const spawner = new ProcessSpawner({ shell: true, cwd: projectDirPath }) - await spawner.spawn('npm i', { writeStream: writeToRenderer('ensure-require-modules') }) + await spawner.spawn(command, { writeStream: writeToRenderer('ensure-require-modules') }) } catch(reason) { return { success: false, @@ -194,7 +195,7 @@ async function ensureBaseFile(projectDirPath: string, config: Engine.GameProject } } -export async function handler(directoryPath: string, config: Engine.GameProject.Config): Promise { +export async function handler(directoryPath: string, config: Engine.GameProject.Config, forceUpdate: boolean): Promise { // 디렉토리 생성하기 const dirs = [ path.resolve(directoryPath, PROJECT_EXTEND_DIRECTORY_NAME), @@ -230,7 +231,7 @@ export async function handler(directoryPath: string, config: Engine.GameProject. } // 종속 모듈 설치 - const moduleInstall = await ensureRequireModules(directoryPath) + const moduleInstall = await ensureRequireModules(directoryPath, forceUpdate) if (!moduleInstall.success) { return moduleInstall as Engine.GameProject.CreateProjectFail } @@ -245,7 +246,7 @@ export async function handler(directoryPath: string, config: Engine.GameProject. } export function ipc(): void { - ipcMain.handle('ensure-project', async (e: IpcMainInvokeEvent, directoryPath: string, config: Engine.GameProject.Config): Promise => { - return await handler(directoryPath, config) + ipcMain.handle('ensure-project', async (e: IpcMainInvokeEvent, directoryPath: string, config: Engine.GameProject.Config, forceUpdate: boolean): Promise => { + return await handler(directoryPath, config, forceUpdate) }) } \ No newline at end of file diff --git a/src/Renderer/components/Manager/Restructure/Main.vue b/src/Renderer/components/Manager/Restructure/Main.vue index aa29b0b..f0ba296 100644 --- a/src/Renderer/components/Manager/Restructure/Main.vue +++ b/src/Renderer/components/Manager/Restructure/Main.vue @@ -1,21 +1,23 @@