From e7ed2af55089d85cd88c434dfe5fc2dccdfcea3c Mon Sep 17 00:00:00 2001 From: Kien La Date: Sat, 21 Sep 2024 23:18:01 -0400 Subject: [PATCH] duplicate should run clone (if remote) and hooks --- src/app.ts | 6 +++--- src/types.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app.ts b/src/app.ts index cd1833d..ec24e02 100644 --- a/src/app.ts +++ b/src/app.ts @@ -82,10 +82,10 @@ export default class App { await docker.compose(staxfile.context, 'up --detach --force-recreate --build', composeFile, { exit: true }) const app = App.find(staxfile.context, staxfile.app) - if (!options.rebuild && !staxfile.config.location.local) + if (options.duplicate || (!options.rebuild && !staxfile.config.location.local)) app.primary.exec(`git clone ${staxfile.config.source} ${staxfile.compose.stax.workspace}`) - if (!options.rebuild) + if (options.duplicate || !options.rebuild) app.containers.forEach(async container => container.runHook('after_setup')) return app @@ -154,7 +154,7 @@ export default class App { if (this.constructor.exists(this.context, newName)) exit(1, `${icons.error} An app named '${newName}' already exists.`) - this.rebuild({ ...config, app: newName }, options) + this.rebuild({ ...config, app: newName }, { ...options, duplicate: true }) } async restart() { diff --git a/src/types.ts b/src/types.ts index 71aea4b..677dee2 100644 --- a/src/types.ts +++ b/src/types.ts @@ -59,4 +59,5 @@ export interface StaxConfig { export interface SetupOptions { inspect?: boolean rebuild?: boolean + duplicate?: boolean }