occam-verify-cli 0.0.319 → 0.0.320
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/main.js +33 -6
- package/bin/utilities/release.js +85 -38
- package/lib/index.js +1 -5
- package/package.json +2 -2
- package/src/index.js +0 -2
- package/lib/utilities/verification.js +0 -45
- package/src/utilities/verification.js +0 -41
package/bin/main.js
CHANGED
|
@@ -1,22 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const { verifyRelease } = require("../lib/index"),
|
|
4
|
-
{ arrayUtilities } = require("necessary")
|
|
4
|
+
{ arrayUtilities } = require("necessary"),
|
|
5
|
+
{ fileSystemUtilities } = require("occam-file-system")
|
|
5
6
|
|
|
6
|
-
const
|
|
7
|
+
const callbacks = require("./callbacks");
|
|
7
8
|
|
|
8
|
-
const {
|
|
9
|
+
const { log } = require("./utilities/logging"),
|
|
10
|
+
{ PERIOD } = require("./constants"),
|
|
11
|
+
{ createReleaseContext } = require("./utilities/release");
|
|
12
|
+
|
|
13
|
+
const { first } = arrayUtilities,
|
|
14
|
+
{ loadRelease } = fileSystemUtilities;
|
|
9
15
|
|
|
10
16
|
function main(commands, options) {
|
|
11
17
|
const firstCommand = first(commands),
|
|
12
18
|
{ name = firstCommand } = options, ///
|
|
13
19
|
releaseContextMap = {},
|
|
14
20
|
shortenedVersion = null,
|
|
15
|
-
|
|
21
|
+
dependentNames = [],
|
|
22
|
+
connection = null, ///
|
|
23
|
+
context = {
|
|
24
|
+
log,
|
|
25
|
+
callbacks,
|
|
26
|
+
createRelease,
|
|
27
|
+
releaseContextMap
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
createReleaseContext(connection, name, dependentNames, shortenedVersion, context, (error) => {
|
|
31
|
+
if (error) {
|
|
32
|
+
///
|
|
33
|
+
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
16
36
|
|
|
17
|
-
if (releaseContext !== null) {
|
|
18
37
|
verifyRelease(name, releaseContextMap);
|
|
19
|
-
}
|
|
38
|
+
});
|
|
20
39
|
}
|
|
21
40
|
|
|
22
41
|
module.exports = main;
|
|
42
|
+
|
|
43
|
+
function createRelease(name, callback) {
|
|
44
|
+
const topmostDirectoryName = name, ///
|
|
45
|
+
projectsDirectoryPath = PERIOD, ///
|
|
46
|
+
release = loadRelease(topmostDirectoryName, projectsDirectoryPath);
|
|
47
|
+
|
|
48
|
+
callback(release);
|
|
49
|
+
}
|
package/bin/utilities/release.js
CHANGED
|
@@ -1,77 +1,124 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
{ ReleaseContext, verificationUtilities } = require("../../lib/index");
|
|
3
|
+
const { ReleaseContext } = require("../../lib/index");
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
function createReleaseContext(connection, name, dependentNames, shortenedVersion, context, callback) {
|
|
6
|
+
const { releaseContextMap } = context,
|
|
7
|
+
releaseContext = releaseContextMap[name] || null;
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
if (releaseContext !== null) {
|
|
10
|
+
const error = false;
|
|
11
|
+
|
|
12
|
+
callback(error);
|
|
13
|
+
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
10
16
|
|
|
11
|
-
const {
|
|
12
|
-
{ checkCyclicDependencyExists, checkReleaseMatchesShortenedVersion} = verificationUtilities;
|
|
17
|
+
const { createRelease } = context;
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
createRelease(name, (release) => {
|
|
20
|
+
if (release === null) {
|
|
21
|
+
const error = true;
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
const release = createRelease(name);
|
|
23
|
+
callback(error);
|
|
19
24
|
|
|
20
|
-
|
|
21
|
-
releaseContext = ReleaseContext.fromLogReleaseAndCallbacks(log, release, callbacks);
|
|
25
|
+
return;
|
|
22
26
|
}
|
|
23
|
-
}
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
const { log, callbacks } = context,
|
|
29
|
+
releaseContext = ReleaseContext.fromLogReleaseAndCallbacks(log, release, callbacks),
|
|
30
|
+
releaseMatchesShortedVersion = checkReleaseMatchesShortenedVersion(releaseContext, shortenedVersion);
|
|
31
|
+
|
|
32
|
+
if (!releaseMatchesShortedVersion) {
|
|
33
|
+
const error = true;
|
|
28
34
|
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
callback(error);
|
|
36
|
+
|
|
37
|
+
return;
|
|
31
38
|
}
|
|
32
|
-
}
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
createDependencyReleaseContexts(connection, releaseContext, dependentNames, context, (error) => {
|
|
41
|
+
if (!error) {
|
|
42
|
+
releaseContextMap[name] = releaseContext;
|
|
43
|
+
}
|
|
35
44
|
|
|
36
|
-
|
|
45
|
+
callback(error);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
37
48
|
}
|
|
38
49
|
|
|
39
50
|
module.exports = {
|
|
40
51
|
createReleaseContext
|
|
41
52
|
};
|
|
42
53
|
|
|
43
|
-
function
|
|
44
|
-
const
|
|
45
|
-
|
|
54
|
+
function checkCyclicDependencyExists(name, dependentNames, releaseContext) {
|
|
55
|
+
const dependentNamesIncludesName = dependentNames.includes(name),
|
|
56
|
+
cyclicDependencyExists = dependentNamesIncludesName; ///
|
|
46
57
|
|
|
47
|
-
|
|
58
|
+
if (cyclicDependencyExists) {
|
|
59
|
+
const firstDependentName = first(dependentNames),
|
|
60
|
+
dependencyNames = dependentNames.concat(firstDependentName),
|
|
61
|
+
dependencyNamesString = dependencyNames.join(`' -> '`);
|
|
48
62
|
|
|
49
|
-
|
|
50
|
-
log.error(`The '${name}' package cannot be loaded.`);
|
|
63
|
+
releaseContext.error(`There is a cyclic dependency: '${dependencyNamesString}'.`);
|
|
51
64
|
}
|
|
52
65
|
|
|
53
|
-
return
|
|
66
|
+
return cyclicDependencyExists;
|
|
54
67
|
}
|
|
55
68
|
|
|
56
|
-
function createDependencyReleaseContexts(
|
|
69
|
+
function createDependencyReleaseContexts(connection, releaseContext, dependentNames, context, callback) {
|
|
57
70
|
const name = releaseContext.getName(),
|
|
58
71
|
dependencies = releaseContext.getDependencies();
|
|
59
72
|
|
|
60
73
|
dependentNames = [ ...dependentNames, name ]; ///
|
|
61
74
|
|
|
62
|
-
|
|
75
|
+
dependencies.asynchronousForEachDependency(dependencies, (dependency, next, done) => {
|
|
63
76
|
const name = dependency.getName(),
|
|
64
77
|
shortenedVersion = dependency.getShortedVersion(),
|
|
65
78
|
cyclicDependencyExists = checkCyclicDependencyExists(name, dependentNames, releaseContext);
|
|
66
79
|
|
|
67
|
-
if (
|
|
68
|
-
|
|
80
|
+
if (cyclicDependencyExists) {
|
|
81
|
+
noError = false;
|
|
69
82
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
83
|
+
done();
|
|
84
|
+
|
|
85
|
+
return;
|
|
73
86
|
}
|
|
74
|
-
});
|
|
75
87
|
|
|
76
|
-
|
|
88
|
+
createReleaseContext(connection, name, dependentNames, shortenedVersion, context, (error) => {
|
|
89
|
+
if (error) {
|
|
90
|
+
noError = false;
|
|
91
|
+
|
|
92
|
+
done();
|
|
93
|
+
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
next();
|
|
98
|
+
});
|
|
99
|
+
}, done);
|
|
100
|
+
|
|
101
|
+
let noError = true;
|
|
102
|
+
|
|
103
|
+
function done() {
|
|
104
|
+
const error = !noError;
|
|
105
|
+
|
|
106
|
+
callback(error);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function checkReleaseMatchesShortenedVersion(releaseContext, shortenedVersion) {
|
|
111
|
+
const release = releaseContext.getRelease(),
|
|
112
|
+
releaseMatchesShortedVersion = release.matchShortenedVersion(shortenedVersion);
|
|
113
|
+
|
|
114
|
+
if (!releaseMatchesShortedVersion) {
|
|
115
|
+
const name = releaseContext.getName(),
|
|
116
|
+
version = releaseContext.getVersion(),
|
|
117
|
+
versionString = version.toString(),
|
|
118
|
+
shortenedVersionString = shortenedVersion.toString();
|
|
119
|
+
|
|
120
|
+
releaseContext.error(`The '${name}' package's version of ${versionString} does not match the dependency's shortened version of ${shortenedVersionString}.`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return releaseMatchesShortedVersion;
|
|
77
124
|
}
|
package/lib/index.js
CHANGED
|
@@ -17,19 +17,15 @@ _export(exports, {
|
|
|
17
17
|
},
|
|
18
18
|
ReleaseContext: function() {
|
|
19
19
|
return _release1.default;
|
|
20
|
-
},
|
|
21
|
-
verificationUtilities: function() {
|
|
22
|
-
return _verification.default;
|
|
23
20
|
}
|
|
24
21
|
});
|
|
25
22
|
var _callbacks = /*#__PURE__*/ _interopRequireDefault(require("./callbacks"));
|
|
26
23
|
var _release = /*#__PURE__*/ _interopRequireDefault(require("./verify/release"));
|
|
27
24
|
var _release1 = /*#__PURE__*/ _interopRequireDefault(require("./context/release"));
|
|
28
|
-
var _verification = /*#__PURE__*/ _interopRequireDefault(require("./utilities/verification"));
|
|
29
25
|
function _interopRequireDefault(obj) {
|
|
30
26
|
return obj && obj.__esModule ? obj : {
|
|
31
27
|
default: obj
|
|
32
28
|
};
|
|
33
29
|
}
|
|
34
30
|
|
|
35
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuZXhwb3J0IHsgZGVmYXVsdCBhcyBDYWxsYmFja3MgfSBmcm9tIFwiLi9jYWxsYmFja3NcIjtcbmV4cG9ydCB7IGRlZmF1bHQgYXMgdmVyaWZ5UmVsZWFzZSB9IGZyb20gXCIuL3ZlcmlmeS9yZWxlYXNlXCI7XG5leHBvcnQgeyBkZWZhdWx0IGFzIFJlbGVhc2VDb250ZXh0IH0gZnJvbSBcIi4vY29udGV4dC9yZWxlYXNlXCI7XG4iXSwibmFtZXMiOlsiQ2FsbGJhY2tzIiwidmVyaWZ5UmVsZWFzZSIsIlJlbGVhc2VDb250ZXh0Il0sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7SUFFb0JBLFNBQVM7ZUFBVEEsa0JBQVM7O0lBQ1RDLGFBQWE7ZUFBYkEsZ0JBQWE7O0lBQ2JDLGNBQWM7ZUFBZEEsaUJBQWM7Ozs4REFGRzs0REFDSTs2REFDQyJ9
|
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.320",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/occam-verify-cli",
|
|
7
7
|
"description": "Occam's Verifier",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"necessary": "^11.0.40",
|
|
15
15
|
"occam-custom-grammars": "^5.0.357",
|
|
16
16
|
"occam-dom": "^3.0.171",
|
|
17
|
-
"occam-file-system": "^5.0.
|
|
17
|
+
"occam-file-system": "^5.0.45",
|
|
18
18
|
"occam-grammar-utilities": "^7.0.66"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
package/src/index.js
CHANGED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
checkCyclicDependencyExists: function() {
|
|
13
|
-
return checkCyclicDependencyExists;
|
|
14
|
-
},
|
|
15
|
-
checkReleaseMatchesShortenedVersion: function() {
|
|
16
|
-
return checkReleaseMatchesShortenedVersion;
|
|
17
|
-
},
|
|
18
|
-
default: function() {
|
|
19
|
-
return _default;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
var _necessary = require("necessary");
|
|
23
|
-
var first = _necessary.arrayUtilities.first;
|
|
24
|
-
function checkCyclicDependencyExists(name, dependentNames, releaseContext) {
|
|
25
|
-
var dependentNamesIncludesName = dependentNames.includes(name), cyclicDependencyExists = dependentNamesIncludesName; ///
|
|
26
|
-
if (cyclicDependencyExists) {
|
|
27
|
-
var firstDependentName = first(dependentNames), dependencyNames = dependentNames.concat(firstDependentName), dependencyNamesString = dependencyNames.join("' -> '");
|
|
28
|
-
releaseContext.error("There is a cyclic dependency: '".concat(dependencyNamesString, "'."));
|
|
29
|
-
}
|
|
30
|
-
return cyclicDependencyExists;
|
|
31
|
-
}
|
|
32
|
-
function checkReleaseMatchesShortenedVersion(releaseContext, shortenedVersion) {
|
|
33
|
-
var release = releaseContext.getRelease(), releaseMatchesShortedVersion = release.matchShortenedVersion(shortenedVersion);
|
|
34
|
-
if (!releaseMatchesShortedVersion) {
|
|
35
|
-
var name = releaseContext.getName(), version = releaseContext.getVersion(), versionString = version.toString(), shortenedVersionString = shortenedVersion.toString();
|
|
36
|
-
releaseContext.error("The '".concat(name, "' package's version of ").concat(versionString, " does not match the dependency's shortened version of ").concat(shortenedVersionString, "."));
|
|
37
|
-
}
|
|
38
|
-
return releaseMatchesShortedVersion;
|
|
39
|
-
}
|
|
40
|
-
var _default = {
|
|
41
|
-
checkCyclicDependencyExists: checkCyclicDependencyExists,
|
|
42
|
-
checkReleaseMatchesShortenedVersion: checkReleaseMatchesShortenedVersion
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvdmVyaWZpY2F0aW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FLENBQUM7SUFFRCxPQUFPSjtBQUNUO0FBRU8sU0FBU1Isb0NBQW9DSyxjQUFjLEVBQUVVLGdCQUFnQixFQUFFO0lBQ3BGLElBQU1DLFVBQVVYLGVBQWVZLFVBQVUsSUFDbkNDLCtCQUErQkYsUUFBUUcscUJBQXFCLENBQUNKO0lBRW5FLElBQUksQ0FBQ0csOEJBQThCO1FBQ2pDLElBQU1mLE9BQU9FLGVBQWVlLE9BQU8sSUFDN0JDLFVBQVVoQixlQUFlaUIsVUFBVSxJQUNuQ0MsZ0JBQWdCRixRQUFRRyxRQUFRLElBQ2hDQyx5QkFBeUJWLGlCQUFpQlMsUUFBUTtRQUV4RG5CLGVBQWVTLEtBQUssQ0FBQyxBQUFDLFFBQXFDUyxPQUE5QnBCLE1BQUssMkJBQStGc0IsT0FBdEVGLGVBQWMsMERBQStFLE9BQXZCRSx3QkFBdUI7SUFDMUosQ0FBQztJQUVELE9BQU9QO0FBQ1Q7SUFFQSxXQUFlO0lBQ2JuQiw2QkFBQUE7SUFDQUMscUNBQUFBO0FBQ0YifQ==
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { arrayUtilities } from "necessary";
|
|
4
|
-
|
|
5
|
-
const { first } = arrayUtilities;
|
|
6
|
-
|
|
7
|
-
export function checkCyclicDependencyExists(name, dependentNames, releaseContext) {
|
|
8
|
-
const dependentNamesIncludesName = dependentNames.includes(name),
|
|
9
|
-
cyclicDependencyExists = dependentNamesIncludesName; ///
|
|
10
|
-
|
|
11
|
-
if (cyclicDependencyExists) {
|
|
12
|
-
const firstDependentName = first(dependentNames),
|
|
13
|
-
dependencyNames = dependentNames.concat(firstDependentName),
|
|
14
|
-
dependencyNamesString = dependencyNames.join(`' -> '`);
|
|
15
|
-
|
|
16
|
-
releaseContext.error(`There is a cyclic dependency: '${dependencyNamesString}'.`);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return cyclicDependencyExists;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function checkReleaseMatchesShortenedVersion(releaseContext, shortenedVersion) {
|
|
23
|
-
const release = releaseContext.getRelease(),
|
|
24
|
-
releaseMatchesShortedVersion = release.matchShortenedVersion(shortenedVersion);
|
|
25
|
-
|
|
26
|
-
if (!releaseMatchesShortedVersion) {
|
|
27
|
-
const name = releaseContext.getName(),
|
|
28
|
-
version = releaseContext.getVersion(),
|
|
29
|
-
versionString = version.toString(),
|
|
30
|
-
shortenedVersionString = shortenedVersion.toString();
|
|
31
|
-
|
|
32
|
-
releaseContext.error(`The '${name}' package's version of ${versionString} does not match the dependency's shortened version of ${shortenedVersionString}.`);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return releaseMatchesShortedVersion;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default {
|
|
39
|
-
checkCyclicDependencyExists,
|
|
40
|
-
checkReleaseMatchesShortenedVersion
|
|
41
|
-
};
|