Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions core/scripts/installer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const path = require('path')
const shell = require('shelljs')
const mkdirp = require('mkdirp')
const exists = require('fs-exists-sync')
Expand Down Expand Up @@ -133,10 +134,13 @@ class Backend extends Abstract {
*/
cloneRepository () {
return new Promise((resolve, reject) => {
Message.info(`Cloning backend into '${this.answers.backend_dir}'...`)
const backendDir = path.normalize(this.answers.backend_dir)
const gitPath = path.normalize(this.answers.git_path)

if (shell.exec(`${this.answers.git_path} clone ${STOREFRONT_BACKEND_GIT_URL} ${this.answers.backend_dir} > ${Abstract.infoLogStream} 2>&1`).code !== 0) {
reject(new Error(`Can't clone backend into '${this.answers.backend_dir}'.`))
Message.info(`Cloning backend into '${backendDir}'...`)

if (shell.exec(`${gitPath} clone ${STOREFRONT_BACKEND_GIT_URL} '${backendDir}' > ${Abstract.infoLogStream} 2>&1`).code !== 0) {
reject(new Error(`Can't clone backend into '${backendDir}'.`))
}

resolve()
Expand All @@ -150,11 +154,11 @@ class Backend extends Abstract {
*/
goToDirectory (backendDir = null) {
return new Promise((resolve, reject) => {
let dir = this.answers ? this.answers.backend_dir : backendDir
const dir = this.answers ? this.answers.backend_dir : backendDir

Message.info(`Trying change directory to '${dir}'...`)

if (shell.cd(dir).code !== 0) {
if (shell.cd(path.normalize(dir)).code !== 0) {
reject(new Error(`Can't change directory to '${dir}'.`))
}

Expand Down