Skip to content

Commit

Permalink
chore: Create setup command
Browse files Browse the repository at this point in the history
  • Loading branch information
angelmadames committed Jun 17, 2024
1 parent 70995fb commit 6adcc9d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { gitCommand } from "./src/commands/git";
import { noIndent } from "./src/utils/string";
import { name, version, description } from "./package.json";
import { projectCommand } from "./src/commands/project";
import { setupCommand } from "./src/commands/setup";

const cli = new Command()
.name(name)
Expand All @@ -29,6 +30,7 @@ const cli = new Command()
.addCommand(cleanCommand())
.addCommand(environmentCommand())
.addCommand(composeCommand())
.addCommand(dependenciesCommand());
.addCommand(dependenciesCommand())
.addCommand(setupCommand());

cli.parse();
3 changes: 1 addition & 2 deletions src/commands/project/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { createProjectCommand } from './create'
import { setActiveProjectCommand } from './set'

export function projectCommand() {
const command = new Command()
return new Command()
.name('project')
.summary('Manage DEMS current project state')
.description('Manage the current project state of DEMS')
Expand All @@ -15,5 +15,4 @@ export function projectCommand() {
.addCommand(createProjectCommand())
.addCommand(projectConfigCommand())
.addCommand(removeProjectCommand())
return command
}
26 changes: 26 additions & 0 deletions src/commands/setup/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Command } from 'commander'
import { composeCommand } from '../compose'
import { depsCopyCommand } from '../dependencies/copy'
import { copyExampleFilesCommand } from '../environment/copy-example-files'
import { generateDotEnvCommand } from '../environment/generate-dot-env'
import { gitCloneCommand } from '../git/clone'
import { createProjectCommand } from '../project/create'

export function setupCommand() {
return new Command()
.name('setup')
.alias('init')
.summary('Setup DEMS for a new project and initialize it')
.action(async () => {
await createProjectCommand().parseAsync()
await gitCloneCommand().parseAsync()

copyExampleFilesCommand().parse()
generateDotEnvCommand().parse()

composeCommand().parse(['build'], { from: 'user' })
composeCommand().parse(['up -d'], { from: 'user' })

depsCopyCommand().parse()
})
}

0 comments on commit 6adcc9d

Please sign in to comment.