occam-verify-cli 0.0.382 → 0.0.384
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/packageJSON.js +26 -0
- package/package.json +5 -2
- 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
|
};
|
|
@@ -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/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.384",
|
|
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/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);
|