Skip to content

Commit 23f88fd

Browse files
Fixed CodeVersion so it is part of the Setup rather than pulling from current branch name
1 parent 18f0529 commit 23f88fd

File tree

6 files changed

+33
-11
lines changed

6 files changed

+33
-11
lines changed

bin/cli.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ const argv = yargs
1616
alias: 'h',
1717
describe: 'Hostname for Instance'
1818
},
19+
version: {
20+
alias: 'v',
21+
describe: 'Code Version'
22+
},
1923
directory: {
2024
alias: 'd',
2125
describe: 'Absolute path to Repository'

commands/list.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module.exports = async () => {
1414
console.log(chalk.cyan('instance: ') + chalk.cyan.bold(instance))
1515
console.log(' path: ' + chalk.bold(currentConfig[client][instance].d))
1616
console.log(' host: ' + chalk.bold(currentConfig[client][instance].h))
17+
console.log(' code: ' + chalk.bold(currentConfig[client][instance].v))
1718
console.log(' user: ' + chalk.bold(currentConfig[client][instance].u))
1819
console.log(' pass: ' + chalk.bold(currentConfig[client][instance].p.replace(/./g, '*')))
1920
}

commands/setup.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,22 @@ const slug = require('slug')
77
const config = require('../lib/config')()
88

99
module.exports = async () => {
10-
if (argv && typeof argv.a === 'undefined') {
10+
const setDefaults =
11+
argv &&
12+
typeof argv.c !== 'undefined' &&
13+
argv.h !== 'undefined' &&
14+
argv.d !== 'undefined' &&
15+
argv.u !== 'undefined' &&
16+
argv.p !== 'undefined'
17+
18+
if (setDefaults && typeof argv.a === 'undefined') {
1119
argv.a = 'sandbox'
1220
}
1321

22+
if (setDefaults && typeof argv.v === 'undefined') {
23+
argv.v = 'develop'
24+
}
25+
1426
prompt.message = ''
1527
prompt.error = ''
1628
prompt.delimiter = ''
@@ -50,6 +62,14 @@ module.exports = async () => {
5062
return isValid
5163
}
5264
},
65+
{
66+
description: chalk.cyan('Code Version:'),
67+
name: 'v',
68+
pattern: /^[a-z0-9]+$/,
69+
message: 'Code Version. ( e.g. develop, sitegenesis, etc )',
70+
required: true,
71+
default: 'develop'
72+
},
5373
{
5474
description: chalk.cyan('Instance Alias:'),
5575
name: 'a',
@@ -112,6 +132,8 @@ module.exports = async () => {
112132
// Create / Overwrite SFCC Instance for Client
113133
newConfig[client][alias] = {
114134
h: result.h,
135+
v: result.v,
136+
a: result.a,
115137
d: result.d,
116138
u: result.u,
117139
p: result.p

docs/setup.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Directory | `-d` | Yes | | Absolute path to the projects SF
3737
Username | `-u` | Yes | | Instances SFCC Business Manager Username
3838
Password | `-p` | Yes | | Instances SFCC Business Manager Password
3939
Instance Alias | `-a` | No | `sandbox` | Custom Name to give this Instance
40+
Code Version | `-v` | No | `develop` | SFCC Code Version to use
4041

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

@@ -47,7 +48,9 @@ Instance Alias | `-a` | No | `sandbox` | Custom Name to give this Instanc
4748
"h": "dev04-web-mysandbox.demandware.net",
4849
"d": "/Users/RVW/Projects/mysandbox",
4950
50-
"p": "my^pass"
51+
"p": "my^pass",
52+
"a": "sandbox",
53+
"v": "develop"
5154
}
5255
}
5356
}

lib/branch.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

lib/upload.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const notifier = require('node-notifier')
33
const path = require('path')
44
const pRetry = require('p-retry')
55

6-
const codeVersion = require('./branch')()
76
const write = require('./write')
87
const mkdirp = require('./mkdirp')
98

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

1514
if (!uploading.has(src)) {
1615
const dir = path.dirname(file).replace(path.normalize(watching.d), '')
17-
const dest = path.join('/', 'Cartridges', codeVersion, dir)
16+
const dest = path.join('/', 'Cartridges', watching.v, dir)
1817

1918
uploading.add(src)
2019

0 commit comments

Comments
 (0)