cob-cli 2.3.1 → 2.4.2

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.
@@ -8,8 +8,10 @@ const { getCurrentCommandEnviroment } = require("../task_lists/common_enviroment
8
8
  const Legacy0Filename = '.server'
9
9
  const Legacy1Filename = 'environments/prod/server'
10
10
  const VersionFilename = '.version'
11
- const versionStr2Number = (versionStr) => versionStr.split(".").slice(0,-1).reduce( (x,y) => Number(x)*100+Number(y))
12
11
  const REPO_VERSION = "201" // por convenção deverá ser actualizado com versionStr2Number( require('../../package.json').version ) sempre que necessário, tendo depois a função necessária para fazer o upgrade
12
+ const versionStr2Number = (versionStr) => versionStr.includes(".")
13
+ ? versionStr.split(".").slice(0, -1).reduce((x, y) => Number(x) * 100 + Number(y))
14
+ : versionStr
13
15
 
14
16
  async function upgradeRepo() {
15
17
  console.log("Checking conditions to upgrade cob-cli repo");
@@ -17,9 +19,9 @@ async function upgradeRepo() {
17
19
  await new Listr([
18
20
  { title: "Get repo Version", task: ctx => ctx.version = _getRepoVersion() },
19
21
  { title: "cob-cli repo files not found", enabled: ctx => ctx.version == 9999, task: () => {throw new Error("Error:".red + " not on a root of a cob-cli repo. Check your path. \n")} },
20
- { title: "Found old cob-cli", enabled: ctx => ctx.version > REPO_VERSION, task: () => {throw new Error("Error:".red + " update cob-cli version. Please update via npm \n")} },
21
- { title: "Nothing todo", enabled: ctx => ctx.version == REPO_VERSION,task: () => {throw new Error("Warn:".yellow + " nothing todo. Version up to date. \n")} },
22
- { title: "Check git status", enabled: ctx => ctx.version < REPO_VERSION, task: () => checkWorkingCopyCleanliness() },
22
+ { title: "Found old cob-cli", enabled: ctx => ctx.version > REPO_VERSION, task: () => {throw new Error("Error:".red + " update cob-cli version. Please update via npm \n")} },
23
+ { title: "Nothing todo", enabled: ctx => ctx.version == REPO_VERSION, task: () => {throw new Error("Warn:".yellow + " nothing todo. Version up to date. \n")} },
24
+ { title: "Check git status", enabled: ctx => ctx.version < REPO_VERSION, task: () => checkWorkingCopyCleanliness() },
23
25
  { title: "Upgrade 0 to 1".bold, enabled: ctx => ctx.version < 1, task: () => _upgrade0to1() },
24
26
  { title: "Upgrade 1 to 2".bold, enabled: ctx => ctx.version < 2, task: () => _upgrade1to2() },
25
27
  { title: "Upgrade 2.0 to 2.1".bold, enabled: ctx => ctx.version < 201, task: () => _upgrade2to2_1() }
@@ -29,7 +31,7 @@ async function upgradeRepo() {
29
31
 
30
32
  } catch(err) {
31
33
  console.error("\n",err.message);
32
- }
34
+ }
33
35
  }
34
36
  exports.upgradeRepo = upgradeRepo;
35
37
 
@@ -8,7 +8,6 @@
8
8
  - /elasticsearch
9
9
  - /db
10
10
  - /reports
11
- - /rancid
12
11
 
13
12
  - health.conf
14
13
 
@@ -30,7 +30,7 @@ async function otherFilesContiousReload(cmdEnv) {
30
30
  if(changedFiles.size > 0) {
31
31
  console.log("\nRestoring changed files...".yellow);
32
32
  let stash = true;
33
- await git().stash(["--include-untracked"]).then( value => value.indexOf("Saved") == 0 || (stash = false))
33
+ await git().env('LC_ALL', 'C').stash(["--include-untracked"]).then( value => value.indexOf("Saved") == 0 || (stash = false))
34
34
  let lastSha = await getLastDeployedSha(cmdEnv.server)
35
35
  git().checkout(lastSha)
36
36
 
@@ -153,4 +153,4 @@ function checkNoTestsRunningOnServer(server) {
153
153
  }
154
154
  } /* Error is good: test file doesn't exist */ )
155
155
  }
156
- exports.checkNoTestsRunningOnServer = checkNoTestsRunningOnServer
156
+ exports.checkNoTestsRunningOnServer = checkNoTestsRunningOnServer
@@ -18,7 +18,7 @@ async function validateTestingConditions(cmdEnv, args) {
18
18
  { title: "Check there's no other 'cob-cli test' running locally".bold, task: () => _checkNoTestsRunningLocally() },
19
19
  { title: "find out branch-for-HEAD", task: (ctx) => getCurrentBranch().then( currentBranch => ctx.currentBranch = currentBranch) },
20
20
  { title: "find out SHA for last-deploy on specified server", task: (ctx) => _getLastDeployedSha(cmdEnv).then( lastSha => ctx.lastSha = lastSha).catch( err => ctx.err = err ) },
21
- { title: "git stash --include-untracked", skip: ctx => !ctx.lastSha, task: (ctx) => git().stash(["--include-untracked"]).then( value => value.indexOf("Saved") == 0 && (ctx.stash = true)) },
21
+ { title: "git stash --include-untracked", skip: ctx => !ctx.lastSha, task: (ctx) => git().env('LC_ALL', 'C').stash(["--include-untracked"]).then( value => value.indexOf("Saved") == 0 && (ctx.stash = true)) },
22
22
  { title: "git checkout SHA for last-deploy", skip: ctx => !ctx.lastSha, task: (ctx) => git().checkout(ctx.lastSha) },
23
23
  { title: "Apply last enviroment specifics".bold, skip: ctx => !ctx.lastSha, task: () => cmdEnv.applyLastEnvironmentDeployedToServerChanges() },
24
24
  { title: "Check last-deploy == serverLive".bold, skip: ctx => !ctx.lastSha, task: (ctx) => testEquality(cmdEnv, "serverLive", "localCopy").then( changes => _handleTestEquality(ctx, changes, cmdEnv.server).catch( err => ctx.err = err.message ) ) },
@@ -56,9 +56,12 @@ module.exports = env => {
56
56
  console.log("[CoB] Serving LOCAL -> " + localPath );
57
57
  }
58
58
  return localPath;
59
+ },
60
+ onProxyRes: response => {
61
+ response.headers['content-security-policy'] = "default-src 'unsafe-inline' 'unsafe-eval' https: data: http:";
59
62
  }
60
63
  }
61
64
  }
62
65
  }
63
66
  }
64
- };
67
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cob-cli",
3
- "version": "2.3.1",
3
+ "version": "2.4.2",
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": {