propagate-cli 1.9.43 → 1.9.44
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/configure.js +44 -0
- package/bin/defaults.js +2 -2
- package/package.json +1 -1
- package/propagate.js +3 -2
- package/bin/main.js +0 -45
package/bin/configure.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { pathUtilities } = require("necessary");
|
|
4
|
+
|
|
5
|
+
const { TWO_DOTS } = require("./constants"),
|
|
6
|
+
{ PROPAGATE_COMMAND } = require("./commands"),
|
|
7
|
+
{ DEFAULT_HELP, DEFAULT_VERSION } = require("./defaults"),
|
|
8
|
+
{ checkConfigurationFileExists, migrateConfigurationFile } = require("./configuration");
|
|
9
|
+
|
|
10
|
+
const { bottommostNameFromPath } = pathUtilities;
|
|
11
|
+
|
|
12
|
+
function configure(command, argument, options, callback) {
|
|
13
|
+
let configurationFileExists = checkConfigurationFileExists();
|
|
14
|
+
|
|
15
|
+
if (!configurationFileExists) {
|
|
16
|
+
const { help = DEFAULT_HELP, version = DEFAULT_VERSION } = options;
|
|
17
|
+
|
|
18
|
+
if ((help === false) && (version === false) && (command === null)) {
|
|
19
|
+
const currentWorkingDirectoryPath = process.cwd(); ///
|
|
20
|
+
|
|
21
|
+
process.chdir(TWO_DOTS);
|
|
22
|
+
|
|
23
|
+
const oldCurrentWorkingDirectoryPath = currentWorkingDirectoryPath; ///
|
|
24
|
+
|
|
25
|
+
configurationFileExists = checkConfigurationFileExists();
|
|
26
|
+
|
|
27
|
+
if (configurationFileExists) {
|
|
28
|
+
const bottommostOldCurrentWorkingDirectoryName = bottommostNameFromPath(oldCurrentWorkingDirectoryPath);
|
|
29
|
+
|
|
30
|
+
command = PROPAGATE_COMMAND; ///
|
|
31
|
+
|
|
32
|
+
argument = bottommostOldCurrentWorkingDirectoryName; ///
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (configurationFileExists) {
|
|
38
|
+
migrateConfigurationFile();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
callback(command, argument, options);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = configure;
|
package/bin/defaults.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const DEFAULT_YES = false,
|
|
4
4
|
DEFAULT_HELP = false,
|
|
5
|
-
DEFAULT_DRY_RUN = false,
|
|
6
5
|
DEFAULT_VERSION = false,
|
|
6
|
+
DEFAULT_DRY_RUN = false,
|
|
7
7
|
DEFAULT_QUIETLY = false,
|
|
8
8
|
DEFAULT_DIRECTORY_NAME = ".",
|
|
9
9
|
DEFAULT_GIT_SHELL_COMMANDS = "git add .; git commit -m \"Propagated.\"; git push",
|
|
@@ -14,8 +14,8 @@ const DEFAULT_YES = false,
|
|
|
14
14
|
module.exports = {
|
|
15
15
|
DEFAULT_YES,
|
|
16
16
|
DEFAULT_HELP,
|
|
17
|
-
DEFAULT_DRY_RUN,
|
|
18
17
|
DEFAULT_VERSION,
|
|
18
|
+
DEFAULT_DRY_RUN,
|
|
19
19
|
DEFAULT_QUIETLY,
|
|
20
20
|
DEFAULT_DIRECTORY_NAME,
|
|
21
21
|
DEFAULT_GIT_SHELL_COMMANDS,
|
package/package.json
CHANGED
package/propagate.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
const { parseArgv } = require("argumentative"),
|
|
4
4
|
{ arrayUtilities } = require("necessary");
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const actions = require("./bin/actions"),
|
|
7
|
+
configure = require("./bin/configure"),
|
|
7
8
|
abbreviations = require("./bin/abbreviations");
|
|
8
9
|
|
|
9
10
|
const { first, second } = arrayUtilities;
|
|
@@ -14,4 +15,4 @@ const { commands, options } = parseArgv(process.argv, abbreviations),
|
|
|
14
15
|
command = firstCommand || null, ///
|
|
15
16
|
argument = secondCommand || null; ///
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
configure(command, argument, options, actions);
|
package/bin/main.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { pathUtilities } = require("necessary");
|
|
4
|
-
|
|
5
|
-
const actions = require("./actions");
|
|
6
|
-
|
|
7
|
-
const { TWO_DOTS } = require("./constants"),
|
|
8
|
-
{ PROPAGATE_COMMAND } = require("./commands");
|
|
9
|
-
const { DEFAULT_HELP, DEFAULT_VERSION } = require("./defaults"),
|
|
10
|
-
{ checkConfigurationFileExists, migrateConfigurationFile } = require("./configuration");
|
|
11
|
-
|
|
12
|
-
const { bottommostNameFromPath } = pathUtilities;
|
|
13
|
-
|
|
14
|
-
function main(command, argument, options) {
|
|
15
|
-
const commandExists = (command !== null),
|
|
16
|
-
{ help = DEFAULT_HELP, version = DEFAULT_VERSION } = options;
|
|
17
|
-
|
|
18
|
-
let configurationFileExists = checkConfigurationFileExists();
|
|
19
|
-
|
|
20
|
-
if (!help && !version && !commandExists && !configurationFileExists) { ///
|
|
21
|
-
const currentWorkingDirectoryPath = process.cwd(); ///
|
|
22
|
-
|
|
23
|
-
process.chdir(TWO_DOTS);
|
|
24
|
-
|
|
25
|
-
const oldCurrentWorkingDirectoryPath = currentWorkingDirectoryPath; ///
|
|
26
|
-
|
|
27
|
-
configurationFileExists = checkConfigurationFileExists();
|
|
28
|
-
|
|
29
|
-
if (configurationFileExists) {
|
|
30
|
-
const bottommostOldCurrentWorkingDirectoryName = bottommostNameFromPath(oldCurrentWorkingDirectoryPath);
|
|
31
|
-
|
|
32
|
-
command = PROPAGATE_COMMAND; ///
|
|
33
|
-
|
|
34
|
-
argument = bottommostOldCurrentWorkingDirectoryName; ///
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (configurationFileExists) {
|
|
39
|
-
migrateConfigurationFile();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
actions(command, argument, options);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
module.exports = main;
|