Skip to content

Commit

Permalink
fix(new): remove cd
Browse files Browse the repository at this point in the history
  • Loading branch information
jlenon7 committed Oct 15, 2023
1 parent bafa19d commit 74fd0d2
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/commands/new.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,26 +92,30 @@ export class NewCommand extends BaseCommand {
throw new NotEmptyFolderException(concretePath)
}

const cloneCommand = `git clone --branch ${this.branch} ${this.url} ${projectPath}`
const moveProjectCommand = `mv ${projectPath} ${concretePath}`
const runNpmInstallCommand = `cd ${concretePath} && npm install --silent --production=false`

const task = this.logger.task()

task.addPromise(
`Clone scaffold project from ${this.paint.purple.bold(
this.url,
)} in branch ${this.paint.purple.bold(this.branch)}`,
async () => Exec.command(cloneCommand),
async () => {
await Exec.command(
`git clone --branch ${this.branch} ${this.url} ${projectPath}`,
)
},
)

task.addPromise('Move project to your path', async () =>
Exec.command(moveProjectCommand),
)
task.addPromise('Move project to your path', async () => {
await Exec.command(`mv ${projectPath} ${concretePath}`)
})

task.addPromise(
`Install dependencies using ${this.paint.yellow.bold('npm')}`,
async () => Exec.command(runNpmInstallCommand),
async () => {
await Exec.command('npm install --silent --production=false', {
cwd: concretePath,
})
},
)

task.add('Remove unnecessary files', async task => {
Expand Down

0 comments on commit 74fd0d2

Please sign in to comment.