propagate-cli 1.9.50 → 1.9.52
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/README.md +1 -5
- 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 +15 -17
- package/bin/messages.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,11 +82,7 @@ If you would like to contribute or would simply like to have a look at the code,
|
|
|
82
82
|
Propagate has the following commands and options:
|
|
83
83
|
|
|
84
84
|
```
|
|
85
|
-
propagate [<options>]
|
|
86
|
-
|
|
87
|
-
propagate [<options>] <sub-directory> Propagate a package in the given sub-directory
|
|
88
|
-
|
|
89
|
-
propagate [<command>] [<options>]
|
|
85
|
+
propagate [<options>] [<command>] [<argument>]
|
|
90
86
|
|
|
91
87
|
Commands:
|
|
92
88
|
|
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,24 +33,19 @@ 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) {
|
|
41
|
+
case null: {
|
|
42
|
+
console.log(NO_COMMAND_GIVEN_MESSAGE);
|
|
43
|
+
|
|
44
|
+
process.exit(1);
|
|
45
|
+
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
|
|
53
49
|
case HELP_COMMAND: {
|
|
54
50
|
helpAction();
|
|
55
51
|
|
|
@@ -134,11 +130,13 @@ function main(command, argument, options) {
|
|
|
134
130
|
break;
|
|
135
131
|
}
|
|
136
132
|
|
|
137
|
-
|
|
138
|
-
default:
|
|
133
|
+
default: {
|
|
139
134
|
argument = command; ///
|
|
140
135
|
|
|
141
136
|
propagateAction(argument, quietly, dryRun, yes);
|
|
137
|
+
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
142
140
|
}
|
|
143
141
|
}
|
|
144
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