occam-verify-cli 0.0.383 → 0.0.385
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 +7 -5
- package/bin/action/help.js +34 -0
- package/bin/action/verify.js +46 -0
- package/bin/action/version.js +15 -0
- package/bin/actions.js +40 -0
- package/bin/commands.js +11 -0
- package/bin/constants.js +9 -0
- package/bin/defaults.js +5 -1
- package/bin/main.js +3 -43
- package/bin/options.js +6 -4
- package/bin/utilities/fileSystem.js +5 -4
- package/bin/utilities/packageJSON.js +26 -0
- package/lib/utilities/string.js +3 -2
- package/package.json +5 -2
- package/src/utilities/string.js +5 -1
- package/verify.js +11 -6
package/bin/abbreviations.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const { HELP_OPTION, VERSION_OPTION, LOG_LEVEL_OPTION } = require("./options");
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const h = HELP_OPTION,
|
|
6
|
+
v = VERSION_OPTION,
|
|
7
|
+
l = LOG_LEVEL_OPTION
|
|
7
8
|
|
|
8
9
|
module.exports = {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
h,
|
|
11
|
+
v,
|
|
12
|
+
l
|
|
11
13
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function helpAction() {
|
|
4
|
+
console.log(`Usage:
|
|
5
|
+
|
|
6
|
+
verify [<options>] [<argument>] Verify the specified project
|
|
7
|
+
|
|
8
|
+
verify [<command>] [<options>] [<argument>]
|
|
9
|
+
|
|
10
|
+
Commands:
|
|
11
|
+
|
|
12
|
+
version Show the version
|
|
13
|
+
|
|
14
|
+
help Show this help
|
|
15
|
+
|
|
16
|
+
Options:
|
|
17
|
+
|
|
18
|
+
--help|-h Show this help
|
|
19
|
+
|
|
20
|
+
--version|-v Show the version
|
|
21
|
+
|
|
22
|
+
--log-level|-l Set the log level when publishing
|
|
23
|
+
|
|
24
|
+
Further information:
|
|
25
|
+
|
|
26
|
+
Please see the readme file on GitHub:
|
|
27
|
+
|
|
28
|
+
https://github.com/djalbat/occam-verify-cli
|
|
29
|
+
`);
|
|
30
|
+
|
|
31
|
+
process.exit();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = helpAction;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { loggingUtilities } = require("necessary"),
|
|
4
|
+
{ verifyRelease, releaseContextUtilities } = require("../../lib/index");
|
|
5
|
+
|
|
6
|
+
const { releaseContextFromReleaseNameAndShortenedVersion } = require("../utilities/fileSystem");
|
|
7
|
+
|
|
8
|
+
const { log } = loggingUtilities,
|
|
9
|
+
{ setLogLevel } = log,
|
|
10
|
+
{ createReleaseContext, initialiseReleaseContexts } = releaseContextUtilities;
|
|
11
|
+
|
|
12
|
+
function verifyAction(argument, logLevel) {
|
|
13
|
+
const releaseName = argument, ///
|
|
14
|
+
releaseContextMap = {},
|
|
15
|
+
shortenedVersion = null,
|
|
16
|
+
dependentNames = [],
|
|
17
|
+
context = {
|
|
18
|
+
log,
|
|
19
|
+
releaseContextMap,
|
|
20
|
+
releaseContextFromReleaseNameAndShortenedVersion
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
setLogLevel(logLevel);
|
|
24
|
+
|
|
25
|
+
createReleaseContext(releaseName, dependentNames, shortenedVersion, context, (error) => {
|
|
26
|
+
if (error) {
|
|
27
|
+
///
|
|
28
|
+
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
initialiseReleaseContexts(releaseName, releaseContextMap);
|
|
33
|
+
|
|
34
|
+
const releaseVerified = verifyRelease(releaseName, releaseContextMap);
|
|
35
|
+
|
|
36
|
+
if (releaseVerified) {
|
|
37
|
+
const releaseContext = releaseContextMap[releaseName];
|
|
38
|
+
|
|
39
|
+
releaseContext.toJSON();
|
|
40
|
+
|
|
41
|
+
///
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module.exports = verifyAction;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { VERIFY_CLI } = require("../constants"),
|
|
4
|
+
{ getPackageVersion } = require("../utilities/packageJSON");
|
|
5
|
+
|
|
6
|
+
function versionAction() {
|
|
7
|
+
const packageVersion = getPackageVersion(),
|
|
8
|
+
version = packageVersion; ///
|
|
9
|
+
|
|
10
|
+
console.log(`${VERIFY_CLI} version ${version}`);
|
|
11
|
+
|
|
12
|
+
process.exit();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = versionAction;
|
package/bin/actions.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const helpAction = require("./action/help"),
|
|
4
|
+
verifyAction = require("./action/verify"),
|
|
5
|
+
versionAction = require("./action/version");
|
|
6
|
+
|
|
7
|
+
const { DEFAULT_HELP, DEFAULT_VERSION, DEFAULT_LOG_LEVEL } = require("./defaults"),
|
|
8
|
+
{ HELP_COMMAND,
|
|
9
|
+
VERIFY_COMMAND,
|
|
10
|
+
VERSION_COMMAND } = require("./commands");
|
|
11
|
+
|
|
12
|
+
function actions(command, argument, options) {
|
|
13
|
+
const commandMissing = (command === null),
|
|
14
|
+
{ help = DEFAULT_HELP,
|
|
15
|
+
version = DEFAULT_VERSION,
|
|
16
|
+
logLevel = DEFAULT_LOG_LEVEL } = options;
|
|
17
|
+
|
|
18
|
+
if (false) {
|
|
19
|
+
///
|
|
20
|
+
} else if (help) {
|
|
21
|
+
command = HELP_COMMAND;
|
|
22
|
+
} else if (version) {
|
|
23
|
+
command = VERSION_COMMAND;
|
|
24
|
+
} else if (commandMissing) {
|
|
25
|
+
command = HELP_COMMAND;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
switch (command) {
|
|
29
|
+
case HELP_COMMAND : helpAction(); break;
|
|
30
|
+
case VERIFY_COMMAND : verifyAction(argument, logLevel); break;
|
|
31
|
+
case VERSION_COMMAND : versionAction(); break;
|
|
32
|
+
|
|
33
|
+
default:
|
|
34
|
+
argument = command; ///
|
|
35
|
+
|
|
36
|
+
verifyAction(argument, logLevel);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = actions;
|
package/bin/commands.js
ADDED
package/bin/constants.js
ADDED
package/bin/defaults.js
CHANGED
|
@@ -4,8 +4,12 @@ const { levels } = require("necessary");
|
|
|
4
4
|
|
|
5
5
|
const { INFO_LEVEL } = levels;
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const DEFAULT_HELP = false,
|
|
8
|
+
DEFAULT_VERSION = false,
|
|
9
|
+
DEFAULT_LOG_LEVEL = INFO_LEVEL;
|
|
8
10
|
|
|
9
11
|
module.exports = {
|
|
12
|
+
DEFAULT_HELP,
|
|
13
|
+
DEFAULT_VERSION,
|
|
10
14
|
DEFAULT_LOG_LEVEL
|
|
11
15
|
};
|
package/bin/main.js
CHANGED
|
@@ -1,49 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
{ verifyRelease, releaseContextUtilities } = require("../lib/index");
|
|
3
|
+
const actions = require("./actions");
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const { log } = loggingUtilities,
|
|
10
|
-
{ first } = arrayUtilities,
|
|
11
|
-
{ setLogLevel } = log,
|
|
12
|
-
{ createReleaseContext, initialiseReleaseContexts } = releaseContextUtilities;
|
|
13
|
-
|
|
14
|
-
function main(commands, options) {
|
|
15
|
-
const firstCommand = first(commands),
|
|
16
|
-
{ logLevel = DEFAULT_LOG_LEVEL, releaseName = firstCommand } = options, ///
|
|
17
|
-
releaseContextMap = {},
|
|
18
|
-
shortenedVersion = null,
|
|
19
|
-
dependentNames = [],
|
|
20
|
-
context = {
|
|
21
|
-
log,
|
|
22
|
-
releaseContextMap,
|
|
23
|
-
releaseContextFromReleaseNameAndShortenedVersion
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
setLogLevel(logLevel);
|
|
27
|
-
|
|
28
|
-
createReleaseContext(releaseName, dependentNames, shortenedVersion, context, (error) => {
|
|
29
|
-
if (error) {
|
|
30
|
-
///
|
|
31
|
-
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
initialiseReleaseContexts(releaseName, releaseContextMap);
|
|
36
|
-
|
|
37
|
-
const releaseVerified = verifyRelease(releaseName, releaseContextMap);
|
|
38
|
-
|
|
39
|
-
if (releaseVerified) {
|
|
40
|
-
const releaseContext = releaseContextMap[releaseName];
|
|
41
|
-
|
|
42
|
-
releaseContext.toJSON();
|
|
43
|
-
|
|
44
|
-
///
|
|
45
|
-
}
|
|
46
|
-
});
|
|
5
|
+
function main(command, argument, options) {
|
|
6
|
+
actions(command, argument, options);
|
|
47
7
|
}
|
|
48
8
|
|
|
49
9
|
module.exports = main;
|
package/bin/options.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
3
|
+
const HELP_OPTION = "help",
|
|
4
|
+
VERSION_OPTION = "version",
|
|
5
|
+
LOG_LEVEL_OPTION = "log-level";
|
|
5
6
|
|
|
6
7
|
module.exports = {
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
HELP_OPTION,
|
|
9
|
+
VERSION_OPTION,
|
|
10
|
+
LOG_LEVEL_OPTION
|
|
9
11
|
};
|
|
@@ -18,7 +18,7 @@ function releaseContextFromReleaseNameAndShortenedVersion(releaseName, shortened
|
|
|
18
18
|
|
|
19
19
|
try {
|
|
20
20
|
releaseContext = entryFile ?
|
|
21
|
-
|
|
21
|
+
fileReleaseContextFromReleaseNameAndProjectsDirectoryPath(releaseName, projectsDirectoryPath, context) :
|
|
22
22
|
directoryReleaseContextFromReleaseNameAndProjectsDirectoryPath(releaseName, projectsDirectoryPath, context);
|
|
23
23
|
} catch (error) {
|
|
24
24
|
const releaseContext = null;
|
|
@@ -43,11 +43,11 @@ module.exports = {
|
|
|
43
43
|
releaseContextFromReleaseNameAndShortenedVersion
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
function
|
|
46
|
+
function fileReleaseContextFromReleaseNameAndProjectsDirectoryPath(releaseName, projectsDirectoryPath, context) {
|
|
47
47
|
let releaseContext;
|
|
48
48
|
|
|
49
49
|
const { log } = context,
|
|
50
|
-
filePath =
|
|
50
|
+
filePath = `${projectsDirectoryPath}/${releaseName}`,
|
|
51
51
|
content = readFile(filePath),
|
|
52
52
|
releaseJSONString = content, ///
|
|
53
53
|
releaseJSON = JSON.parse(releaseJSONString);
|
|
@@ -62,7 +62,8 @@ function fileReleaseContextFromEntryPath(entryPath, context) {
|
|
|
62
62
|
|
|
63
63
|
entries = Entries.fromJSON(json);
|
|
64
64
|
|
|
65
|
-
const
|
|
65
|
+
const name = releaseName, ///
|
|
66
|
+
fileReleaseContext = FileReleaseContext.fromLogNameEntriesCallbacksAndContextJSON(log, name, entries, callbacks, contextJSON);
|
|
66
67
|
|
|
67
68
|
releaseContext = fileReleaseContext; ///
|
|
68
69
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { arrayUtilities, fileSystemUtilities } = require("necessary");
|
|
4
|
+
|
|
5
|
+
const { PACKAGE_JSON } = require("../constants");
|
|
6
|
+
|
|
7
|
+
const { second } = arrayUtilities,
|
|
8
|
+
{ readFile } = fileSystemUtilities;
|
|
9
|
+
|
|
10
|
+
const utilitiesDirectoryName = __dirname, ///
|
|
11
|
+
matches = utilitiesDirectoryName.match(/^(.+)\/bin\/utilities$/),
|
|
12
|
+
secondMatch = second(matches),
|
|
13
|
+
applicationDirectoryName = secondMatch, ///
|
|
14
|
+
packageJSONFilePath = `${applicationDirectoryName}/${PACKAGE_JSON}`,
|
|
15
|
+
packageJSONFile = readFile(packageJSONFilePath),
|
|
16
|
+
packageJSON = JSON.parse(packageJSONFile),
|
|
17
|
+
{ version } = packageJSON,
|
|
18
|
+
packageVersion = version; ///
|
|
19
|
+
|
|
20
|
+
function getPackageVersion() {
|
|
21
|
+
return packageVersion;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = {
|
|
25
|
+
getPackageVersion
|
|
26
|
+
};
|
package/lib/utilities/string.js
CHANGED
|
@@ -27,7 +27,8 @@ function nodeAsString(node) {
|
|
|
27
27
|
} else {
|
|
28
28
|
var nonTerminalNode = node, childNodes = nonTerminalNode.getChildNodes();
|
|
29
29
|
childNodes.forEach(function(childNode) {
|
|
30
|
-
|
|
30
|
+
var nodeString = nodeAsString(childNode);
|
|
31
|
+
string = string === null ? nodeString : "".concat(string).concat(nodeString);
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
}
|
|
@@ -46,4 +47,4 @@ function nodesAsString(nodes) {
|
|
|
46
47
|
return string;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
50
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvc3RyaW5nLmpzIl0sInNvdXJjZXNDb250ZW50IjpbIlwidXNlIHN0cmljdFwiO1xuXG5pbXBvcnQgeyBDT01NQSB9IGZyb20gXCIuLi9jb25zdGFudHNcIjtcblxuZXhwb3J0IGZ1bmN0aW9uIG5vZGVBc1N0cmluZyhub2RlKSB7XG4gIGxldCBzdHJpbmcgPSBudWxsO1xuXG4gIGlmIChub2RlICE9PSBudWxsKSB7XG4gICAgY29uc3Qgbm9kZVRlcm1pbmFsTm9kZSA9IG5vZGUuaXNUZXJtaW5hbE5vZGUoKTtcblxuICAgIGlmIChub2Rl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UFTWSxNQUFNQyxNQUFNLENBQUMsU0FBQ2IsUUFBUUQsTUFBUztRQUM1QyxJQUFNWSxhQUFhZCxhQUFhRTtRQUVoQyxJQUFJQyxXQUFXLElBQUksRUFBRTtZQUNuQkEsU0FBU1csWUFBYSxHQUFHO1FBQzNCLE9BQU87WUFDTFgsU0FBUyxBQUFDLEdBQVdjLE9BQVRkLFFBQWlCVyxPQUFSRyxnQkFBSyxFQUFjLE9BQVhIO1FBQy9CLENBQUM7UUFFRCxPQUFPWDtJQUNULEdBQUcsSUFBSTtJQUVQLE9BQU9BO0FBQ1QifQ==
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "occam-verify-cli",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.385",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/occam-verify-cli",
|
|
7
7
|
"description": "Occam's Verifier",
|
|
@@ -33,5 +33,8 @@
|
|
|
33
33
|
"watch": "npm run clean && npm run batch && npm run incremental",
|
|
34
34
|
"watch-debug": "npm run clean && npm run batch-debug && npm run incremental-debug"
|
|
35
35
|
},
|
|
36
|
-
"main": "./lib/index.js"
|
|
36
|
+
"main": "./lib/index.js",
|
|
37
|
+
"bin": {
|
|
38
|
+
"verify": "./verify.js"
|
|
39
|
+
}
|
|
37
40
|
}
|
package/src/utilities/string.js
CHANGED
|
@@ -18,7 +18,11 @@ export function nodeAsString(node) {
|
|
|
18
18
|
childNodes = nonTerminalNode.getChildNodes();
|
|
19
19
|
|
|
20
20
|
childNodes.forEach((childNode) => {
|
|
21
|
-
|
|
21
|
+
const nodeString = nodeAsString(childNode);
|
|
22
|
+
|
|
23
|
+
string = (string === null) ?
|
|
24
|
+
nodeString : ///
|
|
25
|
+
`${string}${nodeString}`;
|
|
22
26
|
});
|
|
23
27
|
}
|
|
24
28
|
}
|
package/verify.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const { parseArgv } = require("argumentative"),
|
|
4
|
+
{ arrayUtilities } = require("necessary");
|
|
4
5
|
|
|
5
|
-
const main = require(
|
|
6
|
-
abbreviations = require(
|
|
6
|
+
const main = require("./bin/main"),
|
|
7
|
+
abbreviations = require("./bin/abbreviations");
|
|
7
8
|
|
|
8
9
|
const { argv } = process,
|
|
9
|
-
{
|
|
10
|
+
{ first, second } = arrayUtilities;
|
|
10
11
|
|
|
11
|
-
const {
|
|
12
|
+
const { commands, options } = parseArgv(argv, abbreviations),
|
|
13
|
+
firstCommand = first(commands),
|
|
14
|
+
secondCommand = second(commands),
|
|
15
|
+
command = firstCommand || null, ///
|
|
16
|
+
argument = secondCommand || null; ///
|
|
12
17
|
|
|
13
|
-
main(
|
|
18
|
+
main(command, argument, options);
|