occam-verify-cli 0.0.318 → 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 +60 -45
- package/package.json +2 -2
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,59 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
{ ReleaseContext } = require("../../lib/index"),
|
|
5
|
-
{ fileSystemUtilities } = require("occam-file-system");
|
|
3
|
+
const { ReleaseContext } = require("../../lib/index");
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
function createReleaseContext(connection, name, dependentNames, shortenedVersion, context, callback) {
|
|
6
|
+
const { releaseContextMap } = context,
|
|
7
|
+
releaseContext = releaseContextMap[name] || null;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
if (releaseContext !== null) {
|
|
10
|
+
const error = false;
|
|
11
|
+
|
|
12
|
+
callback(error);
|
|
13
|
+
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
11
16
|
|
|
12
|
-
const {
|
|
13
|
-
{ loadRelease } = fileSystemUtilities;
|
|
17
|
+
const { createRelease } = context;
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
createRelease(name, (release) => {
|
|
20
|
+
if (release === null) {
|
|
21
|
+
const error = true;
|
|
17
22
|
|
|
18
|
-
|
|
19
|
-
const release = createRelease(name);
|
|
23
|
+
callback(error);
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
releaseContext = ReleaseContext.fromLogReleaseAndCallbacks(log, release, callbacks);
|
|
25
|
+
return;
|
|
23
26
|
}
|
|
24
|
-
}
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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;
|
|
29
34
|
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
callback(error);
|
|
36
|
+
|
|
37
|
+
return;
|
|
32
38
|
}
|
|
33
|
-
}
|
|
34
39
|
|
|
35
|
-
|
|
40
|
+
createDependencyReleaseContexts(connection, releaseContext, dependentNames, context, (error) => {
|
|
41
|
+
if (!error) {
|
|
42
|
+
releaseContextMap[name] = releaseContext;
|
|
43
|
+
}
|
|
36
44
|
|
|
37
|
-
|
|
45
|
+
callback(error);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
38
48
|
}
|
|
39
49
|
|
|
40
50
|
module.exports = {
|
|
41
51
|
createReleaseContext
|
|
42
52
|
};
|
|
43
53
|
|
|
44
|
-
function createRelease(name) {
|
|
45
|
-
const topmostDirectoryName = name, ///
|
|
46
|
-
projectsDirectoryPath = PERIOD;
|
|
47
|
-
|
|
48
|
-
let release = loadRelease(topmostDirectoryName, projectsDirectoryPath);
|
|
49
|
-
|
|
50
|
-
if (release === null) {
|
|
51
|
-
log.error(`The '${name}' package cannot be loaded.`);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return release;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
54
|
function checkCyclicDependencyExists(name, dependentNames, releaseContext) {
|
|
58
55
|
const dependentNamesIncludesName = dependentNames.includes(name),
|
|
59
56
|
cyclicDependencyExists = dependentNamesIncludesName; ///
|
|
@@ -69,27 +66,45 @@ function checkCyclicDependencyExists(name, dependentNames, releaseContext) {
|
|
|
69
66
|
return cyclicDependencyExists;
|
|
70
67
|
}
|
|
71
68
|
|
|
72
|
-
function createDependencyReleaseContexts(
|
|
69
|
+
function createDependencyReleaseContexts(connection, releaseContext, dependentNames, context, callback) {
|
|
73
70
|
const name = releaseContext.getName(),
|
|
74
71
|
dependencies = releaseContext.getDependencies();
|
|
75
72
|
|
|
76
73
|
dependentNames = [ ...dependentNames, name ]; ///
|
|
77
74
|
|
|
78
|
-
|
|
75
|
+
dependencies.asynchronousForEachDependency(dependencies, (dependency, next, done) => {
|
|
79
76
|
const name = dependency.getName(),
|
|
80
77
|
shortenedVersion = dependency.getShortedVersion(),
|
|
81
78
|
cyclicDependencyExists = checkCyclicDependencyExists(name, dependentNames, releaseContext);
|
|
82
79
|
|
|
83
|
-
if (
|
|
84
|
-
|
|
80
|
+
if (cyclicDependencyExists) {
|
|
81
|
+
noError = false;
|
|
85
82
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
done();
|
|
84
|
+
|
|
85
|
+
return;
|
|
89
86
|
}
|
|
90
|
-
});
|
|
91
87
|
|
|
92
|
-
|
|
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
|
+
}
|
|
93
108
|
}
|
|
94
109
|
|
|
95
110
|
function checkReleaseMatchesShortenedVersion(releaseContext, shortenedVersion) {
|
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": {
|