occam-open-cli 6.0.171 → 6.0.173
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/clone.js +2 -3
- package/bin/action/createAccount.js +2 -3
- package/bin/action/open.js +2 -3
- package/bin/action/publish.js +2 -4
- package/bin/action/resetPassword.js +2 -3
- package/bin/action/signIn.js +2 -3
- package/bin/action/withdraw.js +2 -3
- package/bin/changeDirectory.js +37 -0
- package/bin/main.js +42 -24
- package/bin/messages.js +4 -2
- package/bin/prepare.js +44 -0
- package/bin/utilities/string.js +0 -7
- package/open.js +2 -2
- package/package.json +1 -1
- package/bin/configure.js +0 -77
package/bin/action/clone.js
CHANGED
|
@@ -8,9 +8,8 @@ const cloneOperation = require("../operation/clone"),
|
|
|
8
8
|
const { executeOperations } = require("../utilities/operation"),
|
|
9
9
|
{ SUCCESSFUL_CLONE_MESSAGE, FAILED_CLONE_MESSAGE } = require("../messages");
|
|
10
10
|
|
|
11
|
-
function cloneAction(
|
|
12
|
-
const
|
|
13
|
-
operations = [
|
|
11
|
+
function cloneAction(releaseName, quietly, yes, no) {
|
|
12
|
+
const operations = [
|
|
14
13
|
releaseNamePromptOperation,
|
|
15
14
|
cloneDependenciesPromptOperation,
|
|
16
15
|
cloneOperation,
|
|
@@ -8,9 +8,8 @@ const createAccountOperation = require("../operation/createAccount"),
|
|
|
8
8
|
|
|
9
9
|
const { executeOperations } = require("../utilities/operation");
|
|
10
10
|
|
|
11
|
-
function createAccountAction(
|
|
12
|
-
const
|
|
13
|
-
username = null,
|
|
11
|
+
function createAccountAction(emailAddress) {
|
|
12
|
+
const username = null,
|
|
14
13
|
password = null,
|
|
15
14
|
operations = [
|
|
16
15
|
emailAddressPromptOperation,
|
package/bin/action/open.js
CHANGED
|
@@ -7,9 +7,8 @@ const openOperation = require("../operation/open"),
|
|
|
7
7
|
const { executeOperations } = require("../utilities/operation"),
|
|
8
8
|
{ SUCCESSFUL_OPEN_MESSAGE, FAILED_OPEN_MESSAGE } = require("../messages");
|
|
9
9
|
|
|
10
|
-
function openAction(
|
|
11
|
-
const
|
|
12
|
-
operations = [
|
|
10
|
+
function openAction(releaseName, quietly, yes, no) {
|
|
11
|
+
const operations = [
|
|
13
12
|
releaseNamePromptOperation,
|
|
14
13
|
openOperation,
|
|
15
14
|
openReleasesOperation
|
package/bin/action/publish.js
CHANGED
|
@@ -9,13 +9,11 @@ const publishOperation = require("../operation/publish"),
|
|
|
9
9
|
updateMetaJSONFileVersionOperation = require("../operation/updateMetaJSONFileVersion");
|
|
10
10
|
|
|
11
11
|
const { DOUBLE_DASH } = require("../constants"),
|
|
12
|
-
{ trimTrailingSlash } = require("../utilities/string"),
|
|
13
12
|
{ executeOperations } = require("../utilities/operation"),
|
|
14
13
|
{ FAILED_PUBLISH_MESSAGE, SUCCESSFUL_PUBLISH_MESSAGE } = require("../messages");
|
|
15
14
|
|
|
16
|
-
function publishAction(
|
|
17
|
-
const
|
|
18
|
-
operations = [
|
|
15
|
+
function publishAction(releaseName, tail, follow, dryRun, logLevel) {
|
|
16
|
+
const operations = [
|
|
19
17
|
getIdentityTokenOperation,
|
|
20
18
|
releaseNamePromptOperation,
|
|
21
19
|
loadProjectOperation,
|
|
@@ -5,9 +5,8 @@ const resetPasswordOperation = require("../operation/resetPassword"),
|
|
|
5
5
|
|
|
6
6
|
const { executeOperations } = require("../utilities/operation");
|
|
7
7
|
|
|
8
|
-
function resetPasswordAction(
|
|
9
|
-
const
|
|
10
|
-
operations = [
|
|
8
|
+
function resetPasswordAction(emailAddress) {
|
|
9
|
+
const operations = [
|
|
11
10
|
emailAddressPromptOperation,
|
|
12
11
|
resetPasswordOperation
|
|
13
12
|
],
|
package/bin/action/signIn.js
CHANGED
|
@@ -7,9 +7,8 @@ const signInOperation = require("../operation/signIn"),
|
|
|
7
7
|
|
|
8
8
|
const { executeOperations } = require("../utilities/operation");
|
|
9
9
|
|
|
10
|
-
function signInAction(
|
|
11
|
-
const
|
|
12
|
-
password = null,
|
|
10
|
+
function signInAction(emailAddressOrUsername) {
|
|
11
|
+
const password = null,
|
|
13
12
|
operations = [
|
|
14
13
|
emailAddressOrUsernamePromptOperation,
|
|
15
14
|
passwordPromptOperation,
|
package/bin/action/withdraw.js
CHANGED
|
@@ -8,9 +8,8 @@ const withdrawOperation = require("../operation/withdraw"),
|
|
|
8
8
|
const { executeOperations } = require("../utilities/operation"),
|
|
9
9
|
{ FAILED_WITHDRAW_MESSAGE, SUCCESSFUL_WITHDRAW_MESSAGE } = require("../messages");
|
|
10
10
|
|
|
11
|
-
function withdrawAction(
|
|
12
|
-
const
|
|
13
|
-
password = null,
|
|
11
|
+
function withdrawAction(releaseName) {
|
|
12
|
+
const password = null,
|
|
14
13
|
operations = [
|
|
15
14
|
getIdentityTokenOperation,
|
|
16
15
|
releaseNamePromptOperation,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { pathUtilities } = require("necessary");
|
|
4
|
+
|
|
5
|
+
const { DOUBLE_DOTS } = require("./constants"),
|
|
6
|
+
{ migrateConfigurationFile, checkConfigurationFileExists } = require("./configuration");
|
|
7
|
+
|
|
8
|
+
const { bottommostNameFromPath } = pathUtilities;
|
|
9
|
+
|
|
10
|
+
function changeDirectory() {
|
|
11
|
+
let directoryName = null,
|
|
12
|
+
configurationFileExists = checkConfigurationFileExists();
|
|
13
|
+
|
|
14
|
+
if (!configurationFileExists) {
|
|
15
|
+
const currentWorkingDirectoryPath = process.cwd(); ///
|
|
16
|
+
|
|
17
|
+
process.chdir(DOUBLE_DOTS);
|
|
18
|
+
|
|
19
|
+
const oldCurrentWorkingDirectoryPath = currentWorkingDirectoryPath; ///
|
|
20
|
+
|
|
21
|
+
configurationFileExists = checkConfigurationFileExists();
|
|
22
|
+
|
|
23
|
+
if (configurationFileExists) {
|
|
24
|
+
const bottommostOldCurrentWorkingDirectoryName = bottommostNameFromPath(oldCurrentWorkingDirectoryPath);
|
|
25
|
+
|
|
26
|
+
directoryName = bottommostOldCurrentWorkingDirectoryName; ///
|
|
27
|
+
} else {
|
|
28
|
+
process.chdir(oldCurrentWorkingDirectoryPath);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
migrateConfigurationFile();
|
|
33
|
+
|
|
34
|
+
return directoryName;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = changeDirectory;
|
package/bin/main.js
CHANGED
|
@@ -14,7 +14,7 @@ const helpAction = require("./action/help"),
|
|
|
14
14
|
resetPasswordAction = require("./action/resetPassword"),
|
|
15
15
|
setShellCommandsAction = require("./action/setShellCommands");
|
|
16
16
|
|
|
17
|
-
const {
|
|
17
|
+
const { NO_ARGUMENT_GIVEN_MESSAGE, COMMAND_NOT_RECOGNISED_MESSAGE } = require("./messages"),
|
|
18
18
|
{ DEFAULT_NO, DEFAULT_YES, DEFAULT_TAIL, DEFAULT_FOLLOW, DEFAULT_DRY_RUN, DEFAULT_QUIETLY, DEFAULT_LOG_LEVEL } = require("./defaults"),
|
|
19
19
|
{ HELP_COMMAND,
|
|
20
20
|
OPEN_COMMAND,
|
|
@@ -40,44 +40,64 @@ function main(command, argument, options) {
|
|
|
40
40
|
logLevel = DEFAULT_LOG_LEVEL } = options;
|
|
41
41
|
|
|
42
42
|
switch (command) {
|
|
43
|
-
case
|
|
44
|
-
|
|
43
|
+
case HELP_COMMAND: {
|
|
44
|
+
helpAction();
|
|
45
45
|
|
|
46
46
|
break;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
case
|
|
50
|
-
|
|
49
|
+
case VERSION_COMMAND: {
|
|
50
|
+
versionAction();
|
|
51
51
|
|
|
52
52
|
break;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
case
|
|
56
|
-
|
|
55
|
+
case INITIALISE_COMMAND: {
|
|
56
|
+
initialiseAction();
|
|
57
57
|
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
case
|
|
62
|
-
|
|
61
|
+
case OPEN_COMMAND: {
|
|
62
|
+
if (argument === null) {
|
|
63
|
+
console.log(NO_ARGUMENT_GIVEN_MESSAGE);
|
|
64
|
+
} else {
|
|
65
|
+
const releaseName = argument; ///
|
|
66
|
+
|
|
67
|
+
openAction(releaseName, quietly, yes, no);
|
|
68
|
+
}
|
|
63
69
|
|
|
64
70
|
break;
|
|
65
71
|
}
|
|
66
72
|
|
|
67
|
-
case
|
|
68
|
-
|
|
73
|
+
case CLONE_COMMAND: {
|
|
74
|
+
if (argument === null) {
|
|
75
|
+
console.log(NO_ARGUMENT_GIVEN_MESSAGE);
|
|
76
|
+
} else {
|
|
77
|
+
const releaseName = argument; ///
|
|
78
|
+
|
|
79
|
+
cloneAction(releaseName, quietly, yes, no);
|
|
80
|
+
}
|
|
69
81
|
|
|
70
82
|
break;
|
|
71
83
|
}
|
|
72
84
|
|
|
73
85
|
case PUBLISH_COMMAND: {
|
|
74
|
-
|
|
86
|
+
if (argument === null) {
|
|
87
|
+
console.log(NO_ARGUMENT_GIVEN_MESSAGE);
|
|
88
|
+
} else {
|
|
89
|
+
const releaseName = argument; ///
|
|
90
|
+
|
|
91
|
+
publishAction(releaseName, tail, follow, dryRun, logLevel);
|
|
92
|
+
}
|
|
75
93
|
|
|
76
94
|
break;
|
|
77
95
|
}
|
|
78
96
|
|
|
79
97
|
case SIGN_IN_COMMAND: {
|
|
80
|
-
|
|
98
|
+
const emailAddressOrUsername = argument; ///
|
|
99
|
+
|
|
100
|
+
signInAction(emailAddressOrUsername);
|
|
81
101
|
|
|
82
102
|
break;
|
|
83
103
|
}
|
|
@@ -89,13 +109,9 @@ function main(command, argument, options) {
|
|
|
89
109
|
}
|
|
90
110
|
|
|
91
111
|
case WITHDRAW_COMMAND: {
|
|
92
|
-
|
|
112
|
+
const releaseName = argument; ///
|
|
93
113
|
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
case INITIALISE_COMMAND: {
|
|
98
|
-
initialiseAction();
|
|
114
|
+
withdrawAction(releaseName);
|
|
99
115
|
|
|
100
116
|
break;
|
|
101
117
|
}
|
|
@@ -107,13 +123,17 @@ function main(command, argument, options) {
|
|
|
107
123
|
}
|
|
108
124
|
|
|
109
125
|
case CREATE_ACCOUNT_COMMAND: {
|
|
110
|
-
|
|
126
|
+
const emailAddress = argument; ///
|
|
127
|
+
|
|
128
|
+
createAccountAction(emailAddress);
|
|
111
129
|
|
|
112
130
|
break;
|
|
113
131
|
}
|
|
114
132
|
|
|
115
133
|
case RESET_PASSWORD_COMMAND: {
|
|
116
|
-
|
|
134
|
+
const emailAddress = argument; ///
|
|
135
|
+
|
|
136
|
+
resetPasswordAction(emailAddress);
|
|
117
137
|
|
|
118
138
|
break;
|
|
119
139
|
}
|
|
@@ -125,9 +145,7 @@ function main(command, argument, options) {
|
|
|
125
145
|
}
|
|
126
146
|
|
|
127
147
|
default: {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
openAction(argument, quietly, yes, no);
|
|
148
|
+
console.log(COMMAND_NOT_RECOGNISED_MESSAGE);
|
|
131
149
|
|
|
132
150
|
break;
|
|
133
151
|
}
|
package/bin/messages.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const NO_ARGUMENT_GIVEN_MESSAGE = "No argument has been given.",
|
|
4
|
+
COMMAND_NOT_RECOGNISED_MESSAGE = "The command is not recognised.",
|
|
4
5
|
PASSWORDS_DO_NOT_MATCH_MESSAGE = "The passwords do not match.",
|
|
5
6
|
SERVER_FAILED_TO_RESPOND_ERROR_MESSAGE = "The server did not respond in a timely or intelligible fashion. If this problem persists then please be kind enough to report it.",
|
|
6
7
|
CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE = "The action cannot be performed because the configuration file is missing. Run 'open initialise' to create one.",
|
|
@@ -29,7 +30,8 @@ const NO_COMMAND_GIVEN_MESSAGE = "No command has been given.",
|
|
|
29
30
|
SUCCESSFUL_SET_SHELL_COMMANDS_MESSAGE = "The shell commands have been set successfully.";
|
|
30
31
|
|
|
31
32
|
module.exports = {
|
|
32
|
-
|
|
33
|
+
NO_ARGUMENT_GIVEN_MESSAGE,
|
|
34
|
+
COMMAND_NOT_RECOGNISED_MESSAGE,
|
|
33
35
|
PASSWORDS_DO_NOT_MATCH_MESSAGE,
|
|
34
36
|
SERVER_FAILED_TO_RESPOND_ERROR_MESSAGE,
|
|
35
37
|
CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE,
|
package/bin/prepare.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const changeDirectory = require("./changeDirectory");
|
|
4
|
+
|
|
5
|
+
const { DEFAULT_HELP, DEFAULT_VERSION } = require("./defaults"),
|
|
6
|
+
{ HELP_COMMAND, VERSION_COMMAND, INITIALISE_COMMAND, OPEN_COMMAND } = require("./commands");
|
|
7
|
+
|
|
8
|
+
function prepare(command, argument, options, main) {
|
|
9
|
+
const { help = DEFAULT_HELP, version = DEFAULT_VERSION } = options;
|
|
10
|
+
|
|
11
|
+
if (false) {
|
|
12
|
+
///
|
|
13
|
+
} else if (help) {
|
|
14
|
+
command = HELP_COMMAND;
|
|
15
|
+
} else if (version) {
|
|
16
|
+
command = VERSION_COMMAND;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if ((command === HELP_COMMAND) || (command === VERSION_COMMAND) || (command === INITIALISE_COMMAND)) {
|
|
20
|
+
main(command, argument, options);
|
|
21
|
+
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const directoryName = changeDirectory();
|
|
26
|
+
|
|
27
|
+
if (directoryName !== null) {
|
|
28
|
+
argument = directoryName; ///
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (argument === null) {
|
|
32
|
+
argument = command; ///
|
|
33
|
+
|
|
34
|
+
command = OPEN_COMMAND;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (command === null) {
|
|
38
|
+
command = OPEN_COMMAND;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
main(command, argument, options);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = prepare;
|
package/bin/utilities/string.js
CHANGED
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const { EMPTY_STRING } = require("../constants");
|
|
4
4
|
|
|
5
|
-
function trimTrailingSlash(string) {
|
|
6
|
-
string = string.replace(/\/$/, EMPTY_STRING); ///
|
|
7
|
-
|
|
8
|
-
return string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
5
|
function trimTrailingCarriageReturn(string) {
|
|
12
6
|
string = string.replace(/\n$/, EMPTY_STRING); ///
|
|
13
7
|
|
|
@@ -15,6 +9,5 @@ function trimTrailingCarriageReturn(string) {
|
|
|
15
9
|
}
|
|
16
10
|
|
|
17
11
|
module.exports = {
|
|
18
|
-
trimTrailingSlash,
|
|
19
12
|
trimTrailingCarriageReturn
|
|
20
13
|
};
|
package/open.js
CHANGED
|
@@ -4,7 +4,7 @@ const { parseArgv } = require("argumentative"),
|
|
|
4
4
|
{ arrayUtilities } = require("necessary");
|
|
5
5
|
|
|
6
6
|
const main = require("./bin/main"),
|
|
7
|
-
|
|
7
|
+
prepare = require("./bin/prepare"),
|
|
8
8
|
abbreviations = require("./bin/abbreviations");
|
|
9
9
|
|
|
10
10
|
const { argv } = process,
|
|
@@ -16,4 +16,4 @@ const { commands, options } = parseArgv(argv, abbreviations),
|
|
|
16
16
|
command = firstCommand || null, ///
|
|
17
17
|
argument = secondCommand || null; ///
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
prepare(command, argument, options, main);
|
package/package.json
CHANGED
package/bin/configure.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { pathUtilities } = require("necessary");
|
|
4
|
-
|
|
5
|
-
const { DOUBLE_DOTS } = require("./constants"),
|
|
6
|
-
{ DEFAULT_HELP, DEFAULT_VERSION } = require("./defaults"),
|
|
7
|
-
{ migrateConfigurationFile, checkConfigurationFileExists } = require("./configuration"),
|
|
8
|
-
{ HELP_COMMAND, VERSION_COMMAND, INITIALISE_COMMAND, PUBLISH_COMMAND } = require("./commands");
|
|
9
|
-
|
|
10
|
-
const { bottommostNameFromPath } = pathUtilities;
|
|
11
|
-
|
|
12
|
-
function configure(command, argument, options, main) {
|
|
13
|
-
const { help = DEFAULT_HELP, version = DEFAULT_VERSION } = options;
|
|
14
|
-
|
|
15
|
-
if (false) {
|
|
16
|
-
///
|
|
17
|
-
} else if (help) {
|
|
18
|
-
command = HELP_COMMAND;
|
|
19
|
-
} else if (version) {
|
|
20
|
-
command = VERSION_COMMAND;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if ((command === HELP_COMMAND) || (command === VERSION_COMMAND)) {
|
|
24
|
-
main(command, argument, options);
|
|
25
|
-
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const directoryName = changeDirectory(command);
|
|
30
|
-
|
|
31
|
-
if (directoryName !== null) {
|
|
32
|
-
if (command !== null) {
|
|
33
|
-
command = PUBLISH_COMMAND;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
argument = directoryName; ///
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (argument === null) {
|
|
40
|
-
argument = command; ///
|
|
41
|
-
|
|
42
|
-
command = PUBLISH_COMMAND;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
main(command, argument, options);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
module.exports = configure;
|
|
49
|
-
|
|
50
|
-
function changeDirectory(command) {
|
|
51
|
-
let directoryName = null,
|
|
52
|
-
configurationFileExists = checkConfigurationFileExists();
|
|
53
|
-
|
|
54
|
-
if (!configurationFileExists) {
|
|
55
|
-
const currentWorkingDirectoryPath = process.cwd(); ///
|
|
56
|
-
|
|
57
|
-
process.chdir(DOUBLE_DOTS);
|
|
58
|
-
|
|
59
|
-
const oldCurrentWorkingDirectoryPath = currentWorkingDirectoryPath; ///
|
|
60
|
-
|
|
61
|
-
configurationFileExists = checkConfigurationFileExists();
|
|
62
|
-
|
|
63
|
-
if (configurationFileExists) {
|
|
64
|
-
const bottommostOldCurrentWorkingDirectoryName = bottommostNameFromPath(oldCurrentWorkingDirectoryPath);
|
|
65
|
-
|
|
66
|
-
directoryName = bottommostOldCurrentWorkingDirectoryName; ///
|
|
67
|
-
} else {
|
|
68
|
-
process.chdir(oldCurrentWorkingDirectoryPath);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (command !== INITIALISE_COMMAND) {
|
|
73
|
-
migrateConfigurationFile();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return directoryName;
|
|
77
|
-
}
|