propagate-cli 1.9.49 → 1.9.51
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/help.js +1 -5
- package/bin/configuration.js +14 -11
- package/bin/configure.js +27 -13
- package/bin/constants.js +2 -0
- package/bin/main.js +99 -31
- package/bin/messages.js +2 -0
- package/package.json +3 -3
package/bin/action/help.js
CHANGED
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
function helpAction() {
|
|
4
4
|
console.log(`Usage:
|
|
5
5
|
|
|
6
|
-
propagate [<options>]
|
|
7
|
-
|
|
8
|
-
propagate [<options>] <sub-directory> Propagate a package in the given sub-directory
|
|
9
|
-
|
|
10
|
-
propagate [<command>] [<options>]
|
|
6
|
+
propagate [<options>] [<command>] [<argument>]
|
|
11
7
|
|
|
12
8
|
Commands:
|
|
13
9
|
|
package/bin/configuration.js
CHANGED
|
@@ -76,6 +76,8 @@ function createConfigurationFile() {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
function migrateConfigurationFile() {
|
|
79
|
+
assertConfigurationFileExists();
|
|
80
|
+
|
|
79
81
|
let json = readRCFile();
|
|
80
82
|
|
|
81
83
|
const migrationMap = {
|
|
@@ -97,6 +99,16 @@ function checkConfigurationFileExists() {
|
|
|
97
99
|
return configurationFileExists;
|
|
98
100
|
}
|
|
99
101
|
|
|
102
|
+
function assertConfigurationFileExists() {
|
|
103
|
+
const configurationFileExists = checkConfigurationFileExists();
|
|
104
|
+
|
|
105
|
+
if (!configurationFileExists) {
|
|
106
|
+
console.log(CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE);
|
|
107
|
+
|
|
108
|
+
process.exit(1);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
100
112
|
module.exports = {
|
|
101
113
|
retrieveDirectories,
|
|
102
114
|
retrieveShellCommands,
|
|
@@ -108,7 +120,8 @@ module.exports = {
|
|
|
108
120
|
updateForcedDependencyRelations,
|
|
109
121
|
createConfigurationFile,
|
|
110
122
|
migrateConfigurationFile,
|
|
111
|
-
checkConfigurationFileExists
|
|
123
|
+
checkConfigurationFileExists,
|
|
124
|
+
assertConfigurationFileExists
|
|
112
125
|
};
|
|
113
126
|
|
|
114
127
|
function readConfigurationFile() {
|
|
@@ -136,13 +149,3 @@ function updateConfigurationFile(addedConfiguration, ...deleteConfigurationNames
|
|
|
136
149
|
|
|
137
150
|
updateRCFile(addedProperties, ...deletedPropertyNames);
|
|
138
151
|
}
|
|
139
|
-
|
|
140
|
-
function assertConfigurationFileExists() {
|
|
141
|
-
const configurationFileExists = checkConfigurationFileExists();
|
|
142
|
-
|
|
143
|
-
if (!configurationFileExists) {
|
|
144
|
-
console.log(CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE);
|
|
145
|
-
|
|
146
|
-
process.exit(1);
|
|
147
|
-
}
|
|
148
|
-
}
|
package/bin/configure.js
CHANGED
|
@@ -2,23 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
const { pathUtilities } = require("necessary");
|
|
4
4
|
|
|
5
|
-
const {
|
|
6
|
-
{ PROPAGATE_COMMAND } = require("./commands"),
|
|
5
|
+
const { DOUBLE_DOTS } = require("./constants"),
|
|
7
6
|
{ DEFAULT_HELP, DEFAULT_VERSION } = require("./defaults"),
|
|
8
|
-
{
|
|
7
|
+
{ HELP_COMMAND, VERSION_COMMAND, PROPAGATE_COMMAND } = require("./commands"),
|
|
8
|
+
{ migrateConfigurationFile, checkConfigurationFileExists } = require("./configuration");
|
|
9
9
|
|
|
10
10
|
const { bottommostNameFromPath } = pathUtilities;
|
|
11
11
|
|
|
12
12
|
function configure(command, argument, options, main) {
|
|
13
|
-
let configurationFileExists
|
|
13
|
+
let configurationFileExists;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
const { help = DEFAULT_HELP, version = DEFAULT_VERSION } = options;
|
|
15
|
+
const { help = DEFAULT_HELP, version = DEFAULT_VERSION } = options;
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
if (false) {
|
|
18
|
+
///
|
|
19
|
+
} else if (help) {
|
|
20
|
+
command = HELP_COMMAND;
|
|
21
|
+
} else if (version) {
|
|
22
|
+
command = VERSION_COMMAND;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if ((command === HELP_COMMAND) || (command === VERSION_COMMAND)) {
|
|
26
|
+
main(command, argument, options);
|
|
27
|
+
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
configurationFileExists = checkConfigurationFileExists();
|
|
32
|
+
|
|
33
|
+
if (command === null) {
|
|
34
|
+
if (!configurationFileExists) {
|
|
19
35
|
const currentWorkingDirectoryPath = process.cwd(); ///
|
|
20
36
|
|
|
21
|
-
process.chdir(
|
|
37
|
+
process.chdir(DOUBLE_DOTS);
|
|
22
38
|
|
|
23
39
|
const oldCurrentWorkingDirectoryPath = currentWorkingDirectoryPath; ///
|
|
24
40
|
|
|
@@ -27,16 +43,14 @@ function configure(command, argument, options, main) {
|
|
|
27
43
|
if (configurationFileExists) {
|
|
28
44
|
const bottommostOldCurrentWorkingDirectoryName = bottommostNameFromPath(oldCurrentWorkingDirectoryPath);
|
|
29
45
|
|
|
30
|
-
command = PROPAGATE_COMMAND; ///
|
|
31
|
-
|
|
32
46
|
argument = bottommostOldCurrentWorkingDirectoryName; ///
|
|
47
|
+
|
|
48
|
+
command = PROPAGATE_COMMAND; ///
|
|
33
49
|
}
|
|
34
50
|
}
|
|
35
51
|
}
|
|
36
52
|
|
|
37
|
-
|
|
38
|
-
migrateConfigurationFile();
|
|
39
|
-
}
|
|
53
|
+
migrateConfigurationFile();
|
|
40
54
|
|
|
41
55
|
main(command, argument, options);
|
|
42
56
|
}
|
package/bin/constants.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const YES = "yes",
|
|
4
4
|
TWO_DOTS = "..",
|
|
5
5
|
PROPAGATE = "propagate",
|
|
6
|
+
DOUBLE_DOTS = "..",
|
|
6
7
|
EMPTY_STRING = "",
|
|
7
8
|
PACKAGE_JSON = "package.json",
|
|
8
9
|
DEPENDENCIES = "dependencies",
|
|
@@ -13,6 +14,7 @@ module.exports = {
|
|
|
13
14
|
YES,
|
|
14
15
|
TWO_DOTS,
|
|
15
16
|
PROPAGATE,
|
|
17
|
+
DOUBLE_DOTS,
|
|
16
18
|
EMPTY_STRING,
|
|
17
19
|
PACKAGE_JSON,
|
|
18
20
|
DEPENDENCIES,
|
package/bin/main.js
CHANGED
|
@@ -15,7 +15,8 @@ const helpAction = require("./action/help"),
|
|
|
15
15
|
listForcedDependencyRelationsAction = require("./action/listForcedDependencyRelations"),
|
|
16
16
|
removeForcedDependencyRelationAction = require("./action/removeForcedDependencyRelation");
|
|
17
17
|
|
|
18
|
-
const {
|
|
18
|
+
const { NO_COMMAND_GIVEN_MESSAGE } = require("./messages"),
|
|
19
|
+
{ DEFAULT_YES, DEFAULT_QUIETLY, DEFAULT_DRY_RUN } = require("./defaults"),
|
|
19
20
|
{ HELP_COMMAND,
|
|
20
21
|
VERSION_COMMAND,
|
|
21
22
|
PROPAGATE_COMMAND,
|
|
@@ -32,43 +33,110 @@ const { DEFAULT_YES, DEFAULT_QUIETLY, DEFAULT_DRY_RUN, DEFAULT_HELP, DEFAULT_VER
|
|
|
32
33
|
REMOVE_FORCED_DEPENDENCY_RELATION_COMMAND } = require("./commands");
|
|
33
34
|
|
|
34
35
|
function main(command, argument, options) {
|
|
35
|
-
const
|
|
36
|
-
{ yes = DEFAULT_YES,
|
|
37
|
-
help = DEFAULT_HELP,
|
|
36
|
+
const { yes = DEFAULT_YES,
|
|
38
37
|
dryRun = DEFAULT_DRY_RUN,
|
|
39
|
-
version = DEFAULT_VERSION,
|
|
40
38
|
quietly = DEFAULT_QUIETLY } = options;
|
|
41
39
|
|
|
42
|
-
if (false) {
|
|
43
|
-
///
|
|
44
|
-
} else if (help) {
|
|
45
|
-
command = HELP_COMMAND;
|
|
46
|
-
} else if (version) {
|
|
47
|
-
command = VERSION_COMMAND;
|
|
48
|
-
} else if (commandMissing) {
|
|
49
|
-
command = HELP_COMMAND;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
40
|
switch (command) {
|
|
53
|
-
case
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
case
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
41
|
+
case null: {
|
|
42
|
+
console.log(NO_COMMAND_GIVEN_MESSAGE);
|
|
43
|
+
|
|
44
|
+
process.exit(1);
|
|
45
|
+
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
case HELP_COMMAND: {
|
|
50
|
+
helpAction();
|
|
51
|
+
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
case VERSION_COMMAND: {
|
|
56
|
+
versionAction();
|
|
57
|
+
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
case PROPAGATE_COMMAND: {
|
|
62
|
+
propagateAction(argument, quietly, dryRun, yes);
|
|
63
|
+
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
case INITIALISE_COMMAND: {
|
|
68
|
+
initialiseAction();
|
|
69
|
+
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
case ADD_DIRECTORY_COMMAND: {
|
|
74
|
+
addDirectoryAction();
|
|
75
|
+
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
case REMOVE_DIRECTORY_COMMAND: {
|
|
80
|
+
removeDirectoryAction();
|
|
81
|
+
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
case LIST_DIRECTORIES_COMMAND: {
|
|
86
|
+
listDirectoriesAction();
|
|
87
|
+
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
case SET_SHELL_COMMANDS_COMMAND: {
|
|
92
|
+
setShellCommandsAction();
|
|
93
|
+
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
case ADD_IGNORED_DEPENDENCY_COMMAND: {
|
|
98
|
+
addIgnoredDependencyAction();
|
|
99
|
+
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
case LIST_IGNORED_DEPENDENCIES_COMMAND: {
|
|
104
|
+
listIgnoredDependenciesAction();
|
|
105
|
+
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
case REMOVE_IGNORED_DEPENDENCY_COMMAND: {
|
|
110
|
+
removeIgnoredDependencyAction();
|
|
111
|
+
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
case ADD_FORCED_DEPENDENCY_RELATION_COMMAND: {
|
|
116
|
+
addForcedDependencyRelationAction();
|
|
117
|
+
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
case LIST_FORCED_DEPENDENCY_RELATIONS_COMMAND: {
|
|
122
|
+
listForcedDependencyRelationsAction();
|
|
123
|
+
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
case REMOVE_FORCED_DEPENDENCY_RELATION_COMMAND: {
|
|
128
|
+
removeForcedDependencyRelationAction();
|
|
129
|
+
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
default: {
|
|
69
134
|
argument = command; ///
|
|
70
135
|
|
|
71
136
|
propagateAction(argument, quietly, dryRun, yes);
|
|
137
|
+
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
72
140
|
}
|
|
73
141
|
}
|
|
74
142
|
|
package/bin/messages.js
CHANGED
|
@@ -35,6 +35,7 @@ const INVALID_ANSWER_MESSAGE = "You must answer (y)es or (n)o.",
|
|
|
35
35
|
NO_IGNORED_DEPENDENCIES_MESSAGE = "There are no ignored dependencies.",
|
|
36
36
|
NO_SUB_DIRECTORY_SPECIFIED_MESSAGE = "No sub-directory has been specified.",
|
|
37
37
|
NO_FORCED_DEPENDENCY_RELATIONS_MESSAGE = "There are no forced dependency relations.",
|
|
38
|
+
NO_COMMAND_GIVEN_MESSAGE = "No command has been given.",
|
|
38
39
|
RELEASE_NOT_PUBLISHABLE_MESSAGE = "The package.json file must contain both name and version fields in order to be publishable.",
|
|
39
40
|
DIRECTORIES_INCLUDES_DIRECTORY_MESSAGE = "The directory has already been added.",
|
|
40
41
|
CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE = "The action cannot be performed because the configuration file is missing. Run 'propagate initialise' to create one.",
|
|
@@ -80,6 +81,7 @@ module.exports = {
|
|
|
80
81
|
NO_IGNORED_DEPENDENCIES_MESSAGE,
|
|
81
82
|
NO_SUB_DIRECTORY_SPECIFIED_MESSAGE,
|
|
82
83
|
NO_FORCED_DEPENDENCY_RELATIONS_MESSAGE,
|
|
84
|
+
NO_COMMAND_GIVEN_MESSAGE,
|
|
83
85
|
RELEASE_NOT_PUBLISHABLE_MESSAGE,
|
|
84
86
|
DIRECTORIES_INCLUDES_DIRECTORY_MESSAGE,
|
|
85
87
|
CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "propagate-cli",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.51",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/propagate-cli",
|
|
7
7
|
"description": "Propagate updated packages throughout a project.",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"argumentative": "^2.0.28",
|
|
17
|
-
"necessary": "^
|
|
18
|
-
"occam-directed-graphs": "^3.0.
|
|
17
|
+
"necessary": "^14.0.1",
|
|
18
|
+
"occam-directed-graphs": "^3.0.73",
|
|
19
19
|
"sudo": "^1.0.3"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {}
|