@alfresco/adf-cli 8.3.0 → 8.3.1
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/adf-cli +15 -3
- package/package.json +6 -8
- package/scripts/audit.d.ts.map +1 -1
- package/scripts/audit.js +64 -13
- package/scripts/audit.js.map +1 -1
- package/scripts/changelog.d.ts.map +1 -1
- package/scripts/changelog.js +96 -29
- package/scripts/changelog.js.map +1 -1
- package/scripts/check-cs-env.d.ts.map +1 -1
- package/scripts/check-cs-env.js +55 -15
- package/scripts/check-cs-env.js.map +1 -1
- package/scripts/check-plugin-env.d.ts.map +1 -1
- package/scripts/check-plugin-env.js +66 -13
- package/scripts/check-plugin-env.js.map +1 -1
- package/scripts/index.d.ts +0 -2
- package/scripts/index.d.ts.map +1 -1
- package/scripts/index.js +0 -2
- package/scripts/index.js.map +1 -1
- package/scripts/init-aae-env.d.ts +0 -1
- package/scripts/init-aae-env.d.ts.map +1 -1
- package/scripts/init-aae-env.js +91 -27
- package/scripts/init-aae-env.js.map +1 -1
- package/scripts/init-acs-env.d.ts.map +1 -1
- package/scripts/init-acs-env.js +48 -10
- package/scripts/init-acs-env.js.map +1 -1
- package/scripts/init-aps-env.d.ts.map +1 -1
- package/scripts/init-aps-env.js +58 -19
- package/scripts/init-aps-env.js.map +1 -1
- package/scripts/licenses.d.ts.map +1 -1
- package/scripts/licenses.js +32 -14
- package/scripts/licenses.js.map +1 -1
- package/scripts/plugins/check-env.js +6 -1
- package/scripts/plugins/check-env.js.map +1 -1
- package/scripts/plugins/governance-check-plugin.js +3 -0
- package/scripts/plugins/governance-check-plugin.js.map +1 -1
- package/scripts/plugins/governance-health.js +2 -0
- package/scripts/plugins/governance-health.js.map +1 -1
- package/scripts/plugins/plugin-config.js +2 -0
- package/scripts/plugins/plugin-config.js.map +1 -1
- package/scripts/plugins/process-automation-check-plugin.js +3 -0
- package/scripts/plugins/process-automation-check-plugin.js.map +1 -1
- package/scripts/plugins/process-automation-health.js +4 -2
- package/scripts/plugins/process-automation-health.js.map +1 -1
- package/scripts/plugins/process-service-check-plugin.js +3 -0
- package/scripts/plugins/process-service-check-plugin.js.map +1 -1
- package/scripts/plugins/process-services-health.js +4 -2
- package/scripts/plugins/process-services-health.js.map +1 -1
- package/scripts/docker.d.ts +0 -39
- package/scripts/docker.d.ts.map +0 -1
- package/scripts/docker.js +0 -192
- package/scripts/docker.js.map +0 -1
- package/scripts/exec.d.ts +0 -30
- package/scripts/exec.d.ts.map +0 -1
- package/scripts/exec.js +0 -56
- package/scripts/exec.js.map +0 -1
package/bin/adf-cli
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const
|
|
2
|
+
const { parseArgs } = require('node:util');
|
|
3
3
|
const { resolve, join } = require('node:path');
|
|
4
4
|
const { readFileSync, existsSync } = require('node:fs');
|
|
5
5
|
const { argv, exit, env, cwd } = require('node:process');
|
|
@@ -10,10 +10,22 @@ function printHelp() {
|
|
|
10
10
|
console.log(`${name} v${version}`);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
|
|
13
|
+
const { values, positionals } = parseArgs({
|
|
14
|
+
args: argv.slice(2),
|
|
15
|
+
options: {
|
|
16
|
+
verbose: {
|
|
17
|
+
type: 'boolean'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
allowPositionals: true,
|
|
21
|
+
strict: false
|
|
15
22
|
});
|
|
16
23
|
|
|
24
|
+
const args = {
|
|
25
|
+
...values,
|
|
26
|
+
_: positionals
|
|
27
|
+
};
|
|
28
|
+
|
|
17
29
|
if (args._.length === 0) {
|
|
18
30
|
printHelp();
|
|
19
31
|
exit(1);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfresco/adf-cli",
|
|
3
3
|
"description": "Alfresco ADF cli and utils",
|
|
4
|
-
"version": "8.3.
|
|
4
|
+
"version": "8.3.1",
|
|
5
5
|
"author": "Hyland Software, Inc. and its affiliates",
|
|
6
6
|
"bin": {
|
|
7
7
|
"adf-cli": "bin/adf-cli",
|
|
@@ -17,16 +17,15 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "tsc -p tsconfig.json",
|
|
19
19
|
"develop": "tsc -p tsconfig.json --watch",
|
|
20
|
-
"dist": "rm -rf ../../dist/libs/cli && npm run build && cp -R ./bin ../../dist/libs/cli && cp -R ./resources ../../dist/libs/cli && cp -R ./templates ../../dist/libs/cli && cp ./package.json ../../dist/libs/cli"
|
|
20
|
+
"dist": "rm -rf ../../dist/libs/cli && npm run build && cp -R ./bin ../../dist/libs/cli && cp -R ./resources ../../dist/libs/cli && cp -R ./templates ../../dist/libs/cli && cp ./package.json ../../dist/libs/cli",
|
|
21
|
+
"link": "npm run dist && cd ../../dist/libs/cli && npm link",
|
|
22
|
+
"unlink": "cd ../../dist/libs/cli && npm unlink"
|
|
21
23
|
},
|
|
22
24
|
"dependencies": {
|
|
23
|
-
"@alfresco/js-api": ">=9.
|
|
24
|
-
"
|
|
25
|
-
"ejs": "^3.1.9",
|
|
25
|
+
"@alfresco/js-api": ">=9.2.0",
|
|
26
|
+
"ejs": "^3.1.10",
|
|
26
27
|
"license-checker": "^25.0.1",
|
|
27
28
|
"node-fetch": "^2.7.0",
|
|
28
|
-
"rxjs": "7.8.2",
|
|
29
|
-
"shelljs": "^0.8.3",
|
|
30
29
|
"spdx-license-list": "^5.0.0"
|
|
31
30
|
},
|
|
32
31
|
"keywords": [
|
|
@@ -36,7 +35,6 @@
|
|
|
36
35
|
"devDependencies": {
|
|
37
36
|
"@types/ejs": "^3.1.2",
|
|
38
37
|
"@types/node": "^20.1.7",
|
|
39
|
-
"@types/shelljs": "^0.8.12",
|
|
40
38
|
"typescript": "^4.9.5"
|
|
41
39
|
}
|
|
42
40
|
}
|
package/scripts/audit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../../lib/cli/scripts/audit.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../../lib/cli/scripts/audit.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;GAeG;AAcH;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,oBA0H/D"}
|
package/scripts/audit.js
CHANGED
|
@@ -51,13 +51,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
51
51
|
})();
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.default = main;
|
|
54
|
-
const
|
|
54
|
+
const node_child_process_1 = require("node:child_process");
|
|
55
55
|
const ejs = __importStar(require("ejs"));
|
|
56
56
|
const path = __importStar(require("path"));
|
|
57
57
|
const fs = __importStar(require("fs"));
|
|
58
58
|
const node_process_1 = require("node:process");
|
|
59
|
-
const
|
|
60
|
-
const program = new commander_1.Command();
|
|
59
|
+
const node_util_1 = require("node:util");
|
|
61
60
|
/**
|
|
62
61
|
* Audit report command
|
|
63
62
|
*
|
|
@@ -66,17 +65,37 @@ const program = new commander_1.Command();
|
|
|
66
65
|
* @returns void
|
|
67
66
|
*/
|
|
68
67
|
function main(_args, workingDir) {
|
|
69
|
-
program
|
|
70
|
-
.description('Generate an audit report')
|
|
71
|
-
.usage('audit [options]')
|
|
72
|
-
.option('-p, --package <path>', 'Path to package file (default: package.json in working directory)')
|
|
73
|
-
.option('-d, --outDir <dir>', 'Ouput directory (default: working directory)')
|
|
74
|
-
.parse(node_process_1.argv);
|
|
75
68
|
if (node_process_1.argv.includes('-h') || node_process_1.argv.includes('--help')) {
|
|
76
|
-
|
|
69
|
+
console.log(`
|
|
70
|
+
Usage: audit [options]
|
|
71
|
+
|
|
72
|
+
Generate an audit report
|
|
73
|
+
|
|
74
|
+
Options:
|
|
75
|
+
-p, --package <path> Path to package file (default: package.json in working directory)
|
|
76
|
+
-d, --outDir <dir> Output directory (default: working directory)
|
|
77
|
+
-h, --help Display help for command
|
|
78
|
+
`);
|
|
77
79
|
(0, node_process_1.exit)(0);
|
|
78
80
|
}
|
|
79
|
-
const
|
|
81
|
+
const { values } = (0, node_util_1.parseArgs)({
|
|
82
|
+
args: node_process_1.argv.slice(2),
|
|
83
|
+
options: {
|
|
84
|
+
package: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
short: 'p'
|
|
87
|
+
},
|
|
88
|
+
outDir: {
|
|
89
|
+
type: 'string',
|
|
90
|
+
short: 'd'
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
allowPositionals: true
|
|
94
|
+
});
|
|
95
|
+
const options = {
|
|
96
|
+
package: values.package,
|
|
97
|
+
outDir: values.outDir
|
|
98
|
+
};
|
|
80
99
|
let packagePath = path.resolve(workingDir, 'package.json');
|
|
81
100
|
if (options.package) {
|
|
82
101
|
packagePath = path.resolve(options.package);
|
|
@@ -94,8 +113,40 @@ function main(_args, workingDir) {
|
|
|
94
113
|
// eslint-disable-next-line no-console
|
|
95
114
|
console.log(`Running audit on ${packagePath}`);
|
|
96
115
|
const packageJson = JSON.parse(fs.readFileSync(packagePath).toString());
|
|
97
|
-
|
|
98
|
-
const
|
|
116
|
+
// Run in the directory containing the package.json
|
|
117
|
+
const packageDir = path.dirname(packagePath);
|
|
118
|
+
// Use spawnSync with array arguments for safer command execution (prevents shell injection)
|
|
119
|
+
// Cross-platform: npm is available on PATH on all platforms (Windows, macOS, Linux)
|
|
120
|
+
const result = (0, node_child_process_1.spawnSync)('npm', ['audit', '--json', '--prod'], {
|
|
121
|
+
cwd: packageDir,
|
|
122
|
+
encoding: 'utf-8',
|
|
123
|
+
// shell: false is the default and more secure (no shell interpretation)
|
|
124
|
+
shell: false,
|
|
125
|
+
// Set maxBuffer to handle large audit outputs
|
|
126
|
+
maxBuffer: 10 * 1024 * 1024 // 10MB
|
|
127
|
+
});
|
|
128
|
+
let jsonAudit;
|
|
129
|
+
// npm audit returns non-zero exit code when vulnerabilities are found
|
|
130
|
+
// We still want to parse the JSON output in this case
|
|
131
|
+
if (result.error) {
|
|
132
|
+
console.error('Failed to run npm audit:', result.error.message);
|
|
133
|
+
reject(result.error);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const auditOutput = result.stdout;
|
|
137
|
+
if (!auditOutput) {
|
|
138
|
+
console.error('npm audit produced no output');
|
|
139
|
+
reject(new Error('npm audit produced no output'));
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
jsonAudit = JSON.parse(auditOutput);
|
|
144
|
+
}
|
|
145
|
+
catch (parseError) {
|
|
146
|
+
console.error('Failed to parse npm audit output');
|
|
147
|
+
reject(parseError);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
99
150
|
ejs.renderFile(templatePath, {
|
|
100
151
|
jsonAudit,
|
|
101
152
|
projVersion: packageJson.version,
|
package/scripts/audit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../../lib/cli/scripts/audit.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../../lib/cli/scripts/audit.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBH,uBA0HC;AA7ID,2DAA+C;AAC/C,yCAA2B;AAC3B,2CAA6B;AAC7B,uCAAyB;AACzB,+CAA0C;AAC1C,yCAAsC;AAOtC;;;;;;GAMG;AACH,SAAwB,IAAI,CAAC,KAAe,EAAE,UAAkB;IAC5D,IAAI,mBAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,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;QAAC,OAAO,UAAU,EAAE,CAAC;YAClB,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;YAClD,MAAM,CAAC,UAAU,CAAC,CAAC;YACnB,OAAO;QACX,CAAC;QAED,GAAG,CAAC,UAAU,CACV,YAAY,EACZ;YACI,SAAS;YACT,WAAW,EAAE,WAAW,CAAC,OAAO;YAChC,QAAQ,EAAE,WAAW,CAAC,IAAI;SAC7B,EACD,EAAE,EACF,CAAC,GAAQ,EAAE,MAAc,EAAE,EAAE;YACzB,IAAI,GAAG,EAAE,CAAC;gBACN,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACnB,MAAM,CAAC,GAAG,CAAC,CAAC;YAChB,CAAC;iBAAM,CAAC;gBACJ,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,UAAU,CAAC,CAAC;gBAC9D,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,WAAW,CAAC,OAAO,KAAK,CAAC,CAAC;gBAEjF,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;gBAErC,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CAAC,mBAAmB,UAAU,EAAE,CAAC,CAAC;gBAC7C,OAAO,CAAC,CAAC,CAAC,CAAC;YACf,CAAC;QACL,CAAC,CACJ,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../../../lib/cli/scripts/changelog.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../../../lib/cli/scripts/changelog.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;GAeG;AAwJH;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,oBAiI/D"}
|
package/scripts/changelog.js
CHANGED
|
@@ -53,13 +53,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
53
53
|
exports.default = main;
|
|
54
54
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
55
55
|
const node_process_1 = require("node:process");
|
|
56
|
-
const
|
|
56
|
+
const node_util_1 = require("node:util");
|
|
57
|
+
const node_child_process_1 = require("node:child_process");
|
|
57
58
|
const path = __importStar(require("path"));
|
|
58
|
-
const commander_1 = require("commander");
|
|
59
59
|
const logger_1 = require("./logger");
|
|
60
60
|
const fs = __importStar(require("fs"));
|
|
61
61
|
const ejs = __importStar(require("ejs"));
|
|
62
|
-
const program = new commander_1.Command();
|
|
63
62
|
/**
|
|
64
63
|
* Get the remote URL for the cloned git repository
|
|
65
64
|
*
|
|
@@ -67,9 +66,19 @@ const program = new commander_1.Command();
|
|
|
67
66
|
* @returns URL pointing to the git remote
|
|
68
67
|
*/
|
|
69
68
|
function getRemote(workingDir) {
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
69
|
+
// Use spawnSync with array arguments for safer command execution (prevents shell injection)
|
|
70
|
+
const result = (0, node_child_process_1.spawnSync)('git', ['config', '--get', 'remote.origin.url'], {
|
|
71
|
+
cwd: workingDir,
|
|
72
|
+
encoding: 'utf-8',
|
|
73
|
+
shell: false
|
|
74
|
+
});
|
|
75
|
+
if (result.error) {
|
|
76
|
+
throw new Error(`Failed to get git remote: ${result.error.message}`);
|
|
77
|
+
}
|
|
78
|
+
if (result.status !== 0) {
|
|
79
|
+
throw new Error(`git config command failed with exit code ${result.status}: ${result.stderr}`);
|
|
80
|
+
}
|
|
81
|
+
return result.stdout.trim();
|
|
73
82
|
}
|
|
74
83
|
/**
|
|
75
84
|
* Get the list of commits based on the configuration options
|
|
@@ -85,14 +94,14 @@ function getCommits(options) {
|
|
|
85
94
|
if (!authorFilter) {
|
|
86
95
|
authorFilter = `bot|Alfresco Build User`;
|
|
87
96
|
}
|
|
97
|
+
// Build git command arguments array for safe execution (prevents shell injection)
|
|
88
98
|
const args = [
|
|
89
|
-
|
|
90
|
-
`log`,
|
|
99
|
+
'log',
|
|
91
100
|
options.range,
|
|
92
|
-
|
|
93
|
-
|
|
101
|
+
'--no-merges',
|
|
102
|
+
'--first-parent',
|
|
94
103
|
// this format is needed to allow parsing all characters in the commit message and safely convert to JSON
|
|
95
|
-
|
|
104
|
+
'--format={ ^@^hash^@^: ^@^%h^@^, ^@^author^@^: ^@^%an^@^, ^@^author_email^@^: ^@^%ae^@^, ^@^date^@^: ^@^%ad^@^, ^@^subject^@^: ^@^%s^@^ }'
|
|
96
105
|
];
|
|
97
106
|
if (options.max !== undefined) {
|
|
98
107
|
args.push(`--max-count=${options.max}`);
|
|
@@ -100,8 +109,20 @@ function getCommits(options) {
|
|
|
100
109
|
if (options.skip !== undefined) {
|
|
101
110
|
args.push(`--skip=${options.skip}`);
|
|
102
111
|
}
|
|
103
|
-
|
|
104
|
-
|
|
112
|
+
// Use spawnSync with array arguments for safer command execution
|
|
113
|
+
const result = (0, node_child_process_1.spawnSync)('git', args, {
|
|
114
|
+
cwd: options.dir,
|
|
115
|
+
encoding: 'utf-8',
|
|
116
|
+
shell: false,
|
|
117
|
+
maxBuffer: 10 * 1024 * 1024 // 10MB to handle large git logs
|
|
118
|
+
});
|
|
119
|
+
if (result.error) {
|
|
120
|
+
throw new Error(`Failed to get git commits: ${result.error.message}`);
|
|
121
|
+
}
|
|
122
|
+
if (result.status !== 0) {
|
|
123
|
+
throw new Error(`git log command failed with exit code ${result.status}: ${result.stderr}`);
|
|
124
|
+
}
|
|
125
|
+
let log = result.stdout;
|
|
105
126
|
// https://stackoverflow.com/a/13928240/14644447
|
|
106
127
|
log = JSON.stringify(log.trim()).slice(1, -1).replace(/\^@\^/gm, '"');
|
|
107
128
|
if (log.endsWith(',')) {
|
|
@@ -140,25 +161,71 @@ function commitAuthorAllowed(commit, authorFilter) {
|
|
|
140
161
|
* @returns void
|
|
141
162
|
*/
|
|
142
163
|
function main(_args, workingDir) {
|
|
143
|
-
program
|
|
144
|
-
.description('Generate changelog report for two branches of git repository')
|
|
145
|
-
.version('0.0.1', '-v, --version')
|
|
146
|
-
.usage('changelog [options]')
|
|
147
|
-
.option('-r, --range <range>', 'Commit range, e.g. origin/master..develop', 'origin/master..develop')
|
|
148
|
-
.option('-d, --dir <dir>', 'Working directory (default: working directory)')
|
|
149
|
-
.option('-m, --max <number>', 'Limit the number of commits to output')
|
|
150
|
-
.option('-o, --output <dir>', 'Output directory, will use console output if not defined')
|
|
151
|
-
.option('--skip <number>', 'Skip number commits before starting to show the commit output')
|
|
152
|
-
.option('-f, --format <format>', 'Output format (md, html)', 'md')
|
|
153
|
-
.option('-e --exclude <string>', 'Exclude authors from the output, comma-delimited list')
|
|
154
|
-
.parse(node_process_1.argv);
|
|
155
164
|
if (node_process_1.argv.includes('-h') || node_process_1.argv.includes('--help')) {
|
|
156
|
-
|
|
165
|
+
console.log(`
|
|
166
|
+
Usage: changelog [options]
|
|
167
|
+
|
|
168
|
+
Generate changelog report for two branches of git repository
|
|
169
|
+
|
|
170
|
+
Options:
|
|
171
|
+
-v, --version Output the version number
|
|
172
|
+
-r, --range <range> Commit range, e.g. origin/master..develop (default: "origin/master..develop")
|
|
173
|
+
-d, --dir <dir> Working directory (default: working directory)
|
|
174
|
+
-m, --max <number> Limit the number of commits to output
|
|
175
|
+
-o, --output <dir> Output directory, will use console output if not defined
|
|
176
|
+
--skip <number> Skip number commits before starting to show the commit output
|
|
177
|
+
-f, --format <format> Output format (md, html) (default: "md")
|
|
178
|
+
-e, --exclude <string> Exclude authors from the output, comma-delimited list
|
|
179
|
+
-h, --help Display help for command
|
|
180
|
+
`);
|
|
181
|
+
(0, node_process_1.exit)(0);
|
|
182
|
+
}
|
|
183
|
+
if (node_process_1.argv.includes('-v') || node_process_1.argv.includes('--version')) {
|
|
184
|
+
console.log('0.0.1');
|
|
157
185
|
(0, node_process_1.exit)(0);
|
|
158
186
|
}
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
187
|
+
const { values } = (0, node_util_1.parseArgs)({
|
|
188
|
+
args: node_process_1.argv.slice(2),
|
|
189
|
+
options: {
|
|
190
|
+
range: {
|
|
191
|
+
type: 'string',
|
|
192
|
+
short: 'r',
|
|
193
|
+
default: 'origin/master..develop'
|
|
194
|
+
},
|
|
195
|
+
dir: {
|
|
196
|
+
type: 'string',
|
|
197
|
+
short: 'd'
|
|
198
|
+
},
|
|
199
|
+
max: {
|
|
200
|
+
type: 'string',
|
|
201
|
+
short: 'm'
|
|
202
|
+
},
|
|
203
|
+
output: {
|
|
204
|
+
type: 'string',
|
|
205
|
+
short: 'o'
|
|
206
|
+
},
|
|
207
|
+
skip: {
|
|
208
|
+
type: 'string'
|
|
209
|
+
},
|
|
210
|
+
format: {
|
|
211
|
+
type: 'string',
|
|
212
|
+
short: 'f',
|
|
213
|
+
default: 'md'
|
|
214
|
+
},
|
|
215
|
+
exclude: {
|
|
216
|
+
type: 'string',
|
|
217
|
+
short: 'e'
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
allowPositionals: true
|
|
221
|
+
});
|
|
222
|
+
const dir = path.resolve(values.dir || workingDir);
|
|
223
|
+
const range = values.range;
|
|
224
|
+
const skip = values.skip ? parseInt(values.skip, 10) : undefined;
|
|
225
|
+
const max = values.max ? parseInt(values.max, 10) : undefined;
|
|
226
|
+
const format = values.format;
|
|
227
|
+
const output = values.output;
|
|
228
|
+
const exclude = values.exclude;
|
|
162
229
|
const remote = getRemote(dir);
|
|
163
230
|
let repo_url = remote;
|
|
164
231
|
if (repo_url.endsWith('.git')) {
|
package/scripts/changelog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../../../lib/cli/scripts/changelog.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;GAeG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3,"file":"check-cs-env.d.ts","sourceRoot":"","sources":["../../../../lib/cli/scripts/check-cs-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAoBH;;GAEG;AACH,wBAA8B,IAAI,kBA6DjC"}
|
package/scripts/check-cs-env.js
CHANGED
|
@@ -19,9 +19,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.default = main;
|
|
20
20
|
const js_api_1 = require("@alfresco/js-api");
|
|
21
21
|
const node_process_1 = require("node:process");
|
|
22
|
-
const
|
|
22
|
+
const node_util_1 = require("node:util");
|
|
23
23
|
const logger_1 = require("./logger");
|
|
24
|
-
const program = new commander_1.Command();
|
|
25
24
|
const MAX_RETRY = 3;
|
|
26
25
|
const TIMEOUT = 20000;
|
|
27
26
|
let counter = 0;
|
|
@@ -30,17 +29,59 @@ let alfrescoJsApi;
|
|
|
30
29
|
* Check CS environment command
|
|
31
30
|
*/
|
|
32
31
|
async function main() {
|
|
33
|
-
|
|
34
|
-
.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
if (node_process_1.argv.includes('-h') || node_process_1.argv.includes('--help')) {
|
|
33
|
+
console.log(`
|
|
34
|
+
Usage: check-cs-env [options]
|
|
35
|
+
|
|
36
|
+
Check Content service is up
|
|
37
|
+
|
|
38
|
+
Options:
|
|
39
|
+
-v, --version Output the version number
|
|
40
|
+
--host <host> Remote environment host adf.lab.com
|
|
41
|
+
-p, --password <pass> Password
|
|
42
|
+
-u, --username <user> Username
|
|
43
|
+
-t, --time <ms> Time in milliseconds
|
|
44
|
+
-r, --retry <num> Retry count
|
|
45
|
+
-h, --help Display help for command
|
|
46
|
+
`);
|
|
47
|
+
(0, node_process_1.exit)(0);
|
|
48
|
+
}
|
|
49
|
+
if (node_process_1.argv.includes('-v') || node_process_1.argv.includes('--version')) {
|
|
50
|
+
console.log('0.1.0');
|
|
51
|
+
(0, node_process_1.exit)(0);
|
|
52
|
+
}
|
|
53
|
+
const { values } = (0, node_util_1.parseArgs)({
|
|
54
|
+
args: node_process_1.argv.slice(2),
|
|
55
|
+
options: {
|
|
56
|
+
host: {
|
|
57
|
+
type: 'string'
|
|
58
|
+
},
|
|
59
|
+
password: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
short: 'p'
|
|
62
|
+
},
|
|
63
|
+
username: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
short: 'u'
|
|
66
|
+
},
|
|
67
|
+
time: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
short: 't'
|
|
70
|
+
},
|
|
71
|
+
retry: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
short: 'r'
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
allowPositionals: true
|
|
77
|
+
});
|
|
78
|
+
const opts = {
|
|
79
|
+
host: values.host,
|
|
80
|
+
username: values.username,
|
|
81
|
+
password: values.password,
|
|
82
|
+
time: values.time ? parseInt(values.time, 10) : undefined,
|
|
83
|
+
retry: values.retry ? parseInt(values.retry, 10) : undefined
|
|
84
|
+
};
|
|
44
85
|
await checkEnv(opts);
|
|
45
86
|
// TODO: https://alfresco.atlassian.net/browse/ACS-5873
|
|
46
87
|
// await checkDiskSpaceFullEnv();
|
|
@@ -51,7 +92,6 @@ async function main() {
|
|
|
51
92
|
* @param opts command options
|
|
52
93
|
*/
|
|
53
94
|
async function checkEnv(opts) {
|
|
54
|
-
var _a;
|
|
55
95
|
try {
|
|
56
96
|
alfrescoJsApi = new js_api_1.AlfrescoApi({
|
|
57
97
|
provider: 'ECM',
|
|
@@ -61,7 +101,7 @@ async function checkEnv(opts) {
|
|
|
61
101
|
await alfrescoJsApi.login(opts.username, opts.password);
|
|
62
102
|
}
|
|
63
103
|
catch (error) {
|
|
64
|
-
if (
|
|
104
|
+
if (error?.error?.code === 'ETIMEDOUT') {
|
|
65
105
|
logger_1.logger.error('The env is not reachable. Terminating');
|
|
66
106
|
(0, node_process_1.exit)(1);
|
|
67
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-cs-env.js","sourceRoot":"","sources":["../../../../lib/cli/scripts/check-cs-env.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;
|
|
1
|
+
{"version":3,"file":"check-cs-env.js","sourceRoot":"","sources":["../../../../lib/cli/scripts/check-cs-env.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAuBH,uBA6DC;AAlFD,6CAAyE;AACzE,+CAA0C;AAC1C,yCAAsC;AACtC,qCAAkC;AASlC,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,OAAO,GAAG,KAAK,CAAC;AAEtB,IAAI,OAAO,GAAG,CAAC,CAAC;AAChB,IAAI,aAA0B,CAAC;AAE/B;;GAEG;AACY,KAAK,UAAU,IAAI;IAC9B,IAAI,mBAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,mBAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;CAanB,CAAC,CAAC;QACK,IAAA,mBAAI,EAAC,CAAC,CAAC,CAAC;IACZ,CAAC;IAED,IAAI,mBAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,mBAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QACpD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,IAAA,mBAAI,EAAC,CAAC,CAAC,CAAC;IACZ,CAAC;IAED,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAS,EAAC;QACzB,IAAI,EAAE,mBAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACnB,OAAO,EAAE;YACL,IAAI,EAAE;gBACF,IAAI,EAAE,QAAQ;aACjB;YACD,QAAQ,EAAE;gBACN,IAAI,EAAE,QAAQ;g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C,CAAC,CAAC;YACtD,IAAA,mBAAI,EAAC,CAAC,CAAC,CAAC;QACZ,CAAC;QACD,eAAM,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAC7D,OAAO,EAAE,CAAC;QACV,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC;QACtC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC;QAClC,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;YACpB,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACxB,IAAA,mBAAI,EAAC,CAAC,CAAC,CAAC;QACZ,CAAC;aAAM,CAAC;YACJ,eAAM,CAAC,KAAK,CAAC,+BAA+B,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;YAC9D,KAAK,CAAC,IAAI,CAAC,CAAC;YACZ,MAAM,QAAQ,EAAE,CAAC;QACrB,CAAC;IACL,CAAC;AACL,CAAC;AAED,uDAAuD;AACvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCE;AAEF;;;;GAIG;AACH,SAAS,KAAK,CAAC,KAAa;IACxB,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;IACnC,OAAO,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,GAAG,KAAK,EAAE,CAAC,CAAA,CAAC;AACnD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-plugin-env.d.ts","sourceRoot":"","sources":["../../../../lib/cli/scripts/check-plugin-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"check-plugin-env.d.ts","sourceRoot":"","sources":["../../../../lib/cli/scripts/check-plugin-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAqBH;;GAEG;AACH,wBAA8B,IAAI,kBAoFjC"}
|
|
@@ -18,28 +18,81 @@
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.default = main;
|
|
20
20
|
const node_process_1 = require("node:process");
|
|
21
|
+
const node_util_1 = require("node:util");
|
|
21
22
|
const check_env_1 = require("./plugins/check-env");
|
|
22
|
-
const commander_1 = require("commander");
|
|
23
23
|
const process_service_check_plugin_1 = require("./plugins/process-service-check-plugin");
|
|
24
24
|
const process_automation_check_plugin_1 = require("./plugins/process-automation-check-plugin");
|
|
25
25
|
const governance_check_plugin_1 = require("./plugins/governance-check-plugin");
|
|
26
|
-
const program = new commander_1.Command();
|
|
27
26
|
let pluginEnv;
|
|
28
27
|
/**
|
|
29
28
|
* Check environment plugin
|
|
30
29
|
*/
|
|
31
30
|
async function main() {
|
|
32
|
-
|
|
33
|
-
.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
if (node_process_1.argv.includes('-h') || node_process_1.argv.includes('--help')) {
|
|
32
|
+
console.log(`
|
|
33
|
+
Usage: check-plugin-env [options]
|
|
34
|
+
|
|
35
|
+
Check plugin status
|
|
36
|
+
|
|
37
|
+
Options:
|
|
38
|
+
-v, --version Output the version number
|
|
39
|
+
--host <host> Remote environment host
|
|
40
|
+
--pluginName <name> Plugin name (processService, processAutomation, governance)
|
|
41
|
+
--clientId <id> SSO client (default: "alfresco")
|
|
42
|
+
--appName <name> Deployed appName on activiti-cloud
|
|
43
|
+
-p, --password <pass> Password
|
|
44
|
+
-u, --username <user> Username
|
|
45
|
+
--ui, --uiName <name> Deployed app UI type on activiti-cloud
|
|
46
|
+
-h, --help Display help for command
|
|
47
|
+
`);
|
|
48
|
+
(0, node_process_1.exit)(0);
|
|
49
|
+
}
|
|
50
|
+
if (node_process_1.argv.includes('-v') || node_process_1.argv.includes('--version')) {
|
|
51
|
+
console.log('0.1.0');
|
|
52
|
+
(0, node_process_1.exit)(0);
|
|
53
|
+
}
|
|
54
|
+
const { values } = (0, node_util_1.parseArgs)({
|
|
55
|
+
args: node_process_1.argv.slice(2),
|
|
56
|
+
options: {
|
|
57
|
+
host: {
|
|
58
|
+
type: 'string'
|
|
59
|
+
},
|
|
60
|
+
pluginName: {
|
|
61
|
+
type: 'string'
|
|
62
|
+
},
|
|
63
|
+
clientId: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
default: 'alfresco'
|
|
66
|
+
},
|
|
67
|
+
appName: {
|
|
68
|
+
type: 'string'
|
|
69
|
+
},
|
|
70
|
+
password: {
|
|
71
|
+
type: 'string',
|
|
72
|
+
short: 'p'
|
|
73
|
+
},
|
|
74
|
+
username: {
|
|
75
|
+
type: 'string',
|
|
76
|
+
short: 'u'
|
|
77
|
+
},
|
|
78
|
+
ui: {
|
|
79
|
+
type: 'string'
|
|
80
|
+
},
|
|
81
|
+
uiName: {
|
|
82
|
+
type: 'string'
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
allowPositionals: true
|
|
86
|
+
});
|
|
87
|
+
const options = {
|
|
88
|
+
host: values.host,
|
|
89
|
+
pluginName: values.pluginName,
|
|
90
|
+
clientId: values.clientId,
|
|
91
|
+
appName: values.appName,
|
|
92
|
+
username: values.username,
|
|
93
|
+
password: values.password,
|
|
94
|
+
uiName: (values.ui || values.uiName)
|
|
95
|
+
};
|
|
43
96
|
pluginEnv = new check_env_1.CheckEnv(options.host, options.username, options.password, options.clientId);
|
|
44
97
|
await pluginEnv.checkEnv();
|
|
45
98
|
if (options.pluginName === 'processService') {
|