cob-cli 2.53.0-beta-2 → 2.53.0-beta-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,13 @@
1
1
  const path = require('path');
2
+ const fs = require('fs');
2
3
 
3
4
  /* Autocomplete Component*/
4
5
  var omelette = require('omelette');
5
6
  const commandStructure = {
6
- 'init' : [],
7
- 'customize' : [],
8
- 'test' : [],
9
- 'deploy' : [],
7
+ 'init' : [],
8
+ 'customize' : [],
9
+ 'test' : [],
10
+ 'deploy' : [],
10
11
  'updateFromServer' : [],
11
12
  'upgradeRepo' : []
12
13
  }
@@ -19,9 +20,23 @@ if (~process.argv.indexOf('--setup')) {
19
20
  // we exit cleanly so that postinstall completes successfuly
20
21
  process.exit(0)
21
22
  }
23
+ if (isAutocompleteAlreadyInstalled()) {
24
+ console.log("Autocomplete already set up, skipping.")
25
+ process.exit(0)
26
+ }
22
27
  console.log("Setting up...")
23
28
  completion.setupShellInitFile()
24
29
  }
30
+
31
+ function isAutocompleteAlreadyInstalled() {
32
+ try {
33
+ const initFile = completion.getDefaultShellInitFile()
34
+ if (!initFile || !fs.existsSync(initFile)) return false
35
+ return fs.readFileSync(initFile, 'utf8').includes('# begin cob-cli completion')
36
+ } catch (e) {
37
+ return false
38
+ }
39
+ }
25
40
  // remove from system profiles
26
41
  if (~process.argv.indexOf('--cleanup')) {
27
42
  if (process.platform === 'win32') {
@@ -37,7 +37,8 @@ async function deploy(args) {
37
37
  if(!args.force) {
38
38
  await cmdEnv.unApplyCurrentCommandEnvironmentChanges()
39
39
  clearOperationState()
40
- throw new Error("Canceled:".yellow + " nothing todo\n")
40
+ console.log("\nCanceled!".yellow + " nothing todo\n")
41
+ return
41
42
  }
42
43
  console.log(" Just updating deploy information.")
43
44
  }
@@ -36,6 +36,7 @@ async function test (args) {
36
36
  restoreChanges = await otherFilesContiousReload(cmdEnv)
37
37
  } else {
38
38
  await cmdEnv.applyCurrentCommandEnvironmentChanges()
39
+ envChangesApplied = true
39
40
  }
40
41
  spawned = await customUIsContinuosReload(cmdEnv, args.dashboard)
41
42
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cob-cli",
3
- "version": "2.53.0-beta-2",
3
+ "version": "2.53.0-beta-3",
4
4
  "description": "A command line utility to help Cult of Bits partners develop with higher speed and reusing common code and best practices.",
5
5
  "preferGlobal": true,
6
6
  "repository": {