Skip to content

Commit

Permalink
Fixed CodeVersion so it is part of the Setup rather than pulling fr…
Browse files Browse the repository at this point in the history
…om current branch name
  • Loading branch information
Peter Schmalfeldt committed Jan 8, 2019
1 parent 18f0529 commit 23f88fd
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 11 deletions.
4 changes: 4 additions & 0 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const argv = yargs
alias: 'h',
describe: 'Hostname for Instance'
},
version: {
alias: 'v',
describe: 'Code Version'
},
directory: {
alias: 'd',
describe: 'Absolute path to Repository'
Expand Down
1 change: 1 addition & 0 deletions commands/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = async () => {
console.log(chalk.cyan('instance: ') + chalk.cyan.bold(instance))
console.log(' path: ' + chalk.bold(currentConfig[client][instance].d))
console.log(' host: ' + chalk.bold(currentConfig[client][instance].h))
console.log(' code: ' + chalk.bold(currentConfig[client][instance].v))
console.log(' user: ' + chalk.bold(currentConfig[client][instance].u))
console.log(' pass: ' + chalk.bold(currentConfig[client][instance].p.replace(/./g, '*')))
}
Expand Down
24 changes: 23 additions & 1 deletion commands/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,22 @@ const slug = require('slug')
const config = require('../lib/config')()

module.exports = async () => {
if (argv && typeof argv.a === 'undefined') {
const setDefaults =
argv &&
typeof argv.c !== 'undefined' &&
argv.h !== 'undefined' &&
argv.d !== 'undefined' &&
argv.u !== 'undefined' &&
argv.p !== 'undefined'

if (setDefaults && typeof argv.a === 'undefined') {
argv.a = 'sandbox'
}

if (setDefaults && typeof argv.v === 'undefined') {
argv.v = 'develop'
}

prompt.message = ''
prompt.error = ''
prompt.delimiter = ''
Expand Down Expand Up @@ -50,6 +62,14 @@ module.exports = async () => {
return isValid
}
},
{
description: chalk.cyan('Code Version:'),
name: 'v',
pattern: /^[a-z0-9]+$/,
message: 'Code Version. ( e.g. develop, sitegenesis, etc )',
required: true,
default: 'develop'
},
{
description: chalk.cyan('Instance Alias:'),
name: 'a',
Expand Down Expand Up @@ -112,6 +132,8 @@ module.exports = async () => {
// Create / Overwrite SFCC Instance for Client
newConfig[client][alias] = {
h: result.h,
v: result.v,
a: result.a,
d: result.d,
u: result.u,
p: result.p
Expand Down
5 changes: 4 additions & 1 deletion docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Directory | `-d` | Yes | | Absolute path to the projects SF
Username | `-u` | Yes | | Instances SFCC Business Manager Username
Password | `-p` | Yes | | Instances SFCC Business Manager Password
Instance Alias | `-a` | No | `sandbox` | Custom Name to give this Instance
Code Version | `-v` | No | `develop` | SFCC Code Version to use

**SAVED TO: ~/.sfcc-cli**

Expand All @@ -47,7 +48,9 @@ Instance Alias | `-a` | No | `sandbox` | Custom Name to give this Instanc
"h": "dev04-web-mysandbox.demandware.net",
"d": "/Users/RVW/Projects/mysandbox",
"u": "my@email.com",
"p": "my^pass"
"p": "my^pass",
"a": "sandbox",
"v": "develop"
}
}
}
Expand Down
7 changes: 0 additions & 7 deletions lib/branch.js

This file was deleted.

3 changes: 1 addition & 2 deletions lib/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const notifier = require('node-notifier')
const path = require('path')
const pRetry = require('p-retry')

const codeVersion = require('./branch')()
const write = require('./write')
const mkdirp = require('./mkdirp')

Expand All @@ -14,7 +13,7 @@ module.exports = async ({file, spinner, watching, client, instance}) => {

if (!uploading.has(src)) {
const dir = path.dirname(file).replace(path.normalize(watching.d), '')
const dest = path.join('/', 'Cartridges', codeVersion, dir)
const dest = path.join('/', 'Cartridges', watching.v, dir)

uploading.add(src)

Expand Down

0 comments on commit 23f88fd

Please sign in to comment.