cob-cli 2.38.0 → 2.39.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.
package/bin/cob-cli.js
CHANGED
|
@@ -11,6 +11,7 @@ const customize = require("../lib/commands/customize");
|
|
|
11
11
|
const test = require("../lib/commands/test");
|
|
12
12
|
const deploy = require("../lib/commands/deploy");
|
|
13
13
|
const updateFromServer = require("../lib/commands/updateFromServer");
|
|
14
|
+
const getDefs = require("../lib/commands/getDefs");
|
|
14
15
|
const { upgradeRepo } = require("../lib/commands/upgradeRepo");
|
|
15
16
|
|
|
16
17
|
/*******************************************/
|
|
@@ -78,4 +79,10 @@ program
|
|
|
78
79
|
.description('Upgrade current repository to the last cob-cli version structure')
|
|
79
80
|
.action( upgradeRepo );
|
|
80
81
|
|
|
82
|
+
program
|
|
83
|
+
.command('getDefs')
|
|
84
|
+
.option('-e --environment <name>', 'environment to use')
|
|
85
|
+
.description('Updates local copy with definitions on server')
|
|
86
|
+
.action( getDefs );
|
|
87
|
+
|
|
81
88
|
program.parse(process.argv);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require('colors');
|
|
2
|
+
const { getCurrentCommandEnviroment } = require("../task_lists/common_enviromentHandler");
|
|
3
|
+
const { checkRepoVersion } = require("../commands/upgradeRepo");
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const spawn = require('child_process').spawn;
|
|
6
|
+
|
|
7
|
+
async function getDefs(args) {
|
|
8
|
+
try {
|
|
9
|
+
checkRepoVersion()
|
|
10
|
+
const cmdEnv = await getCurrentCommandEnviroment(args)
|
|
11
|
+
|
|
12
|
+
console.log(`Getting definitions from ${cmdEnv.serverStr} to branch ${cmdEnv.branchStr} ...` );
|
|
13
|
+
const getDefs = spawn(path.resolve(__dirname,"..","task_lists","getDefs.sh"),[cmdEnv.server, cmdEnv.name, path.resolve(__dirname) ])
|
|
14
|
+
getDefs.stdout.on('data', function (data) { console.log(" " + data.toString()); });
|
|
15
|
+
getDefs.on('exit', function () { console.log('Done!'); });
|
|
16
|
+
} catch(err) {
|
|
17
|
+
console.error("\n",err.message);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
module.exports = getDefs;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
IFS=$'\n'
|
|
2
|
+
SERVER=${1}
|
|
3
|
+
ENVIRONMENT=${2}
|
|
4
|
+
COBCLIPATH=${3}
|
|
5
|
+
|
|
6
|
+
echo "mkdir -p recordm/definitions/\\c"
|
|
7
|
+
mkdir -p recordm/definitions/
|
|
8
|
+
|
|
9
|
+
echo "rm -f recordm/definitions/$ENVIRONMENT\\c"
|
|
10
|
+
rm -f recordm/definitions/$ENVIRONMENT/*
|
|
11
|
+
|
|
12
|
+
DIR=recordm/definitions/$ENVIRONMENT
|
|
13
|
+
echo "mkdir -p $DIR"
|
|
14
|
+
mkdir -p $DIR
|
|
15
|
+
|
|
16
|
+
for def in $(ssh $SERVER "curl -sS -b ~/.cob-cookie http://localhost:40280/recordm/definitions" | jq .[] -c | node $COBCLIPATH/../../node_modules/cmd-line-importer/processor.js --transformer "JSON.stringify([entry.id,entry.name])"); do
|
|
17
|
+
echo " getting def: $def ...\\c"
|
|
18
|
+
ssh $SERVER "curl -sS -b ~/.cob-cookie http://localhost:40280/recordm/definitions/$(echo $def | jq '.[0]')" | jq --sort-keys . | grep -v "\"defaultValue\":" > $DIR/$(echo $def | jq .[1] | tr -d '"').json
|
|
19
|
+
done
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const chokidar = require('chokidar');
|
|
1
2
|
const fs = require('fs-extra');
|
|
2
3
|
const execa = require('execa');
|
|
3
4
|
const git = require('simple-git');
|
|
@@ -56,8 +57,13 @@ async function otherFilesContiousReload(cmdEnv) {
|
|
|
56
57
|
const changedFile = change.split(" ")[1];
|
|
57
58
|
await addFileToCurrentTest(cmdEnv.server, changedFile, changedFiles, changeType, restoreChanges);
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
watcher.process = chokidar.watch('.', {
|
|
61
|
+
//ignored: /(^|[\/\\])\../, // ignore dotfiles
|
|
62
|
+
persistent: true,
|
|
63
|
+
usePolling: true,
|
|
64
|
+
ignoreInitial: true
|
|
65
|
+
});
|
|
66
|
+
watcher.process.on('all', async (eventType, changedFile) => {
|
|
61
67
|
// Não é preciso fazer nada para directorias que só existem no servidor
|
|
62
68
|
let product = changedFile.split("/")[0];
|
|
63
69
|
let productDir = resolveCobPath(cmdEnv.server, "serverLive", product).split(":")[1];
|
|
@@ -72,7 +78,7 @@ async function otherFilesContiousReload(cmdEnv) {
|
|
|
72
78
|
|
|
73
79
|
let isLocalFile = false;
|
|
74
80
|
try {
|
|
75
|
-
|
|
81
|
+
isLocalFile = fs.lstatSync(changedFile).isFile()
|
|
76
82
|
} catch {}
|
|
77
83
|
|
|
78
84
|
if (
|
|
@@ -86,6 +92,7 @@ async function otherFilesContiousReload(cmdEnv) {
|
|
|
86
92
|
&& changedFile.indexOf(IN_PROGRESS_TEST_FILE) < 0
|
|
87
93
|
&& (isLocalFile || await isRemoteFile())
|
|
88
94
|
) {
|
|
95
|
+
|
|
89
96
|
try {
|
|
90
97
|
await addFileToCurrentTest(cmdEnv.server, changedFile, changedFiles, " Syncing ".bgRed.bold + " ", restoreChanges );
|
|
91
98
|
changedFiles.add(changedFile);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cob-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.39.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": {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@webpack-cli/serve": "^2.0.1",
|
|
20
20
|
"axios": "^0.21.1",
|
|
21
|
+
"cmd-line-importer": "^1.0.0",
|
|
21
22
|
"colors": "^1.4.0",
|
|
22
23
|
"commander": "^5.1.0",
|
|
23
24
|
"concurrently": "^5.3.0",
|
|
@@ -33,7 +34,8 @@
|
|
|
33
34
|
"webpack": "^5.75.0",
|
|
34
35
|
"webpack-cli": "^5.0.1",
|
|
35
36
|
"webpack-dev-server": "^4.11.1",
|
|
36
|
-
"xdg-basedir": "^5.1.0"
|
|
37
|
+
"xdg-basedir": "^5.1.0",
|
|
38
|
+
"chokidar": "^3.5.3"
|
|
37
39
|
},
|
|
38
40
|
"keywords": [],
|
|
39
41
|
"author": "mimes70",
|