Skip to content

Commit

Permalink
duplicate should run clone (if remote) and hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
kla committed Sep 22, 2024
1 parent b1ed754 commit e7ed2af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@ export interface StaxConfig {
export interface SetupOptions {
inspect?: boolean
rebuild?: boolean
duplicate?: boolean
}

0 comments on commit e7ed2af

Please sign in to comment.