occam-open-cli 6.0.22 → 6.0.23
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/configuration/version_5_0.js +1 -18
- package/bin/configuration.js +13 -33
- package/bin/post.js +8 -20
- package/bin/versions.js +3 -7
- package/package.json +2 -2
- package/bin/configuration/version_1_5.js +0 -36
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const { HOST_URL } = require("../constants"),
|
|
4
|
-
{ VERSION_5_0 } = require("../versions")
|
|
5
|
-
{ DEFAULT_HOST } = require("../defaults");
|
|
6
|
-
|
|
7
|
-
function createConfiguration() {
|
|
8
|
-
const version = VERSION_5_0,
|
|
9
|
-
host = DEFAULT_HOST,
|
|
10
|
-
options = {},
|
|
11
|
-
identityToken = null,
|
|
12
|
-
configuration = {
|
|
13
|
-
version,
|
|
14
|
-
host,
|
|
15
|
-
options,
|
|
16
|
-
identityToken
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return configuration;
|
|
20
|
-
}
|
|
4
|
+
{ VERSION_5_0 } = require("../versions");
|
|
21
5
|
|
|
22
6
|
function migrateConfigurationToVersion_5_0(configuration) {
|
|
23
7
|
const { hostURL } = configuration,
|
|
@@ -37,6 +21,5 @@ function migrateConfigurationToVersion_5_0(configuration) {
|
|
|
37
21
|
}
|
|
38
22
|
|
|
39
23
|
module.exports = {
|
|
40
|
-
createConfiguration,
|
|
41
24
|
migrateConfigurationToVersion_5_0
|
|
42
25
|
};
|
package/bin/configuration.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const { configurationUtilities } = require("necessary");
|
|
3
|
+
const { versionUtilities, configurationUtilities } = require("necessary");
|
|
4
4
|
|
|
5
5
|
const { OPEN } = require("./constants"),
|
|
6
|
-
{
|
|
6
|
+
{ createConfiguration } = require("./configuration/version_5_1"),
|
|
7
7
|
{ migrateConfigurationToVersion_2_0 } = require("./configuration/version_2_0"),
|
|
8
8
|
{ migrateConfigurationToVersion_5_0 } = require("./configuration/version_5_0"),
|
|
9
|
+
{ migrateConfigurationToVersion_5_1 } = require("./configuration/version_5_1"),
|
|
9
10
|
{ CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE } = require("./messages"),
|
|
10
|
-
{
|
|
11
|
-
{ UNVERSIONED, VERSION_1_5, VERSION_2_0, VERSION_5_0, CURRENT_VERSION } = require("./versions");
|
|
11
|
+
{ VERSION_1_5, VERSION_2_0, VERSION_5_0, VERSION_5_1 } = require("./versions");
|
|
12
12
|
|
|
13
13
|
const { rc } = configurationUtilities,
|
|
14
|
+
{ migrate } = versionUtilities,
|
|
14
15
|
{ setRCBaseExtension, checkRCFileExists, updateRCFile, writeRCFile, readRCFile } = rc;
|
|
15
16
|
|
|
16
17
|
const rcBaseExtension = OPEN;
|
|
@@ -75,37 +76,16 @@ function createConfigurationFile() {
|
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
function migrateConfigurationFile() {
|
|
78
|
-
let json = readRCFile()
|
|
79
|
-
configuration = json, ///
|
|
80
|
-
{ version = UNVERSIONED } = configuration;
|
|
79
|
+
let json = readRCFile();
|
|
81
80
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
const migrationMap = {
|
|
82
|
+
[ VERSION_1_5 ]: migrateConfigurationToVersion_2_0,
|
|
83
|
+
[ VERSION_2_0 ]: migrateConfigurationToVersion_5_0,
|
|
84
|
+
[ VERSION_5_0 ] :migrateConfigurationToVersion_5_1
|
|
85
|
+
},
|
|
86
|
+
latestVersion = VERSION_5_1;
|
|
86
87
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
case VERSION_1_5 :
|
|
90
|
-
configuration = migrateConfigurationToVersion_2_0(configuration);
|
|
91
|
-
|
|
92
|
-
break;
|
|
93
|
-
|
|
94
|
-
case VERSION_2_0 :
|
|
95
|
-
configuration = migrateConfigurationToVersion_5_0(configuration);
|
|
96
|
-
|
|
97
|
-
break;
|
|
98
|
-
|
|
99
|
-
case VERSION_5_0 :
|
|
100
|
-
configuration = migrateConfigurationToVersion_5_1(configuration);
|
|
101
|
-
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
({ version } = configuration);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
json = configuration; ///
|
|
88
|
+
json = migrate(json, migrationMap, latestVersion);
|
|
109
89
|
|
|
110
90
|
writeRCFile(json);
|
|
111
91
|
}
|
package/bin/post.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const { Readable } = require("stream"),
|
|
4
|
-
{ headers, contentTypes, statusCodes, requestUtilities } = require("necessary");
|
|
4
|
+
{ headers, contentTypes, statusCodes, requestUtilities, packageUtilities } = require("necessary");
|
|
5
5
|
|
|
6
6
|
const { retrieveHost } = require("./configuration"),
|
|
7
|
-
{ getPackageVersion } = require("./utilities/packageJSON"),
|
|
8
7
|
{ contentFromResponse } = require("./utilities/response"),
|
|
9
8
|
{ statusMessageFromStatusCode } = require("./utilities/status"),
|
|
10
9
|
{ SERVER_FAILED_TO_RESPOND_ERROR_MESSAGE } = require("./messages");
|
|
11
10
|
|
|
12
|
-
const {
|
|
11
|
+
const { getVersion } = packageUtilities,
|
|
12
|
+
{ createPostRequest } = requestUtilities,
|
|
13
13
|
{ OK_200_STATUS_CODE } = statusCodes,
|
|
14
14
|
{ CONTENT_TYPE_HEADER } = headers,
|
|
15
15
|
{ APPLICATION_JSON_CHARSET_UTF_8_CONTENT_TYPE } = contentTypes;
|
|
@@ -17,9 +17,12 @@ const { createPostRequest } = requestUtilities,
|
|
|
17
17
|
function post(uri, json, callback) {
|
|
18
18
|
const host = retrieveHost(),
|
|
19
19
|
query = {},
|
|
20
|
-
headers =
|
|
20
|
+
headers = {
|
|
21
|
+
[ CONTENT_TYPE_HEADER ]: APPLICATION_JSON_CHARSET_UTF_8_CONTENT_TYPE
|
|
22
|
+
},
|
|
23
|
+
version = getVersion(),
|
|
21
24
|
content = JSON.stringify(json), ///
|
|
22
|
-
versionString =
|
|
25
|
+
versionString = version; ///
|
|
23
26
|
|
|
24
27
|
Object.assign(json, {
|
|
25
28
|
versionString
|
|
@@ -67,18 +70,3 @@ function post(uri, json, callback) {
|
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
module.exports = post;
|
|
70
|
-
|
|
71
|
-
function getHeaders() {
|
|
72
|
-
const headers = {};
|
|
73
|
-
|
|
74
|
-
headers[CONTENT_TYPE_HEADER] = APPLICATION_JSON_CHARSET_UTF_8_CONTENT_TYPE;
|
|
75
|
-
|
|
76
|
-
return headers;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function getVersionString() {
|
|
80
|
-
const packageVersion = getPackageVersion(),
|
|
81
|
-
versionString = packageVersion; ///
|
|
82
|
-
|
|
83
|
-
return versionString;
|
|
84
|
-
}
|
package/bin/versions.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
VERSION_1_5 = "1.5",
|
|
3
|
+
const VERSION_1_5 = "1.5",
|
|
5
4
|
VERSION_2_0 = "2.0",
|
|
6
5
|
VERSION_5_0 = "5.0",
|
|
7
|
-
VERSION_5_1 = "5.1"
|
|
8
|
-
CURRENT_VERSION = VERSION_5_1; ///
|
|
6
|
+
VERSION_5_1 = "5.1";
|
|
9
7
|
|
|
10
8
|
module.exports = {
|
|
11
|
-
UNVERSIONED,
|
|
12
9
|
VERSION_1_5,
|
|
13
10
|
VERSION_2_0,
|
|
14
11
|
VERSION_5_0,
|
|
15
|
-
VERSION_5_1
|
|
16
|
-
CURRENT_VERSION
|
|
12
|
+
VERSION_5_1
|
|
17
13
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "occam-open-cli",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "6.0.
|
|
4
|
+
"version": "6.0.23",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/occam-open-cli",
|
|
7
7
|
"description": "Occam's command line package management tool.",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"argumentative": "^2.0.21",
|
|
14
|
-
"necessary": "^11.
|
|
14
|
+
"necessary": "^11.9.0",
|
|
15
15
|
"occam-file-system": "^5.0.240"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {},
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { VERSION_1_5 } = require("../versions"),
|
|
4
|
-
{ DEFAULT_GITHUB_HOST_NAME } = require("../defaults");
|
|
5
|
-
|
|
6
|
-
function migrateConfigurationToVersion_1_5(configuration) {
|
|
7
|
-
let { options } = configuration;
|
|
8
|
-
|
|
9
|
-
const version = VERSION_1_5, ///
|
|
10
|
-
{ useSSH, hostURL, hostNameSuffix } = options;
|
|
11
|
-
|
|
12
|
-
options = {};
|
|
13
|
-
|
|
14
|
-
if (useSSH) {
|
|
15
|
-
const gitHubHostName = `${DEFAULT_GITHUB_HOST_NAME}${hostNameSuffix}`,
|
|
16
|
-
ssh = {
|
|
17
|
-
gitHubHostName
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
Object.assign(options, {
|
|
21
|
-
ssh
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
configuration = {
|
|
26
|
-
version,
|
|
27
|
-
options,
|
|
28
|
-
hostURL
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return configuration;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
module.exports = {
|
|
35
|
-
migrateConfigurationToVersion_1_5
|
|
36
|
-
};
|