propagate-cli 1.9.6 → 1.9.11

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.
Files changed (41) hide show
  1. package/bin/action/addDirectory.js +5 -5
  2. package/bin/action/addForcedDependencyRelation.js +7 -7
  3. package/bin/action/addIgnoredDependency.js +5 -5
  4. package/bin/action/propagate.js +23 -23
  5. package/bin/action/removeDirectory.js +5 -5
  6. package/bin/action/removeForcedDependencyRelation.js +5 -5
  7. package/bin/action/removeIgnoredDependency.js +5 -5
  8. package/bin/action/setShellCommands.js +11 -11
  9. package/bin/{callback → operation}/checkDevDependencies.js +2 -2
  10. package/bin/{callback → operation}/createDiffs.js +2 -2
  11. package/bin/{callback → operation}/createReleaseGraph.js +2 -2
  12. package/bin/{callback → operation}/createReleaseMap.js +2 -2
  13. package/bin/operation/createSubDirectoryMap.js +49 -0
  14. package/bin/{callback → operation}/createSubDirectoryPath.js +2 -2
  15. package/bin/{callback → operation}/dryRun.js +2 -2
  16. package/bin/{callback → operation}/prompt/addDirectory.js +2 -2
  17. package/bin/{callback → operation}/prompt/addForcedDependency.js +2 -2
  18. package/bin/{callback → operation}/prompt/addForcedDependent.js +2 -2
  19. package/bin/{callback → operation}/prompt/addIgnoredDependency.js +2 -2
  20. package/bin/{callback → operation}/prompt/build.js +2 -2
  21. package/bin/{callback → operation}/prompt/git.js +2 -2
  22. package/bin/{callback → operation}/prompt/install.js +2 -2
  23. package/bin/{callback → operation}/prompt/publish.js +2 -2
  24. package/bin/{callback → operation}/prompt/removeDirectory.js +2 -2
  25. package/bin/{callback → operation}/prompt/removeForcedDependencyRelation.js +2 -2
  26. package/bin/{callback → operation}/prompt/removeIgnoredDependency.js +2 -2
  27. package/bin/{callback → operation}/prompt/save.js +2 -2
  28. package/bin/{callback → operation}/prompt/setBuildShellCommands.js +2 -2
  29. package/bin/{callback → operation}/prompt/setGitShellCommands.js +2 -2
  30. package/bin/{callback → operation}/prompt/setInstallShellCommands.js +2 -2
  31. package/bin/{callback → operation}/prompt/setPublishShellCommands.js +2 -2
  32. package/bin/{callback → operation}/propagateRelease.js +5 -5
  33. package/bin/{callback → operation}/retrieveRelease.js +2 -2
  34. package/bin/operation/saveAndApplyDiff.js +48 -0
  35. package/bin/operation/saveAndApplyDiffs.js +19 -0
  36. package/bin/releaseGraph.js +53 -29
  37. package/bin/utilities/{callback.js → operation.js} +9 -9
  38. package/package.json +3 -3
  39. package/bin/callback/createSubDirectoryMap.js +0 -43
  40. package/bin/callback/saveAndApplyDiff.js +0 -48
  41. package/bin/callback/saveAndApplyDiffs.js +0 -19
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
 
3
- const addDirectoryPromptCallback = require("../callback/prompt/addDirectory");
3
+ const addDirectoryPromptOperation = require("../operation/prompt/addDirectory");
4
4
 
5
- const { executeCallbacks } = require("../utilities/callback"),
5
+ const { executeOperations } = require("../utilities/operation"),
6
6
  { retrieveDirectories, updateDirectories } = require("../configuration"),
7
7
  { FAILED_ADD_DIRECTORY_MESSAGE, SUCCESSFUL_ADD_DIRECTORY_MESSAGE, DIRECTORIES_INCLUDES_DIRECTORY_MESSAGE } = require("../messages");
8
8
 
9
9
  function addDirectory() {
10
- const callbacks = [
11
- addDirectoryPromptCallback
10
+ const operations = [
11
+ addDirectoryPromptOperation
12
12
  ],
13
13
  context = {};
14
14
 
15
- executeCallbacks(callbacks, (completed) => {
15
+ executeOperations(operations, (completed) => {
16
16
  if (!completed) {
17
17
  console.log(FAILED_ADD_DIRECTORY_MESSAGE);
18
18
 
@@ -1,22 +1,22 @@
1
1
  "use strict";
2
2
 
3
- const addForcedDependentPromptCallback = require("../callback/prompt/addForcedDependent"),
4
- addForcedDependencyPromptCallback = require("../callback/prompt/addForcedDependency");
3
+ const addForcedDependentPromptOperation = require("../operation/prompt/addForcedDependent"),
4
+ addForcedDependencyPromptOperation = require("../operation/prompt/addForcedDependency");
5
5
 
6
- const { executeCallbacks } = require("../utilities/callback"),
6
+ const { executeOperations } = require("../utilities/operation"),
7
7
  { retrieveForcedDependencyRelations, updateForcedDependencyRelations } = require("../configuration"),
8
8
  { FAILED_ADD_FORCED_DEPENDENCY_RELATION_MESSAGE,
9
9
  SUCCESSFUL_ADD_FORCED_DEPENDENCY_RELATION_MESSAGE,
10
10
  FORCED_DEPENDENCY_RELATIONS_INCLUDE_FORCED_DEPENDENCY_RELATION_MESSAGE } = require("../messages");
11
11
 
12
12
  function addForcedDependencyRelation() {
13
- const callbacks = [
14
- addForcedDependencyPromptCallback,
15
- addForcedDependentPromptCallback
13
+ const operations = [
14
+ addForcedDependencyPromptOperation,
15
+ addForcedDependentPromptOperation
16
16
  ],
17
17
  context = {};
18
18
 
19
- executeCallbacks(callbacks, (completed) => {
19
+ executeOperations(operations, (completed) => {
20
20
  if (!completed) {
21
21
  console.log(FAILED_ADD_FORCED_DEPENDENCY_RELATION_MESSAGE);
22
22
 
@@ -1,20 +1,20 @@
1
1
  "use strict";
2
2
 
3
- const addIgnoredDependencyPromptCallback = require("../callback/prompt/addIgnoredDependency");
3
+ const addIgnoredDependencyPromptOperation = require("../operation/prompt/addIgnoredDependency");
4
4
 
5
- const { executeCallbacks } = require("../utilities/callback"),
5
+ const { executeOperations } = require("../utilities/operation"),
6
6
  { retrieveIgnoredDependencies, updateIgnoredDependencies } = require("../configuration"),
7
7
  { FAILED_ADD_IGNORED_DEPENDENCY_MESSAGE,
8
8
  SUCCESSFUL_ADD_IGNORED_DEPENDENCY_MESSAGE,
9
9
  IGNORED_DEPENDENCIES_INCLUDE_IGNORED_DEPENDENCY_MESSAGE } = require("../messages");
10
10
 
11
11
  function addIgnoredDependency() {
12
- const callbacks = [
13
- addIgnoredDependencyPromptCallback
12
+ const operations = [
13
+ addIgnoredDependencyPromptOperation
14
14
  ],
15
15
  context = {};
16
16
 
17
- executeCallbacks(callbacks, (completed) => {
17
+ executeOperations(operations, (completed) => {
18
18
  if (!completed) {
19
19
  console.log(FAILED_ADD_IGNORED_DEPENDENCY_MESSAGE);
20
20
 
@@ -1,31 +1,31 @@
1
1
  "use strict";
2
2
 
3
- const dryRunCallback = require("../callback/dryRun"),
4
- createDiffsCallback = require("../callback/createDiffs"),
5
- retrieveReleaseCallback = require("../callback/retrieveRelease"),
6
- createReleaseMapCallback = require("../callback/createReleaseMap"),
7
- propagateReleaseCallback = require("../callback/propagateRelease"),
8
- saveAndApplyDiffsCallback = require("../callback/saveAndApplyDiffs"),
9
- createReleaseGraphCallback = require("../callback/createReleaseGraph"),
10
- checkDevDependenciesCallback = require("../callback/checkDevDependencies"),
11
- createSubDirectoryMapCallback = require("../callback/createSubDirectoryMap"),
12
- createSubDirectoryPathCallback = require("../callback/createSubDirectoryPath");
3
+ const dryRunOperation = require("../operation/dryRun"),
4
+ createDiffsOperation = require("../operation/createDiffs"),
5
+ retrieveReleaseOperation = require("../operation/retrieveRelease"),
6
+ createReleaseMapOperation = require("../operation/createReleaseMap"),
7
+ propagateReleaseOperation = require("../operation/propagateRelease"),
8
+ saveAndApplyDiffsOperation = require("../operation/saveAndApplyDiffs"),
9
+ createReleaseGraphOperation = require("../operation/createReleaseGraph"),
10
+ checkDevDependenciesOperation = require("../operation/checkDevDependencies"),
11
+ createSubDirectoryMapOperation = require("../operation/createSubDirectoryMap"),
12
+ createSubDirectoryPathOperation = require("../operation/createSubDirectoryPath");
13
13
 
14
- const { executeCallbacks } = require("../utilities/callback"),
14
+ const { executeOperations } = require("../utilities/operation"),
15
15
  { FAILED_PROPAGATE_MESSAGE, SUCCESSFUL_PROPAGATE_MESSAGE } = require("../messages");
16
16
 
17
17
  function propagate(argument, quietly, dryRun, yes) {
18
- const callbacks = [
19
- createSubDirectoryPathCallback,
20
- createSubDirectoryMapCallback,
21
- createReleaseMapCallback,
22
- retrieveReleaseCallback,
23
- createReleaseGraphCallback,
24
- propagateReleaseCallback,
25
- createDiffsCallback,
26
- dryRunCallback,
27
- checkDevDependenciesCallback,
28
- saveAndApplyDiffsCallback
18
+ const operations = [
19
+ createSubDirectoryPathOperation,
20
+ createSubDirectoryMapOperation,
21
+ createReleaseMapOperation,
22
+ retrieveReleaseOperation,
23
+ createReleaseGraphOperation,
24
+ propagateReleaseOperation,
25
+ createDiffsOperation,
26
+ dryRunOperation,
27
+ checkDevDependenciesOperation,
28
+ saveAndApplyDiffsOperation
29
29
  ],
30
30
  context = {
31
31
  argument,
@@ -34,7 +34,7 @@ function propagate(argument, quietly, dryRun, yes) {
34
34
  yes
35
35
  };
36
36
 
37
- executeCallbacks(callbacks, (completed) => {
37
+ executeOperations(operations, (completed) => {
38
38
  if (!completed) {
39
39
  console.log(FAILED_PROPAGATE_MESSAGE);
40
40
 
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  const listDirectories = require("../action/listDirectories"),
4
- removeDirectoryPromptCallback = require("../callback/prompt/removeDirectory");
4
+ removeDirectoryPromptOperation = require("../operation/prompt/removeDirectory");
5
5
 
6
- const { executeCallbacks } = require("../utilities/callback"),
6
+ const { executeOperations } = require("../utilities/operation"),
7
7
  { updateDirectories, retrieveDirectories } = require("../configuration"),
8
8
  { FAILED_REMOVE_DIRECTORY_MESSAGE, SUCCESSFUL_REMOVE_DIRECTORY_MESSAGE } = require("../messages");
9
9
 
10
10
  function removeDirectory() {
11
- const callbacks = [
12
- removeDirectoryPromptCallback
11
+ const operations = [
12
+ removeDirectoryPromptOperation
13
13
  ],
14
14
  directoryNumbers = listDirectories(),
15
15
  directoryNumbersLength = directoryNumbers.length;
@@ -22,7 +22,7 @@ function removeDirectory() {
22
22
  directoryNumbers
23
23
  };
24
24
 
25
- executeCallbacks(callbacks, (completed) => {
25
+ executeOperations(operations, (completed) => {
26
26
  if (!completed) {
27
27
  console.log(FAILED_REMOVE_DIRECTORY_MESSAGE);
28
28
 
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  const listForcedDependencyRelations = require("../action/listForcedDependencyRelations"),
4
- removeForcedDependencyRelationPromptCallback = require("../callback/prompt/removeForcedDependencyRelation");
4
+ removeForcedDependencyRelationPromptOperation = require("../operation/prompt/removeForcedDependencyRelation");
5
5
 
6
- const { executeCallbacks } = require("../utilities/callback"),
6
+ const { executeOperations } = require("../utilities/operation"),
7
7
  { updateForcedDependencyRelations, retrieveForcedDependencyRelations } = require("../configuration"),
8
8
  { FAILED_REMOVE_FORCED_DEPENDENCY_RELATION_MESSAGE, SUCCESSFUL_REMOVE_FORCED_DEPENDENCY_RELATION_MESSAGE } = require("../messages");
9
9
 
10
10
  function removeForcedDependencyRelation() {
11
- const callbacks = [
12
- removeForcedDependencyRelationPromptCallback
11
+ const operations = [
12
+ removeForcedDependencyRelationPromptOperation
13
13
  ],
14
14
  forcedDependencyRelationNumbers = listForcedDependencyRelations(),
15
15
  forcedDependencyRelationNumbersLength = forcedDependencyRelationNumbers.length;
@@ -22,7 +22,7 @@ function removeForcedDependencyRelation() {
22
22
  forcedDependencyRelationNumbers
23
23
  };
24
24
 
25
- executeCallbacks(callbacks, (completed) => {
25
+ executeOperations(operations, (completed) => {
26
26
  if (!completed) {
27
27
  console.log(FAILED_REMOVE_FORCED_DEPENDENCY_RELATION_MESSAGE);
28
28
 
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  const listIgnoredDependencies = require("../action/listIgnoredDependencies"),
4
- removeIgnoredDependencyPromptCallback = require("../callback/prompt/removeIgnoredDependency");
4
+ removeIgnoredDependencyPromptOperation = require("../operation/prompt/removeIgnoredDependency");
5
5
 
6
- const { executeCallbacks } = require("../utilities/callback"),
6
+ const { executeOperations } = require("../utilities/operation"),
7
7
  { updateIgnoredDependencies, retrieveIgnoredDependencies } = require("../configuration"),
8
8
  { FAILED_REMOVE_IGNORED_DEPENDENCY_MESSAGE, SUCCESSFUL_REMOVE_IGNORED_DEPENDENCY_MESSAGE } = require("../messages");
9
9
 
10
10
  function removeIgnoredDependency() {
11
- const callbacks = [
12
- removeIgnoredDependencyPromptCallback
11
+ const operations = [
12
+ removeIgnoredDependencyPromptOperation
13
13
  ],
14
14
  ignoredDependencyNumbers = listIgnoredDependencies(),
15
15
  ignoredDependencyNumbersLength = ignoredDependencyNumbers.length;
@@ -22,7 +22,7 @@ function removeIgnoredDependency() {
22
22
  ignoredDependencyNumbers
23
23
  };
24
24
 
25
- executeCallbacks(callbacks, (completed) => {
25
+ executeOperations(operations, (completed) => {
26
26
  if (!completed) {
27
27
  console.log(FAILED_REMOVE_IGNORED_DEPENDENCY_MESSAGE);
28
28
 
@@ -1,27 +1,27 @@
1
1
  "use strict";
2
2
 
3
- const setGitShellCommandsPromptCallback = require("../callback/prompt/setGitShellCommands"),
4
- setBuildShellCommandsPromptCallback = require("../callback/prompt/setBuildShellCommands"),
5
- setInstallShellCommandsPromptCallback = require("../callback/prompt/setInstallShellCommands"),
6
- setPublishShellCommandsPromptCallback = require("../callback/prompt/setPublishShellCommands");
3
+ const setGitShellCommandsPromptOperation = require("../operation/prompt/setGitShellCommands"),
4
+ setBuildShellCommandsPromptOperation = require("../operation/prompt/setBuildShellCommands"),
5
+ setInstallShellCommandsPromptOperation = require("../operation/prompt/setInstallShellCommands"),
6
+ setPublishShellCommandsPromptOperation = require("../operation/prompt/setPublishShellCommands");
7
7
 
8
- const { executeCallbacks } = require("../utilities/callback"),
8
+ const { executeOperations } = require("../utilities/operation"),
9
9
  { retrieveShellCommands, updateShellCommands } = require("../configuration"),
10
10
  { FAILED_SET_SHELL_COMMANDS_MESSAGE, SUCCESSFUL_SET_SHELL_COMMANDS_MESSAGE } = require("../messages");
11
11
 
12
12
  function setShellCommands() {
13
- const callbacks = [
14
- setGitShellCommandsPromptCallback,
15
- setInstallShellCommandsPromptCallback,
16
- setBuildShellCommandsPromptCallback,
17
- setPublishShellCommandsPromptCallback,
13
+ const operations = [
14
+ setGitShellCommandsPromptOperation,
15
+ setInstallShellCommandsPromptOperation,
16
+ setBuildShellCommandsPromptOperation,
17
+ setPublishShellCommandsPromptOperation,
18
18
  ],
19
19
  shellCommands = retrieveShellCommands(),
20
20
  context = {
21
21
  shellCommands
22
22
  };
23
23
 
24
- executeCallbacks(callbacks, (completed) => {
24
+ executeOperations(operations, (completed) => {
25
25
  if (!completed) {
26
26
  console.log(FAILED_SET_SHELL_COMMANDS_MESSAGE);
27
27
 
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function checkDevDependenciesCallback(proceed, abort, context) {
3
+ function checkDevDependenciesOperation(proceed, abort, context) {
4
4
  const { diffs } = context,
5
5
  names = [],
6
6
  devDependencyMissing = diffs.some((diff) => {
@@ -39,4 +39,4 @@ function checkDevDependenciesCallback(proceed, abort, context) {
39
39
  proceed();
40
40
  }
41
41
 
42
- module.exports = checkDevDependenciesCallback;
42
+ module.exports = checkDevDependenciesOperation;
@@ -2,7 +2,7 @@
2
2
 
3
3
  const Diff = require("../diff");
4
4
 
5
- function createDiffsCallback(proceed, abort, context) {
5
+ function createDiffsOperation(proceed, abort, context) {
6
6
  let { releases } = context;
7
7
 
8
8
  const { release, releaseGraph, dependentReleasesLength } = context,
@@ -36,7 +36,7 @@ function createDiffsCallback(proceed, abort, context) {
36
36
  proceed();
37
37
  }
38
38
 
39
- module.exports = createDiffsCallback;
39
+ module.exports = createDiffsOperation;
40
40
 
41
41
  function sortReleases(releases, orderedSubDirectoryPaths) {
42
42
  releases.sort((releaseA, releaseB) => {
@@ -8,7 +8,7 @@ const { consoleLogSubDirectoryPathsCycle } = require('../utilities/console'),
8
8
 
9
9
  const { AT_LEAST_ONE_CYCLIC_DEPENDENCY_MESSAGE, AT_LEAST_ONE_CYCLIC_DEV_DEPENDENCY_MESSAGE } = messages;
10
10
 
11
- function createReleaseGraphCallback(proceed, abort, context) {
11
+ function createReleaseGraphOperation(proceed, abort, context) {
12
12
  const { releaseMap, subDirectoryMap } = context,
13
13
  forcedDependencyRelations = retrieveForcedDependencyRelations(),
14
14
  releaseGraph = ReleaseGraph.fromReleaseMapSubDirectoryMapAndForcedDependencyRelations(releaseMap, subDirectoryMap, forcedDependencyRelations),
@@ -46,4 +46,4 @@ function createReleaseGraphCallback(proceed, abort, context) {
46
46
  proceed();
47
47
  }
48
48
 
49
- module.exports = createReleaseGraphCallback;
49
+ module.exports = createReleaseGraphOperation;
@@ -4,7 +4,7 @@ const ReleaseMap = require("../releaseMap");
4
4
 
5
5
  const { retrieveIgnoredDependencies } = require("../configuration");
6
6
 
7
- function createReleaseMapCallback(proceed, abort, context) {
7
+ function createReleaseMapOperation(proceed, abort, context) {
8
8
  const { subDirectoryMap } = context,
9
9
  ignoredDependencies = retrieveIgnoredDependencies(),
10
10
  releaseMap = ReleaseMap.fromSubDirectoryMapAndIgnoredDependencies(subDirectoryMap, ignoredDependencies);
@@ -16,4 +16,4 @@ function createReleaseMapCallback(proceed, abort, context) {
16
16
  proceed();
17
17
  }
18
18
 
19
- module.exports = createReleaseMapCallback;
19
+ module.exports = createReleaseMapOperation;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ const { fileSystemUtilities } = require("necessary");
4
+
5
+ const { retrieveDirectories } = require("../configuration"),
6
+ { absolutePathFromName } = require("../utilities/path"),
7
+ { DEFAULT_DIRECTORY_NAME } = require("../defaults");
8
+
9
+ const { readDirectory, isEntryDirectory } = fileSystemUtilities;
10
+
11
+ function createSubDirectoryMapOperation(proceed, abort, context) {
12
+ const subDirectoryMap = {},
13
+ directories = retrieveDirectories(),
14
+ directoryNames = [
15
+ DEFAULT_DIRECTORY_NAME,
16
+ ...directories
17
+ ];
18
+
19
+ directoryNames.forEach((directoryName) => {
20
+ try {
21
+ const absoluteDirectoryPath = absolutePathFromName(directoryName),
22
+ entryNames = readDirectory(absoluteDirectoryPath);
23
+
24
+ entryNames.forEach((entryName) => {
25
+ const entryPath = `${directoryName}/${entryName}`,
26
+ entryDirectory = isEntryDirectory(entryPath);
27
+
28
+ if (entryDirectory) {
29
+ const subDirectoryName = entryName, ///
30
+ subDirectoryPath = entryPath; ///
31
+
32
+ subDirectoryMap[subDirectoryName] = subDirectoryPath;
33
+ }
34
+ });
35
+ } catch (error) {
36
+ console.log(`The '${directoryName}' directory cannot be read.`);
37
+
38
+ process.exit(1);
39
+ }
40
+ });
41
+
42
+ Object.assign(context, {
43
+ subDirectoryMap
44
+ });
45
+
46
+ proceed();
47
+ }
48
+
49
+ module.exports = createSubDirectoryMapOperation;
@@ -4,7 +4,7 @@ const { DEFAULT_DIRECTORY_NAME } = require("../defaults"),
4
4
  { retrieveIgnoredDependencies } = require("../configuration"),
5
5
  { NO_SUB_DIRECTORY_SPECIFIED_MESSAGE, IGNORED_DEPENDENCIES_INCLUDE_SUB_DIRECTORY_MESSAGE } = require("../messages");
6
6
 
7
- function createSubDirectoryPathCallback(proceed, abort, context) {
7
+ function createSubDirectoryPathOperation(proceed, abort, context) {
8
8
  const { argument } = context;
9
9
 
10
10
  if (argument === null) {
@@ -37,4 +37,4 @@ function createSubDirectoryPathCallback(proceed, abort, context) {
37
37
  proceed();
38
38
  }
39
39
 
40
- module.exports = createSubDirectoryPathCallback;
40
+ module.exports = createSubDirectoryPathOperation;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function dryRunCallback(proceed, abort, context) {
3
+ function dryRunOperation(proceed, abort, context) {
4
4
  const { diffs, dryRun } = context;
5
5
 
6
6
  if (dryRun) {
@@ -14,4 +14,4 @@ function dryRunCallback(proceed, abort, context) {
14
14
  proceed();
15
15
  }
16
16
 
17
- module.exports = dryRunCallback;
17
+ module.exports = dryRunOperation;
@@ -8,7 +8,7 @@ const { validateDirectoryPath } = require("../../utilities/validate"),
8
8
 
9
9
  const { prompt } = shellUtilities;
10
10
 
11
- function addDirectoryPromptCallback(proceed, abort, context) {
11
+ function addDirectoryPromptOperation(proceed, abort, context) {
12
12
  const description = DIRECTORY_PATH_DESCRIPTION,
13
13
  errorMessage = INVALID_DIRECTORY_PATH_MESSAGE,
14
14
  validationFunction = validateDirectoryPath, ///
@@ -38,4 +38,4 @@ function addDirectoryPromptCallback(proceed, abort, context) {
38
38
  });
39
39
  }
40
40
 
41
- module.exports = addDirectoryPromptCallback;
41
+ module.exports = addDirectoryPromptOperation;
@@ -8,7 +8,7 @@ const { validateForcedDependencyName } = require("../../utilities/validate"),
8
8
 
9
9
  const { prompt } = shellUtilities;
10
10
 
11
- function addForcedDependencyPromptCallback(proceed, abort, context) {
11
+ function addForcedDependencyPromptOperation(proceed, abort, context) {
12
12
  const description = FORCED_DEPENDENCY_DESCRIPTION,
13
13
  errorMessage = INVALID_FORCED_DEPENDENCY_NAME_MESSAGE,
14
14
  validationFunction = validateForcedDependencyName, ///
@@ -38,4 +38,4 @@ function addForcedDependencyPromptCallback(proceed, abort, context) {
38
38
  });
39
39
  }
40
40
 
41
- module.exports = addForcedDependencyPromptCallback;
41
+ module.exports = addForcedDependencyPromptOperation;
@@ -8,7 +8,7 @@ const { validateForcedDependentName } = require("../../utilities/validate"),
8
8
 
9
9
  const { prompt } = shellUtilities;
10
10
 
11
- function addForcedDependentPromptCallback(proceed, abort, context) {
11
+ function addForcedDependentPromptOperation(proceed, abort, context) {
12
12
  const description = FORCED_DEPENDENT_DESCRIPTION,
13
13
  errorMessage = INVALID_FORCED_DEPENDENT_NAME_MESSAGE,
14
14
  validationFunction = validateForcedDependentName, ///
@@ -38,4 +38,4 @@ function addForcedDependentPromptCallback(proceed, abort, context) {
38
38
  });
39
39
  }
40
40
 
41
- module.exports = addForcedDependentPromptCallback;
41
+ module.exports = addForcedDependentPromptOperation;
@@ -8,7 +8,7 @@ const { validateIgnoredDependencyName } = require("../../utilities/validate"),
8
8
 
9
9
  const { prompt } = shellUtilities;
10
10
 
11
- function addIgnoredDependencyPromptCallback(proceed, abort, context) {
11
+ function addIgnoredDependencyPromptOperation(proceed, abort, context) {
12
12
  const description = IGNORED_DEPENDENCY_DESCRIPTION,
13
13
  errorMessage = INVALID_IGNORED_DEPENDENCY_NAME_MESSAGE,
14
14
  validationFunction = validateIgnoredDependencyName, ///
@@ -38,4 +38,4 @@ function addIgnoredDependencyPromptCallback(proceed, abort, context) {
38
38
  });
39
39
  }
40
40
 
41
- module.exports = addIgnoredDependencyPromptCallback;
41
+ module.exports = addIgnoredDependencyPromptOperation;
@@ -11,7 +11,7 @@ const { YES } = require("../../constants"),
11
11
 
12
12
  const { prompt } = shellUtilities;
13
13
 
14
- function buildPromptCallback(proceed, abort, context) {
14
+ function buildPromptOperation(proceed, abort, context) {
15
15
  const { yes, diff, diffs, quietly } = context;
16
16
 
17
17
  const answer = yes ?
@@ -62,4 +62,4 @@ function buildPromptCallback(proceed, abort, context) {
62
62
  });
63
63
  }
64
64
 
65
- module.exports = buildPromptCallback;
65
+ module.exports = buildPromptOperation;
@@ -11,7 +11,7 @@ const { YES } = require("../../constants"),
11
11
 
12
12
  const { prompt } = shellUtilities;
13
13
 
14
- function gitPromptCallback(proceed, abort, context) {
14
+ function gitPromptOperation(proceed, abort, context) {
15
15
  const { yes, diff, diffs, quietly } = context;
16
16
 
17
17
  const answer = yes ?
@@ -62,4 +62,4 @@ function gitPromptCallback(proceed, abort, context) {
62
62
  });
63
63
  }
64
64
 
65
- module.exports = gitPromptCallback;
65
+ module.exports = gitPromptOperation;
@@ -11,7 +11,7 @@ const { YES } = require("../../constants"),
11
11
 
12
12
  const { prompt } = shellUtilities;
13
13
 
14
- function installPromptCallback(proceed, abort, context) {
14
+ function installPromptOperation(proceed, abort, context) {
15
15
  const { yes, diff, diffs, quietly } = context;
16
16
 
17
17
  const answer = yes ?
@@ -62,4 +62,4 @@ function installPromptCallback(proceed, abort, context) {
62
62
  });
63
63
  }
64
64
 
65
- module.exports = installPromptCallback;
65
+ module.exports = installPromptOperation;
@@ -12,7 +12,7 @@ const { YES } = require("../../constants"),
12
12
 
13
13
  const { prompt } = shellUtilities;
14
14
 
15
- function publishPromptCallback(proceed, abort, context) {
15
+ function publishPromptOperation(proceed, abort, context) {
16
16
  const { yes, diff, diffs, quietly } = context,
17
17
  publishable = diff.isPublishable();
18
18
 
@@ -76,4 +76,4 @@ function publishPromptCallback(proceed, abort, context) {
76
76
  });
77
77
  }
78
78
 
79
- module.exports = publishPromptCallback;
79
+ module.exports = publishPromptOperation;
@@ -8,7 +8,7 @@ const { validateDirectoryNumber } = require("../../utilities/validate"),
8
8
 
9
9
  const { prompt } = shellUtilities;
10
10
 
11
- function removeDirectoryPromptCallback(proceed, abort, context) {
11
+ function removeDirectoryPromptOperation(proceed, abort, context) {
12
12
  const description = SPECIFY_DIRECTORY_TO_REMOVE_DESCRIPTION,
13
13
  errorMessage = INVALID_DIRECTORY_NUMBER_MESSAGE,
14
14
  { directoryNumbers } = context,
@@ -43,4 +43,4 @@ function removeDirectoryPromptCallback(proceed, abort, context) {
43
43
  });
44
44
  }
45
45
 
46
- module.exports = removeDirectoryPromptCallback;
46
+ module.exports = removeDirectoryPromptOperation;
@@ -8,7 +8,7 @@ const { validateForcedDependencyRelationNumber } = require("../../utilities/vali
8
8
 
9
9
  const { prompt } = shellUtilities;
10
10
 
11
- function removeForcedDependencyRelationPromptCallback(proceed, abort, context) {
11
+ function removeForcedDependencyRelationPromptOperation(proceed, abort, context) {
12
12
  const description = SPECIFY_FORCED_DEPENDENCY_RELATION_TO_REMOVE_DESCRIPTION,
13
13
  errorMessage = INVALID_FORCED_DEPENDENCY_RELATION_NUMBER_MESSAGE,
14
14
  { forcedDependencyRelationNumbers } = context,
@@ -43,4 +43,4 @@ function removeForcedDependencyRelationPromptCallback(proceed, abort, context) {
43
43
  });
44
44
  }
45
45
 
46
- module.exports = removeForcedDependencyRelationPromptCallback;
46
+ module.exports = removeForcedDependencyRelationPromptOperation;
@@ -8,7 +8,7 @@ const { validateIgnoredDependencyNumber } = require("../../utilities/validate"),
8
8
 
9
9
  const { prompt } = shellUtilities;
10
10
 
11
- function removeIgnoredDependencyPromptCallback(proceed, abort, context) {
11
+ function removeIgnoredDependencyPromptOperation(proceed, abort, context) {
12
12
  const description = SPECIFY_IGNORED_DEPENDENCY_TO_REMOVE_DESCRIPTION,
13
13
  errorMessage = INVALID_IGNORED_DEPENDENCY_NUMBER_MESSAGE,
14
14
  { ignoredDependencyNumbers } = context,
@@ -43,4 +43,4 @@ function removeIgnoredDependencyPromptCallback(proceed, abort, context) {
43
43
  });
44
44
  }
45
45
 
46
- module.exports = removeIgnoredDependencyPromptCallback;
46
+ module.exports = removeIgnoredDependencyPromptOperation;
@@ -12,7 +12,7 @@ const { YES } = require("../../constants"),
12
12
 
13
13
  const { prompt } = shellUtilities;
14
14
 
15
- function savePromptCallback(proceed, abort, context) {
15
+ function savePromptOperation(proceed, abort, context) {
16
16
  const { yes, diff, diffs } = context,
17
17
  diffString = diff.asString();
18
18
 
@@ -70,4 +70,4 @@ function savePromptCallback(proceed, abort, context) {
70
70
  });
71
71
  }
72
72
 
73
- module.exports = savePromptCallback;
73
+ module.exports = savePromptOperation;
@@ -9,7 +9,7 @@ const { EMPTY_STRING } = require("../../constants"),
9
9
 
10
10
  const { prompt } = shellUtilities;
11
11
 
12
- function setBuildShellCommandsPromptCallback(proceed, abort, context) {
12
+ function setBuildShellCommandsPromptOperation(proceed, abort, context) {
13
13
  const { shellCommands } = context,
14
14
  { build } = shellCommands,
15
15
  buildShellCommands = build, ///
@@ -36,4 +36,4 @@ function setBuildShellCommandsPromptCallback(proceed, abort, context) {
36
36
  });
37
37
  }
38
38
 
39
- module.exports = setBuildShellCommandsPromptCallback;
39
+ module.exports = setBuildShellCommandsPromptOperation;
@@ -9,7 +9,7 @@ const { EMPTY_STRING } = require("../../constants"),
9
9
 
10
10
  const { prompt } = shellUtilities;
11
11
 
12
- function setGitShellCommandsPromptCallback(proceed, abort, context) {
12
+ function setGitShellCommandsPromptOperation(proceed, abort, context) {
13
13
  const { shellCommands } = context,
14
14
  { git } = shellCommands,
15
15
  gitShellCommands = git, ///
@@ -36,4 +36,4 @@ function setGitShellCommandsPromptCallback(proceed, abort, context) {
36
36
  });
37
37
  }
38
38
 
39
- module.exports = setGitShellCommandsPromptCallback;
39
+ module.exports = setGitShellCommandsPromptOperation;
@@ -9,7 +9,7 @@ const { EMPTY_STRING } = require("../../constants"),
9
9
 
10
10
  const { prompt } = shellUtilities;
11
11
 
12
- function setInstallShellCommandsPromptCallback(proceed, abort, context) {
12
+ function setInstallShellCommandsPromptOperation(proceed, abort, context) {
13
13
  const { shellCommands } = context,
14
14
  { install } = shellCommands,
15
15
  installShellCommands = install, ///
@@ -36,4 +36,4 @@ function setInstallShellCommandsPromptCallback(proceed, abort, context) {
36
36
  });
37
37
  }
38
38
 
39
- module.exports = setInstallShellCommandsPromptCallback;
39
+ module.exports = setInstallShellCommandsPromptOperation;
@@ -9,7 +9,7 @@ const { EMPTY_STRING } = require("../../constants"),
9
9
 
10
10
  const { prompt } = shellUtilities;
11
11
 
12
- function setPublishShellCommandsPromptCallback(proceed, abort, context) {
12
+ function setPublishShellCommandsPromptOperation(proceed, abort, context) {
13
13
  const { shellCommands } = context,
14
14
  { publish } = shellCommands,
15
15
  publishShellCommands = publish, ///
@@ -36,4 +36,4 @@ function setPublishShellCommandsPromptCallback(proceed, abort, context) {
36
36
  });
37
37
  }
38
38
 
39
- module.exports = setPublishShellCommandsPromptCallback;
39
+ module.exports = setPublishShellCommandsPromptOperation;
@@ -3,7 +3,7 @@
3
3
  const { isDependencyRelationForced } = require("../utilities/dependency"),
4
4
  { retrieveForcedDependencyRelations } = require("../configuration");
5
5
 
6
- function propagateReleaseCallback(proceed, abort, context) {
6
+ function propagateReleaseOperation(proceed, abort, context) {
7
7
  const { release, releaseMap, releaseGraph, subDirectoryMap } = context,
8
8
  forcedDependencyRelations = retrieveForcedDependencyRelations(),
9
9
  releases = [];
@@ -23,7 +23,7 @@ function propagateReleaseCallback(proceed, abort, context) {
23
23
  proceed();
24
24
  }
25
25
 
26
- module.exports = propagateReleaseCallback;
26
+ module.exports = propagateReleaseOperation;
27
27
 
28
28
  function propagateDependencies(release, releases, releaseMap, releaseGraph, subDirectoryMap, forcedDependencyRelations) {
29
29
  const releasesIncludesRelease = releases.includes(release);
@@ -53,11 +53,11 @@ function propagateDependencies(release, releases, releaseMap, releaseGraph, subD
53
53
 
54
54
  if (!dependencyRelationForced) {
55
55
  dependentRelease.updateDependencyVersion(name, versionString);
56
- }
57
56
 
58
- const release = dependentRelease; ///
57
+ const release = dependentRelease; ///
59
58
 
60
- propagateDependencies(release, releases, releaseMap, releaseGraph, subDirectoryMap, forcedDependencyRelations);
59
+ propagateDependencies(release, releases, releaseMap, releaseGraph, subDirectoryMap, forcedDependencyRelations);
60
+ }
61
61
  });
62
62
  }
63
63
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  const { NO_RELEASE_MESSAGE, RELEASE_NOT_PUBLISHABLE_MESSAGE } = require("../messages");
4
4
 
5
- function retrieveReleaseCallback(proceed, abort, context) {
5
+ function retrieveReleaseOperation(proceed, abort, context) {
6
6
  const { subDirectoryPath, releaseMap } = context,
7
7
  release = releaseMap.retrieveRelease(subDirectoryPath);
8
8
 
@@ -31,4 +31,4 @@ function retrieveReleaseCallback(proceed, abort, context) {
31
31
  proceed();
32
32
  }
33
33
 
34
- module.exports = retrieveReleaseCallback;
34
+ module.exports = retrieveReleaseOperation;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ const gitPromptOperation = require("../operation/prompt/git"),
4
+ savePromptOperation = require("../operation/prompt/save"),
5
+ buildPromptOperation = require("../operation/prompt/build"),
6
+ installPromptOperation = require("../operation/prompt/install"),
7
+ publishPromptOperation = require("../operation/prompt/publish");
8
+
9
+ const { EMPTY_STRING } = require("../constants"),
10
+ { executeOperations } = require("../utilities/operation");
11
+
12
+ function saveAndApplyDiffOperation(diff, proceed, abort, context) {
13
+ const { diffs } = context,
14
+ index = diffs.indexOf(diff);
15
+
16
+ if (index > 0) {
17
+ const dependencyMapDiffEmpty = diff.isDependencyMapDiffEmpty(),
18
+ devDependencyMapDiffEmpty = diff.isDevDependencyMapDiffEmpty();
19
+
20
+ if (dependencyMapDiffEmpty && devDependencyMapDiffEmpty) {
21
+ proceed();
22
+
23
+ return;
24
+ }
25
+ }
26
+
27
+ Object.assign(context, {
28
+ diff
29
+ });
30
+
31
+ const operations = [
32
+ savePromptOperation,
33
+ installPromptOperation,
34
+ buildPromptOperation,
35
+ gitPromptOperation,
36
+ publishPromptOperation
37
+ ];
38
+
39
+ console.log(EMPTY_STRING);
40
+
41
+ executeOperations(operations, (completed) => {
42
+ delete context.diff;
43
+
44
+ proceed();
45
+ }, context);
46
+ }
47
+
48
+ module.exports = saveAndApplyDiffOperation;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ const saveAndApplyDiffOperation = require("../operation/saveAndApplyDiff");
4
+
5
+ const { executeOperation } = require("../utilities/operation");
6
+
7
+ function saveAndApplyDiffsOperation(proceed, abort, context) {
8
+ const { diffs, dryRun } = context;
9
+
10
+ if (dryRun) {
11
+ proceed();
12
+
13
+ return;
14
+ }
15
+
16
+ executeOperation(diffs, saveAndApplyDiffOperation, proceed, abort, context);
17
+ }
18
+
19
+ module.exports = saveAndApplyDiffsOperation;
@@ -98,9 +98,12 @@ class ReleaseGraph {
98
98
 
99
99
  dependencyDirectedGraph.addVerticesByVertexNames(vertexNames);
100
100
 
101
+ devDependencyDirectedGraph.addVerticesByVertexNames(vertexNames);
102
+
101
103
  subDirectoryPaths.forEach((subDirectoryPath) => {
102
104
  const release = releaseMap.retrieveRelease(subDirectoryPath),
103
- releaseDependencyNames = release.getDependencyNames();
105
+ releaseDependencyNames = release.getDependencyNames(),
106
+ releaseDevDependencyNames = release.getDevDependencyNames();
104
107
 
105
108
  releaseDependencyNames.forEach((releaseDependencyName) => {
106
109
  const releaseNamesIncludesReleaseDependencyName = releaseNames.includes(releaseDependencyName);
@@ -113,34 +116,6 @@ class ReleaseGraph {
113
116
  dependencyDirectedGraph.addEdgeByVertexNames(sourceVertexName, targetVertexName);
114
117
  }
115
118
  });
116
- });
117
-
118
- forcedDependencyRelations.forEach((forcedDependencyRelation) => {
119
- const { dependent } = forcedDependencyRelation,
120
- subDirectoryName = dependent, //
121
- subDirectoryPath = subDirectoryMap[subDirectoryName], ///
122
- release = releaseMap.retrieveRelease(subDirectoryPath);
123
-
124
- if (release !== null) {
125
- const { dependency } = forcedDependencyRelation,
126
- dependencySubDirectoryName = dependency, ///
127
- dependencySubDirectoryPath = subDirectoryMap[dependencySubDirectoryName], ///
128
- dependencyRelease = releaseMap.retrieveRelease(dependencySubDirectoryPath);
129
-
130
- if (dependencyRelease) {
131
- const sourceVertexName = dependencySubDirectoryPath, ///
132
- targetVertexName = subDirectoryPath; ///
133
-
134
- dependencyDirectedGraph.addEdgeByVertexNames(sourceVertexName, targetVertexName);
135
- }
136
- }
137
- });
138
-
139
- devDependencyDirectedGraph.addVerticesByVertexNames(vertexNames);
140
-
141
- subDirectoryPaths.forEach((subDirectoryPath) => {
142
- const release = releaseMap.retrieveRelease(subDirectoryPath),
143
- releaseDevDependencyNames = release.getDevDependencyNames();
144
119
 
145
120
  releaseDevDependencyNames.forEach((releaseDevDependencyName) => {
146
121
  const releaseNamesIncludesReleaseDevDependencyName = releaseNames.includes(releaseDevDependencyName);
@@ -155,6 +130,55 @@ class ReleaseGraph {
155
130
  });
156
131
  });
157
132
 
133
+ forcedDependencyRelations.forEach((forcedDependencyRelation) => {
134
+ const { dependent } = forcedDependencyRelation,
135
+ dependentSubDirectoryName = dependent, //
136
+ dependentSubDirectoryPath = subDirectoryMap[dependentSubDirectoryName], ///
137
+ dependentRelease = releaseMap.retrieveRelease(dependentSubDirectoryPath);
138
+
139
+ if (dependentRelease === null) {
140
+ console.log(`The '${dependent}' forced dependent does not exist.`);
141
+
142
+ process.exit(1);
143
+ }
144
+
145
+ const { dependency } = forcedDependencyRelation,
146
+ dependencySubDirectoryName = dependency, ///
147
+ dependencySubDirectoryPath = subDirectoryMap[dependencySubDirectoryName], ///
148
+ dependencyRelease = releaseMap.retrieveRelease(dependencySubDirectoryPath);
149
+
150
+ if (dependencyRelease === null) {
151
+ console.log(`The '${dependency}' forced dependency does not exist.`);
152
+
153
+ process.exit(1);
154
+ }
155
+
156
+ const sourceVertexName = dependencySubDirectoryPath, ///
157
+ targetVertexName = dependentSubDirectoryPath; ///
158
+
159
+ const dependencyDirectedGraphEdgePresent = dependencyDirectedGraph.isEdgePresentByVertexNames(sourceVertexName, targetVertexName),
160
+ dependencyRelationPresent = dependencyDirectedGraphEdgePresent; ///
161
+
162
+ if (dependencyRelationPresent) {
163
+ console.log(`The '${dependency}' -> '${dependent}' dependency relation is present and therefore cannot be forced.`);
164
+
165
+ process.exit(1);
166
+ }
167
+
168
+ const devDependencyDirectedGraphEdgePresent = devDependencyDirectedGraph.isEdgePresentByVertexNames(sourceVertexName, targetVertexName),
169
+ devDependencyRelationPresent = devDependencyDirectedGraphEdgePresent; ///
170
+
171
+ if (!devDependencyRelationPresent) {
172
+ console.log(`The '${dependency}' -> '${dependent}' developer dependency relation is not present and therefore cannot be forced.`);
173
+
174
+ process.exit(1);
175
+ }
176
+
177
+ if (dependencyRelease) {
178
+ dependencyDirectedGraph.addEdgeByVertexNames(sourceVertexName, targetVertexName);
179
+ }
180
+ });
181
+
158
182
  const releaseGraph = new ReleaseGraph(dependencyDirectedGraph, devDependencyDirectedGraph);
159
183
 
160
184
  return releaseGraph;
@@ -4,7 +4,7 @@ const { asynchronousUtilities } = require("necessary");
4
4
 
5
5
  const { forEach, whilst } = asynchronousUtilities;
6
6
 
7
- function executeCallback(array, callback, proceed, abort, context) {
7
+ function executeOperation(array, operation, proceed, abort, context) {
8
8
  let completed = true;
9
9
 
10
10
  forEach(array, (element, next, done, context) => {
@@ -15,7 +15,7 @@ function executeCallback(array, callback, proceed, abort, context) {
15
15
  done();
16
16
  }
17
17
 
18
- callback(element, proceed, abort, context);
18
+ operation(element, proceed, abort, context);
19
19
  }, done, context);
20
20
 
21
21
  function done() {
@@ -25,11 +25,11 @@ function executeCallback(array, callback, proceed, abort, context) {
25
25
  }
26
26
  }
27
27
 
28
- function executeCallbacks(callbacks, callback, context) {
28
+ function executeOperations(operations, callback, context) {
29
29
  let completed = true;
30
30
 
31
- const callbacksLength = callbacks.length,
32
- lastIndex = callbacksLength - 1;
31
+ const operationsLength = operations.length,
32
+ lastIndex = operationsLength - 1;
33
33
 
34
34
  whilst((next, done, context, index) => {
35
35
  if (index > lastIndex) {
@@ -38,7 +38,7 @@ function executeCallbacks(callbacks, callback, context) {
38
38
  return;
39
39
  }
40
40
 
41
- const callback = callbacks[index],
41
+ const operation = operations[index],
42
42
  proceed = next, ///
43
43
  abort = () => {
44
44
  completed = false;
@@ -46,7 +46,7 @@ function executeCallbacks(callbacks, callback, context) {
46
46
  done();
47
47
  };
48
48
 
49
- callback(proceed, abort, context);
49
+ operation(proceed, abort, context);
50
50
  }, done, context);
51
51
 
52
52
  function done() {
@@ -55,6 +55,6 @@ function executeCallbacks(callbacks, callback, context) {
55
55
  }
56
56
 
57
57
  module.exports = {
58
- executeCallback,
59
- executeCallbacks
58
+ executeOperation,
59
+ executeOperations
60
60
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "propagate-cli",
3
3
  "author": "James Smith",
4
- "version": "1.9.6",
4
+ "version": "1.9.11",
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.15",
17
- "necessary": "^10.0.0",
18
- "occam-directed-graphs": "^3.0.17"
17
+ "necessary": "^10.0.7",
18
+ "occam-directed-graphs": "^3.0.23"
19
19
  },
20
20
  "devDependencies": {},
21
21
  "scripts": {}
@@ -1,43 +0,0 @@
1
- "use strict";
2
-
3
- const { fileSystemUtilities } = require("necessary");
4
-
5
- const { retrieveDirectories } = require("../configuration"),
6
- { absolutePathFromName } = require("../utilities/path"),
7
- { DEFAULT_DIRECTORY_NAME } = require("../defaults");
8
-
9
- const { readDirectory, isEntryDirectory } = fileSystemUtilities;
10
-
11
- function createSubDirectoryMapCallback(proceed, abort, context) {
12
- const subDirectoryMap = {},
13
- directories = retrieveDirectories(),
14
- directoryNames = [
15
- DEFAULT_DIRECTORY_NAME,
16
- ...directories
17
- ];
18
-
19
- directoryNames.forEach((directoryName) => {
20
- const absoluteDirectoryPath = absolutePathFromName(directoryName),
21
- entryNames = readDirectory(absoluteDirectoryPath);
22
-
23
- entryNames.forEach((entryName) => {
24
- const entryPath = `${directoryName}/${entryName}`,
25
- entryDirectory = isEntryDirectory(entryPath);
26
-
27
- if (entryDirectory) {
28
- const subDirectoryName = entryName, ///
29
- subDirectoryPath = entryPath; ///
30
-
31
- subDirectoryMap[subDirectoryName] = subDirectoryPath;
32
- }
33
- });
34
- });
35
-
36
- Object.assign(context, {
37
- subDirectoryMap
38
- });
39
-
40
- proceed();
41
- }
42
-
43
- module.exports = createSubDirectoryMapCallback;
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- const gitPromptCallback = require("../callback/prompt/git"),
4
- savePromptCallback = require("../callback/prompt/save"),
5
- buildPromptCallback = require("../callback/prompt/build"),
6
- installPromptCallback = require("../callback/prompt/install"),
7
- publishPromptCallback = require("../callback/prompt/publish");
8
-
9
- const { EMPTY_STRING } = require("../constants"),
10
- { executeCallbacks } = require("../utilities/callback");
11
-
12
- function saveAndApplyDiffCallback(diff, proceed, abort, context) {
13
- const { diffs } = context,
14
- index = diffs.indexOf(diff);
15
-
16
- if (index > 0) {
17
- const dependencyMapDiffEmpty = diff.isDependencyMapDiffEmpty(),
18
- devDependencyMapDiffEmpty = diff.isDevDependencyMapDiffEmpty();
19
-
20
- if (dependencyMapDiffEmpty && devDependencyMapDiffEmpty) {
21
- proceed();
22
-
23
- return;
24
- }
25
- }
26
-
27
- Object.assign(context, {
28
- diff
29
- });
30
-
31
- const callbacks = [
32
- savePromptCallback,
33
- installPromptCallback,
34
- buildPromptCallback,
35
- gitPromptCallback,
36
- publishPromptCallback
37
- ];
38
-
39
- console.log(EMPTY_STRING);
40
-
41
- executeCallbacks(callbacks, (completed) => {
42
- delete context.diff;
43
-
44
- proceed();
45
- }, context);
46
- }
47
-
48
- module.exports = saveAndApplyDiffCallback;
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- const saveAndApplyDiffCallback = require("../callback/saveAndApplyDiff");
4
-
5
- const { executeCallback } = require("../utilities/callback");
6
-
7
- function saveAndApplyDiffsCallback(proceed, abort, context) {
8
- const { diffs, dryRun } = context;
9
-
10
- if (dryRun) {
11
- proceed();
12
-
13
- return;
14
- }
15
-
16
- executeCallback(diffs, saveAndApplyDiffCallback, proceed, abort, context);
17
- }
18
-
19
- module.exports = saveAndApplyDiffsCallback;