occam-verify-cli 0.0.540 → 0.0.542
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/action/verify.js +4 -8
- package/bin/utilities/releaseContext.js +32 -42
- package/lib/context/file.js +72 -73
- package/lib/context/release.js +22 -16
- package/lib/index.js +1 -9
- package/lib/metaType.js +9 -7
- package/lib/metavariable.js +31 -6
- package/lib/type.js +8 -8
- package/lib/utilities/node.js +16 -2
- package/lib/utilities/releaseContext.js +8 -7
- package/lib/variable.js +31 -6
- package/lib/verify/file.js +2 -2
- package/package.json +1 -1
- package/src/context/file.js +13 -14
- package/src/context/release.js +26 -15
- package/src/index.js +0 -2
- package/src/metaType.js +8 -5
- package/src/metavariable.js +35 -3
- package/src/type.js +8 -8
- package/src/utilities/node.js +25 -0
- package/src/utilities/releaseContext.js +6 -4
- package/src/variable.js +34 -2
- package/src/verify/file.js +1 -1
package/bin/action/verify.js
CHANGED
|
@@ -4,7 +4,7 @@ const { Dependency } = require("occam-file-system"),
|
|
|
4
4
|
{ verifyRelease, releaseContextUtilities } = require("../../lib/index"); ///
|
|
5
5
|
|
|
6
6
|
const { trimTrailingSlash } = require("../utilities/string"),
|
|
7
|
-
{
|
|
7
|
+
{ releaseContextFromDependency } = require("../utilities/releaseContext");
|
|
8
8
|
|
|
9
9
|
const { createReleaseContext, initialiseReleaseContext } = releaseContextUtilities;
|
|
10
10
|
|
|
@@ -18,7 +18,7 @@ function verifyAction(argument, log) {
|
|
|
18
18
|
Object.assign(context, {
|
|
19
19
|
log,
|
|
20
20
|
releaseContextMap,
|
|
21
|
-
|
|
21
|
+
releaseContextFromDependency
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
createReleaseContext(dependency, dependentNames, context, (error) => {
|
|
@@ -41,13 +41,9 @@ function verifyAction(argument, log) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
delete context.releaseContextMap;
|
|
44
|
-
delete context.
|
|
44
|
+
delete context.releaseContextFromDependency;
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (releaseVerified) {
|
|
49
|
-
releaseContext.toJSON();
|
|
50
|
-
}
|
|
46
|
+
verifyRelease(releaseName, releaseContextMap);
|
|
51
47
|
});
|
|
52
48
|
});
|
|
53
49
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const { ReleaseContext } = require("../../lib/index"), ///
|
|
4
4
|
{ Entries, fileSystemUtilities : occamFileSystemUtilities } = require("occam-file-system"),
|
|
5
5
|
{ pathUtilities, fileSystemUtilities : necessaryFileSystemUtilities } = require("necessary");
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ const { loadProject } = occamFileSystemUtilities,
|
|
|
8
8
|
{ concatenatePaths } = pathUtilities,
|
|
9
9
|
{ readFile, isEntryFile, checkEntryExists } = necessaryFileSystemUtilities;
|
|
10
10
|
|
|
11
|
-
function
|
|
11
|
+
function releaseContextFromDependency(dependency, dependentNames, context, callback) {
|
|
12
12
|
const projectsDirectoryPath = process.cwd(), ///
|
|
13
13
|
dependencyName = dependency.getName(),
|
|
14
14
|
entryPath = concatenatePaths(projectsDirectoryPath, dependencyName),
|
|
@@ -25,15 +25,27 @@ function releaseContextFromDependencyAndDependentNames(dependency, dependentName
|
|
|
25
25
|
|
|
26
26
|
const entryFile = isEntryFile(entryPath);
|
|
27
27
|
|
|
28
|
-
let releaseContext;
|
|
28
|
+
let releaseContext = null;
|
|
29
29
|
|
|
30
30
|
try {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const { log } = context;
|
|
32
|
+
|
|
33
|
+
if (entryFile) {
|
|
34
|
+
const filePath = entryPath, ///
|
|
35
|
+
content = readFile(filePath),
|
|
36
|
+
jsonString = content, ///
|
|
37
|
+
json = JSON.parse(jsonString);
|
|
38
|
+
|
|
39
|
+
releaseContext = releaseContextFromLogAndJSON(log, json);
|
|
40
|
+
} else {
|
|
41
|
+
const projectName = dependencyName, ///
|
|
42
|
+
project = loadProject(projectName, projectsDirectoryPath);
|
|
43
|
+
|
|
44
|
+
if (project !== null) {
|
|
45
|
+
releaseContext = releaseContextFromLogAndProject(log, project);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
34
48
|
} catch (error) {
|
|
35
|
-
const releaseContext = null;
|
|
36
|
-
|
|
37
49
|
callback(error, releaseContext);
|
|
38
50
|
|
|
39
51
|
return;
|
|
@@ -45,52 +57,30 @@ function releaseContextFromDependencyAndDependentNames(dependency, dependentName
|
|
|
45
57
|
}
|
|
46
58
|
|
|
47
59
|
module.exports = {
|
|
48
|
-
|
|
60
|
+
releaseContextFromDependency
|
|
49
61
|
};
|
|
50
62
|
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const { log } = context,
|
|
55
|
-
dependencyName = dependency.getName(),
|
|
56
|
-
filePath = concatenatePaths(projectsDirectoryPath, dependencyName),
|
|
57
|
-
content = readFile(filePath),
|
|
58
|
-
releaseJSONString = content, ///
|
|
59
|
-
releaseJSON = JSON.parse(releaseJSONString);
|
|
60
|
-
|
|
61
|
-
({ context } = releaseJSON);
|
|
62
|
-
|
|
63
|
-
const contextJSON = context; ///
|
|
63
|
+
function releaseContextFromLogAndJSON(log, json) {
|
|
64
|
+
const { name, context } = json;
|
|
64
65
|
|
|
65
|
-
let { entries } =
|
|
66
|
+
let { entries } = json;
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
json = entries; ///
|
|
68
69
|
|
|
69
70
|
entries = Entries.fromJSON(json);
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
fileReleaseContext = FileReleaseContext.fromLogNameEntriesAndContextJSON(log, name, entries, contextJSON);
|
|
72
|
+
json = context; ///
|
|
73
73
|
|
|
74
|
-
releaseContext =
|
|
74
|
+
const releaseContext = ReleaseContext.fromLogJSONNameAndEntries(log, json, name, entries);
|
|
75
75
|
|
|
76
76
|
return releaseContext;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
project = loadProject(projectName, projectsDirectoryPath);
|
|
85
|
-
|
|
86
|
-
if (project !== null) {
|
|
87
|
-
const { log } = context,
|
|
88
|
-
name = project.getName(),
|
|
89
|
-
entries = project.getEntries(),
|
|
90
|
-
directoryReleaseContext = DirectoryReleaseContext.fromLogNameAndEntries(log, name, entries);
|
|
91
|
-
|
|
92
|
-
releaseContext = directoryReleaseContext; ///
|
|
93
|
-
}
|
|
79
|
+
function releaseContextFromLogAndProject(log, project) {
|
|
80
|
+
const json = null,
|
|
81
|
+
name = project.getName(),
|
|
82
|
+
entries = project.getEntries(),
|
|
83
|
+
releaseContext = ReleaseContext.fromLogJSONNameAndEntries(log, json, name, entries);
|
|
94
84
|
|
|
95
85
|
return releaseContext;
|
|
96
86
|
}
|