cob-cli 2.4.1 → 2.5.0

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.
@@ -26,6 +26,7 @@ async function deploy(args) {
26
26
 
27
27
  if(changes.length == 0) {
28
28
  if(!args.force) {
29
+ await cmdEnv.unApplyCurrentCommandEnvironmentChanges()
29
30
  throw new Error("Canceled:".yellow + " nothing todo\n")
30
31
  }
31
32
  console.log(" Just updating deploy information.")
@@ -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
 
@@ -68,14 +68,16 @@ async function _applySpecific(environmentName) {
68
68
 
69
69
  for( let envSpecificFile of envSpecificFiles ) {
70
70
  let prodFile = envSpecificFile.replace(/\.ENV__.*__/,"")
71
- if(fs.existsSync(prodFile)) {
72
- let backupFile = envSpecificFile.replace(/\.ENV__.*__/,".ENV__ORIGINAL_BACKUP__")
73
- await git().raw(["update-index","--assume-unchanged", prodFile])
74
- fs.renameSync(prodFile, backupFile)
75
- } else {
76
- let deleteFile = envSpecificFile.replace(/\.ENV__.*__/,".ENV__DELETE__")
77
- fs.appendFileSync('.git/info/exclude', "\n" + prodFile)
78
- fs.closeSync(fs.openSync(deleteFile, 'w'));
71
+ let deleteFile = envSpecificFile.replace(/\.ENV__.*__/,".ENV__DELETE__")
72
+ if(!fs.existsSync(deleteFile)) {
73
+ if(fs.existsSync(prodFile)) {
74
+ let backupFile = envSpecificFile.replace(/\.ENV__.*__/,".ENV__ORIGINAL_BACKUP__")
75
+ await git().raw(["update-index","--assume-unchanged", prodFile])
76
+ fs.renameSync(prodFile, backupFile)
77
+ } else {
78
+ fs.appendFileSync('.git/info/exclude', "\n" + prodFile)
79
+ fs.closeSync(fs.openSync(deleteFile, 'w'));
80
+ }
79
81
  }
80
82
  fs.renameSync(envSpecificFile, prodFile)
81
83
  await git().raw(["update-index","--assume-unchanged", envSpecificFile])
@@ -79,6 +79,7 @@ async function otherFilesContiousReload(cmdEnv) {
79
79
  if (
80
80
  (isLocalFile || isRemoteFile)
81
81
  && changedFile.indexOf("/customUI/") < 0
82
+ && changedFile.indexOf("/node_modules/") < 0
82
83
  && !changedFile.startsWith(".git")
83
84
  && !changedFile.startsWith(".idea")
84
85
  && !changedFile.startsWith(".DS_Store")
@@ -40,6 +40,10 @@ module.exports = env => {
40
40
  target: "http://localhost:8041",
41
41
  secure: false
42
42
  },
43
+ [ "/docs/**"]: {
44
+ target: "http://localhost:8080",
45
+ secure: false
46
+ },
43
47
  "/": {
44
48
  logLevel: "warn",
45
49
  target: env.SERVER,
@@ -58,7 +62,7 @@ module.exports = env => {
58
62
  return localPath;
59
63
  },
60
64
  onProxyRes: response => {
61
- response.headers['content-security-policy'] = "default-src 'unsafe-inline' 'unsafe-eval' https: data: http:";
65
+ response.headers['content-security-policy'] = "default-src 'unsafe-inline' 'unsafe-eval' https: data: http: ws:";
62
66
  }
63
67
  }
64
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cob-cli",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
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": {