propagate-cli 1.9.58 → 1.9.61
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/propagate.js +2 -2
- package/bin/changeDirectory.js +37 -0
- package/bin/main.js +12 -14
- package/bin/messages.js +11 -11
- package/bin/operation/createSubDirectoryPath.js +2 -12
- package/bin/prepare.js +72 -0
- package/package.json +1 -1
- package/propagate.js +2 -2
- package/bin/configure.js +0 -77
package/bin/action/propagate.js
CHANGED
|
@@ -14,7 +14,7 @@ const dryRunOperation = require("../operation/dryRun"),
|
|
|
14
14
|
const { executeOperations } = require("../utilities/operation"),
|
|
15
15
|
{ FAILED_PROPAGATE_MESSAGE, SUCCESSFUL_PROPAGATE_MESSAGE } = require("../messages");
|
|
16
16
|
|
|
17
|
-
function propagateAction(
|
|
17
|
+
function propagateAction(subDirectoryName, quietly, dryRun, yes) {
|
|
18
18
|
const operations = [
|
|
19
19
|
createSubDirectoryPathOperation,
|
|
20
20
|
createSubDirectoryMapOperation,
|
|
@@ -28,7 +28,7 @@ function propagateAction(argument, quietly, dryRun, yes) {
|
|
|
28
28
|
saveAndApplyDiffsOperation
|
|
29
29
|
],
|
|
30
30
|
context = {
|
|
31
|
-
|
|
31
|
+
subDirectoryName,
|
|
32
32
|
quietly,
|
|
33
33
|
dryRun,
|
|
34
34
|
yes
|
|
@@ -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
|
@@ -15,7 +15,7 @@ const helpAction = require("./action/help"),
|
|
|
15
15
|
listForcedDependencyRelationsAction = require("./action/listForcedDependencyRelations"),
|
|
16
16
|
removeForcedDependencyRelationAction = require("./action/removeForcedDependencyRelation");
|
|
17
17
|
|
|
18
|
-
const {
|
|
18
|
+
const { NO_ARGUMENT_GIVEN_MESSAGE, COMMAND_NOT_RECOGNISED_MESSAGE } = require("./messages"),
|
|
19
19
|
{ DEFAULT_YES, DEFAULT_QUIETLY, DEFAULT_DRY_RUN } = require("./defaults"),
|
|
20
20
|
{ HELP_COMMAND,
|
|
21
21
|
VERSION_COMMAND,
|
|
@@ -38,12 +38,6 @@ function main(command, argument, options) {
|
|
|
38
38
|
quietly = DEFAULT_QUIETLY } = options;
|
|
39
39
|
|
|
40
40
|
switch (command) {
|
|
41
|
-
case null: {
|
|
42
|
-
console.log(NO_COMMAND_GIVEN_MESSAGE);
|
|
43
|
-
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
41
|
case HELP_COMMAND: {
|
|
48
42
|
helpAction();
|
|
49
43
|
|
|
@@ -56,14 +50,20 @@ function main(command, argument, options) {
|
|
|
56
50
|
break;
|
|
57
51
|
}
|
|
58
52
|
|
|
59
|
-
case
|
|
60
|
-
|
|
53
|
+
case INITIALISE_COMMAND: {
|
|
54
|
+
initialiseAction();
|
|
61
55
|
|
|
62
56
|
break;
|
|
63
57
|
}
|
|
64
58
|
|
|
65
|
-
case
|
|
66
|
-
|
|
59
|
+
case PROPAGATE_COMMAND: {
|
|
60
|
+
if (argument === null) {
|
|
61
|
+
console.log(NO_ARGUMENT_GIVEN_MESSAGE);
|
|
62
|
+
} else {
|
|
63
|
+
const subDirectoryName = argument; ///
|
|
64
|
+
|
|
65
|
+
propagateAction(subDirectoryName, quietly, dryRun, yes);
|
|
66
|
+
}
|
|
67
67
|
|
|
68
68
|
break;
|
|
69
69
|
}
|
|
@@ -129,9 +129,7 @@ function main(command, argument, options) {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
default: {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
propagateAction(argument, quietly, dryRun, yes);
|
|
132
|
+
console.log(COMMAND_NOT_RECOGNISED_MESSAGE);
|
|
135
133
|
|
|
136
134
|
break;
|
|
137
135
|
}
|
package/bin/messages.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const NO_RELEASE_MESSAGE = "Either the sub-directory is missing or it does not contain a package.json file.",
|
|
4
|
+
NO_ARGUMENT_GIVEN_MESSAGE = "No argument has been given.",
|
|
5
|
+
NO_IGNORED_DEPENDENCIES_MESSAGE = "There are no ignored dependencies.",
|
|
6
|
+
NO_FORCED_DEPENDENCY_RELATIONS_MESSAGE = "There are no forced dependency relations.",
|
|
7
|
+
INVALID_ANSWER_MESSAGE = "You must answer (y)es or (n)o.",
|
|
4
8
|
INVALID_DIRECTORY_PATH_MESSAGE = "The directory path should be a relative path, starting with a period or more likely a double period.",
|
|
5
9
|
INVALID_DIRECTORY_NUMBER_MESSAGE = "The directory number should match one of the numbers given above.",
|
|
6
10
|
INVALID_FORCED_DEPENDENT_NAME_MESSAGE = "The dependent name must be non-empty.",
|
|
@@ -31,11 +35,7 @@ const INVALID_ANSWER_MESSAGE = "You must answer (y)es or (n)o.",
|
|
|
31
35
|
SUCCESSFUL_REMOVE_IGNORED_DEPENDENCY_MESSAGE = "The ignored dependency was added successfully.",
|
|
32
36
|
SUCCESSFUL_ADD_FORCED_DEPENDENCY_RELATION_MESSAGE = "The forced dependency relation was added successfully.",
|
|
33
37
|
SUCCESSFUL_REMOVE_FORCED_DEPENDENCY_RELATION_MESSAGE = "The forced dependency relation was added successfully.",
|
|
34
|
-
|
|
35
|
-
NO_IGNORED_DEPENDENCIES_MESSAGE = "There are no ignored dependencies.",
|
|
36
|
-
NO_SUB_DIRECTORY_SPECIFIED_MESSAGE = "No sub-directory has been specified.",
|
|
37
|
-
NO_FORCED_DEPENDENCY_RELATIONS_MESSAGE = "There are no forced dependency relations.",
|
|
38
|
-
NO_COMMAND_GIVEN_MESSAGE = "No command has been given.",
|
|
38
|
+
COMMAND_NOT_RECOGNISED_MESSAGE = "The command is not recognised.",
|
|
39
39
|
RELEASE_NOT_PUBLISHABLE_MESSAGE = "The package.json file must contain both name and version fields in order to be publishable.",
|
|
40
40
|
DIRECTORIES_INCLUDES_DIRECTORY_MESSAGE = "The directory has already been added.",
|
|
41
41
|
CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE = "The action cannot be performed because the configuration file is missing. Run 'propagate initialise' to create one.",
|
|
@@ -46,6 +46,10 @@ const INVALID_ANSWER_MESSAGE = "You must answer (y)es or (n)o.",
|
|
|
46
46
|
FORCED_DEPENDENCY_RELATIONS_INCLUDE_FORCED_DEPENDENCY_RELATION_MESSAGE = "The forced dependency relation has already been added.";
|
|
47
47
|
|
|
48
48
|
module.exports = {
|
|
49
|
+
NO_RELEASE_MESSAGE,
|
|
50
|
+
NO_ARGUMENT_GIVEN_MESSAGE,
|
|
51
|
+
NO_IGNORED_DEPENDENCIES_MESSAGE,
|
|
52
|
+
NO_FORCED_DEPENDENCY_RELATIONS_MESSAGE,
|
|
49
53
|
INVALID_ANSWER_MESSAGE,
|
|
50
54
|
INVALID_DIRECTORY_PATH_MESSAGE,
|
|
51
55
|
INVALID_DIRECTORY_NUMBER_MESSAGE,
|
|
@@ -77,11 +81,7 @@ module.exports = {
|
|
|
77
81
|
SUCCESSFUL_REMOVE_IGNORED_DEPENDENCY_MESSAGE,
|
|
78
82
|
SUCCESSFUL_ADD_FORCED_DEPENDENCY_RELATION_MESSAGE,
|
|
79
83
|
SUCCESSFUL_REMOVE_FORCED_DEPENDENCY_RELATION_MESSAGE,
|
|
80
|
-
|
|
81
|
-
NO_IGNORED_DEPENDENCIES_MESSAGE,
|
|
82
|
-
NO_SUB_DIRECTORY_SPECIFIED_MESSAGE,
|
|
83
|
-
NO_FORCED_DEPENDENCY_RELATIONS_MESSAGE,
|
|
84
|
-
NO_COMMAND_GIVEN_MESSAGE,
|
|
84
|
+
COMMAND_NOT_RECOGNISED_MESSAGE,
|
|
85
85
|
RELEASE_NOT_PUBLISHABLE_MESSAGE,
|
|
86
86
|
DIRECTORIES_INCLUDES_DIRECTORY_MESSAGE,
|
|
87
87
|
CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE,
|
|
@@ -4,22 +4,12 @@ const { pathUtilities } = require("necessary");
|
|
|
4
4
|
|
|
5
5
|
const { DEFAULT_DIRECTORY_NAME } = require("../defaults"),
|
|
6
6
|
{ retrieveIgnoredDependencies } = require("../configuration"),
|
|
7
|
-
{
|
|
7
|
+
{ IGNORED_DEPENDENCIES_INCLUDE_SUB_DIRECTORY_MESSAGE } = require("../messages");
|
|
8
8
|
|
|
9
9
|
const { concatenatePaths } = pathUtilities;
|
|
10
10
|
|
|
11
11
|
function createSubDirectoryPathOperation(proceed, abort, context) {
|
|
12
|
-
const {
|
|
13
|
-
|
|
14
|
-
if (argument === null) {
|
|
15
|
-
console.log(NO_SUB_DIRECTORY_SPECIFIED_MESSAGE);
|
|
16
|
-
|
|
17
|
-
abort();
|
|
18
|
-
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const subDirectoryName = argument, ////
|
|
12
|
+
const { subDirectoryName } = context,
|
|
23
13
|
ignoredDependencies = retrieveIgnoredDependencies(),
|
|
24
14
|
ignoredDependenciesIncludesSubDirectoryName = ignoredDependencies.includes(subDirectoryName);
|
|
25
15
|
|
package/bin/prepare.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const changeDirectory = require("./changeDirectory");
|
|
4
|
+
|
|
5
|
+
const { DEFAULT_HELP, DEFAULT_VERSION } = require("./defaults"),
|
|
6
|
+
{ HELP_COMMAND,
|
|
7
|
+
VERSION_COMMAND,
|
|
8
|
+
PROPAGATE_COMMAND,
|
|
9
|
+
INITIALISE_COMMAND,
|
|
10
|
+
ADD_DIRECTORY_COMMAND,
|
|
11
|
+
REMOVE_DIRECTORY_COMMAND,
|
|
12
|
+
LIST_DIRECTORIES_COMMAND,
|
|
13
|
+
SET_SHELL_COMMANDS_COMMAND,
|
|
14
|
+
ADD_IGNORED_DEPENDENCY_COMMAND,
|
|
15
|
+
LIST_IGNORED_DEPENDENCIES_COMMAND,
|
|
16
|
+
REMOVE_IGNORED_DEPENDENCY_COMMAND,
|
|
17
|
+
ADD_FORCED_DEPENDENCY_RELATION_COMMAND,
|
|
18
|
+
LIST_FORCED_DEPENDENCY_RELATIONS_COMMAND,
|
|
19
|
+
REMOVE_FORCED_DEPENDENCY_RELATION_COMMAND } = require("./commands");
|
|
20
|
+
|
|
21
|
+
function prepare(command, argument, options, main) {
|
|
22
|
+
const { help = DEFAULT_HELP, version = DEFAULT_VERSION } = options;
|
|
23
|
+
|
|
24
|
+
if (false) {
|
|
25
|
+
///
|
|
26
|
+
} else if (help) {
|
|
27
|
+
command = HELP_COMMAND;
|
|
28
|
+
} else if (version) {
|
|
29
|
+
command = VERSION_COMMAND;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if ((command === HELP_COMMAND) ||
|
|
33
|
+
(command === VERSION_COMMAND) ||
|
|
34
|
+
(command === INITIALISE_COMMAND)) {
|
|
35
|
+
|
|
36
|
+
main(command, argument, options);
|
|
37
|
+
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const directoryName = changeDirectory();
|
|
42
|
+
|
|
43
|
+
if (directoryName !== null) {
|
|
44
|
+
argument = directoryName; ///
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (argument === null) {
|
|
48
|
+
if ((command !== ADD_DIRECTORY_COMMAND) &&
|
|
49
|
+
(command !== REMOVE_DIRECTORY_COMMAND) &&
|
|
50
|
+
(command !== LIST_DIRECTORIES_COMMAND) &&
|
|
51
|
+
(command !== SET_SHELL_COMMANDS_COMMAND) &&
|
|
52
|
+
(command !== ADD_IGNORED_DEPENDENCY_COMMAND) &&
|
|
53
|
+
(command !== LIST_IGNORED_DEPENDENCIES_COMMAND) &&
|
|
54
|
+
(command !== REMOVE_IGNORED_DEPENDENCY_COMMAND) &&
|
|
55
|
+
(command !== ADD_FORCED_DEPENDENCY_RELATION_COMMAND) &&
|
|
56
|
+
(command !== LIST_FORCED_DEPENDENCY_RELATIONS_COMMAND) &&
|
|
57
|
+
(command !== REMOVE_FORCED_DEPENDENCY_RELATION_COMMAND)) {
|
|
58
|
+
|
|
59
|
+
argument = command; ///
|
|
60
|
+
|
|
61
|
+
command = PROPAGATE_COMMAND;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (command === null) {
|
|
66
|
+
command = PROPAGATE_COMMAND;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
main(command, argument, options);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
module.exports = prepare;
|
package/package.json
CHANGED
package/propagate.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 { first, second } = arrayUtilities;
|
|
@@ -15,4 +15,4 @@ const { commands, options } = parseArgv(process.argv, abbreviations),
|
|
|
15
15
|
command = firstCommand || null, ///
|
|
16
16
|
argument = secondCommand || null; ///
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
prepare(command, argument, options, main);
|
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, PROPAGATE_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 = PROPAGATE_COMMAND;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
argument = directoryName; ///
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (argument === null) {
|
|
40
|
-
argument = command; ///
|
|
41
|
-
|
|
42
|
-
command = PROPAGATE_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
|
-
}
|