occam-verify-cli 0.0.324 → 0.0.325
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/abbreviations.js +4 -4
- package/bin/callbacks.js +36 -0
- package/bin/defaults.js +11 -0
- package/bin/main.js +12 -8
- package/bin/options.js +3 -1
- package/package.json +1 -1
- package/bin/utilities/callbacks.js +0 -57
- package/bin/utilities/logging.js +0 -34
package/bin/abbreviations.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const { LOG_LEVEL_OPTIONS, RELEASE_NAME_OPTIONS } = require("./options");
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const p = RELEASE_NAME_OPTIONS;
|
|
5
|
+
const l = LOG_LEVEL_OPTIONS,
|
|
6
|
+
p = RELEASE_NAME_OPTIONS;
|
|
8
7
|
|
|
9
8
|
module.exports = {
|
|
9
|
+
l,
|
|
10
10
|
p
|
|
11
11
|
};
|
package/bin/callbacks.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { levels } = require("necessary"),
|
|
4
|
+
{ Callbacks } = require("../lib/index"),
|
|
5
|
+
{ loggingUtilities } = require("necessary");
|
|
6
|
+
|
|
7
|
+
const { HALT_MESSAGE, BEGIN_MESSAGE, COMPLETED_MESSAGE } = require("./messages");
|
|
8
|
+
|
|
9
|
+
const { log } = loggingUtilities,
|
|
10
|
+
{ TRACE_LEVEL } = levels;
|
|
11
|
+
|
|
12
|
+
function halt(filePath, leastLineIndex, greatestLineIndex) { logMessage(HALT_MESSAGE, filePath, leastLineIndex, greatestLineIndex); } ///
|
|
13
|
+
|
|
14
|
+
function begin(filePath, leastLineIndex, greatestLineIndex) { logMessage(BEGIN_MESSAGE, filePath, leastLineIndex, greatestLineIndex); } ///
|
|
15
|
+
|
|
16
|
+
function complete(filePath, leastLineIndex, greatestLineIndex) { logMessage(COMPLETED_MESSAGE, filePath, leastLineIndex, greatestLineIndex); } ///
|
|
17
|
+
|
|
18
|
+
const callbacks = Callbacks.fromHaltBeginAndComplete(halt, begin, complete);
|
|
19
|
+
|
|
20
|
+
module.exports = callbacks;
|
|
21
|
+
|
|
22
|
+
function logMessage(message, filePath, leastLineIndex, greatestLineIndex) {
|
|
23
|
+
if (leastLineIndex === greatestLineIndex) {
|
|
24
|
+
const lineIndex = leastLineIndex; ///
|
|
25
|
+
|
|
26
|
+
message = `'${filePath}' : [${lineIndex}] - ${message}`;
|
|
27
|
+
} else {
|
|
28
|
+
message = `'${filePath}' : [${leastLineIndex}-${greatestLineIndex}] - ${message}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const level = TRACE_LEVEL;
|
|
32
|
+
|
|
33
|
+
log(message, level);
|
|
34
|
+
|
|
35
|
+
return message;
|
|
36
|
+
}
|
package/bin/defaults.js
ADDED
package/bin/main.js
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
{
|
|
3
|
+
const { fileSystemUtilities } = require("occam-file-system"),
|
|
4
|
+
{ arrayUtilities, loggingUtilities } = require("necessary"),
|
|
5
5
|
{ verifyRelease, releaseContextUtilities } = require("../lib/index");
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
{ PERIOD } = require("./constants"),
|
|
9
|
-
{ callbacksFromLog } = require("./utilities/callbacks");
|
|
7
|
+
const callbacks = require("./callbacks");
|
|
10
8
|
|
|
11
|
-
const {
|
|
9
|
+
const { PERIOD } = require("./constants"),
|
|
10
|
+
{ DEFAULT_LOG_LEVEL } = require("./defaults");
|
|
11
|
+
|
|
12
|
+
const { log } = loggingUtilities,
|
|
13
|
+
{ first } = arrayUtilities,
|
|
14
|
+
{ setLogLevel } = log,
|
|
12
15
|
{ loadRelease } = fileSystemUtilities,
|
|
13
16
|
{ createReleaseContext } = releaseContextUtilities;
|
|
14
17
|
|
|
15
18
|
function main(commands, options) {
|
|
16
19
|
const firstCommand = first(commands),
|
|
17
|
-
{ releaseName = firstCommand } = options, ///
|
|
20
|
+
{ logLevel = DEFAULT_LOG_LEVEL, releaseName = firstCommand } = options, ///
|
|
18
21
|
releaseContextMap = {},
|
|
19
22
|
shortenedVersion = null,
|
|
20
23
|
dependentNames = [],
|
|
21
|
-
callbacks = callbacksFromLog(log),
|
|
22
24
|
context = {
|
|
23
25
|
log,
|
|
24
26
|
callbacks,
|
|
@@ -26,6 +28,8 @@ function main(commands, options) {
|
|
|
26
28
|
releaseContextMap
|
|
27
29
|
};
|
|
28
30
|
|
|
31
|
+
setLogLevel(logLevel);
|
|
32
|
+
|
|
29
33
|
createReleaseContext(releaseName, dependentNames, shortenedVersion, context, (error) => {
|
|
30
34
|
if (error) {
|
|
31
35
|
///
|
package/bin/options.js
CHANGED
package/package.json
CHANGED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { levels } = require("necessary"),
|
|
4
|
-
{ Callbacks } = require("../../lib/index");
|
|
5
|
-
|
|
6
|
-
const { HALT_MESSAGE, BEGIN_MESSAGE, COMPLETED_MESSAGE } = require("../messages");
|
|
7
|
-
|
|
8
|
-
const { TRACE_LEVEL } = levels;
|
|
9
|
-
|
|
10
|
-
function callbacksFromLog(log) {
|
|
11
|
-
const level = TRACE_LEVEL;
|
|
12
|
-
|
|
13
|
-
function halt(filePath, leastLineIndex, greatestLineIndex) {
|
|
14
|
-
let message = HALT_MESSAGE;
|
|
15
|
-
|
|
16
|
-
message = messageFromMessageFilePathLeastLineIndexAndGreatestLineIndex(message, filePath, leastLineIndex, greatestLineIndex);
|
|
17
|
-
|
|
18
|
-
log(level, message);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function begin(filePath, leastLineIndex, greatestLineIndex) {
|
|
22
|
-
let message = BEGIN_MESSAGE;
|
|
23
|
-
|
|
24
|
-
message = messageFromMessageFilePathLeastLineIndexAndGreatestLineIndex(message, filePath, leastLineIndex, greatestLineIndex);
|
|
25
|
-
|
|
26
|
-
log(level, message);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function complete(filePath, leastLineIndex, greatestLineIndex) {
|
|
30
|
-
let message = COMPLETED_MESSAGE;
|
|
31
|
-
|
|
32
|
-
message = messageFromMessageFilePathLeastLineIndexAndGreatestLineIndex(message, filePath, leastLineIndex, greatestLineIndex);
|
|
33
|
-
|
|
34
|
-
log(level, message);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const callbacks = Callbacks.fromHaltBeginAndComplete(halt, begin, complete);
|
|
38
|
-
|
|
39
|
-
return callbacks;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
module.exports = {
|
|
44
|
-
callbacksFromLog
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
function messageFromMessageFilePathLeastLineIndexAndGreatestLineIndex(message, filePath, leastLineIndex, greatestLineIndex) {
|
|
48
|
-
if (leastLineIndex === greatestLineIndex) {
|
|
49
|
-
const lineIndex = leastLineIndex; ///
|
|
50
|
-
|
|
51
|
-
message = `'${filePath}' : [${lineIndex}] - ${message}`;
|
|
52
|
-
} else {
|
|
53
|
-
message = `'${filePath}' : [${leastLineIndex}-${greatestLineIndex}] - ${message}`;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return message;
|
|
57
|
-
}
|
package/bin/utilities/logging.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { levels } = require("necessary");
|
|
4
|
-
|
|
5
|
-
const { TRACE_LEVEL, DEBUG_LEVEL, INFO_LEVEL, WARNING_LEVEL, ERROR_LEVEL, FATAL_LEVEL } = levels;
|
|
6
|
-
|
|
7
|
-
function log(level, message) {
|
|
8
|
-
console.log(`(${level}) ${message}`)
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function trace(message) { log(TRACE_LEVEL, message); }
|
|
12
|
-
|
|
13
|
-
function debug(message) { log(DEBUG_LEVEL, message); }
|
|
14
|
-
|
|
15
|
-
function info(message) { log(INFO_LEVEL, message); }
|
|
16
|
-
|
|
17
|
-
function warning(message) { log(WARNING_LEVEL, message); }
|
|
18
|
-
|
|
19
|
-
function error(message) { log(ERROR_LEVEL, message); }
|
|
20
|
-
|
|
21
|
-
function fatal(message) { log(FATAL_LEVEL, message); }
|
|
22
|
-
|
|
23
|
-
Object.assign(log, {
|
|
24
|
-
trace,
|
|
25
|
-
debug,
|
|
26
|
-
info,
|
|
27
|
-
warning,
|
|
28
|
-
error,
|
|
29
|
-
fatal
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
module.exports = {
|
|
33
|
-
log
|
|
34
|
-
};
|