occam-open-cli 5.0.122 → 5.0.125

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 CHANGED
@@ -35,10 +35,10 @@ These are the commands and options:
35
35
 
36
36
  Commands:
37
37
 
38
- version Show the version
39
-
40
38
  help Show this help
41
39
 
40
+ version Show the version
41
+
42
42
  [install] <package_name> Install a package
43
43
 
44
44
  initialise Create a configuration file
@@ -68,6 +68,8 @@ Options:
68
68
  --quietly|-q Run with almost no console logging
69
69
 
70
70
  --log-level|-l Set the log level when publishing
71
+
72
+ --yes|-y Initially answer yes to prompts
71
73
  ```
72
74
 
73
75
  This is slightly different from `npm` in that `open` is usually executed from the parent directory of a project rather than from within the project sub-directory itself. Projects might reside in a `~/Mathematics/` directory, for example, in which case you should initialise `open` in there:
@@ -1,14 +1,16 @@
1
1
  "use strict";
2
2
 
3
- const { HELP_OPTION, DRY_RUN_OPTION, VERSION_OPTION, QUIETLY_OPTION, LOG_LEVEL_OPTION } = require("./options");
3
+ const { YES_OPTION, HELP_OPTION, DRY_RUN_OPTION, VERSION_OPTION, QUIETLY_OPTION, LOG_LEVEL_OPTION } = require("./options");
4
4
 
5
- const h = HELP_OPTION,
5
+ const y = YES_OPTION,
6
+ h = HELP_OPTION,
6
7
  d = DRY_RUN_OPTION,
7
8
  v = VERSION_OPTION,
8
9
  q = QUIETLY_OPTION,
9
10
  l = LOG_LEVEL_OPTION
10
11
 
11
12
  module.exports = {
13
+ y,
12
14
  h,
13
15
  d,
14
16
  v,
@@ -1,20 +1,23 @@
1
1
  "use strict";
2
2
 
3
3
  const cloneOperation = require("../operation/clone"),
4
- repositoryOperation = require("../operation/repository"),
5
- releaseNamePromptOperation = require("../operation/prompt/releaseName");
4
+ cloneReleasesOperation = require("../operation/cloneReleases"),
5
+ releaseNamePromptOperation = require("../operation/prompt/releaseName"),
6
+ cloneDependenciesPromptOperation = require("../operation/prompt/cloneDependencies");
6
7
 
7
8
  const { executeOperations } = require("../utilities/operation"),
8
9
  { SUCCESSFUL_CLONE_MESSAGE, FAILED_CLONE_MESSAGE } = require("../messages");
9
10
 
10
- function cloneAction(argument, quietly) {
11
+ function cloneAction(argument, quietly, yes) {
11
12
  const releaseName = argument, ///
12
13
  operations = [
13
14
  releaseNamePromptOperation,
14
- repositoryOperation,
15
- cloneOperation
15
+ cloneDependenciesPromptOperation,
16
+ cloneOperation,
17
+ cloneReleasesOperation
16
18
  ],
17
19
  context = {
20
+ yes,
18
21
  quietly,
19
22
  releaseName
20
23
  };
@@ -7,10 +7,10 @@ function helpAction() {
7
7
 
8
8
  Commands:
9
9
 
10
- version Show the version
11
-
12
10
  help Show this help
13
11
 
12
+ version Show the version
13
+
14
14
  [install] <package_name> Install a package
15
15
 
16
16
  initialise Create a configuration file
@@ -40,6 +40,8 @@ Options:
40
40
  --quietly|-q Run with almost no console logging
41
41
 
42
42
  --log-level|-l Set the log level when publishing
43
+
44
+ --yes|-y Initially answer yes to prompts
43
45
 
44
46
  Further information:
45
47
 
@@ -1,20 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  const openOperation = require("../operation/open"),
4
- unpackReleasesOperation = require("../operation/unpackReleases"),
4
+ openReleasesOperation = require("../operation/openReleases"),
5
5
  releaseNamePromptOperation = require("../operation/prompt/releaseName");
6
6
 
7
7
  const { executeOperations } = require("../utilities/operation"),
8
8
  { SUCCESSFUL_OPEN_MESSAGE, FAILED_OPEN_MESSAGE } = require("../messages");
9
9
 
10
- function openAction(argument, quietly) {
10
+ function openAction(argument, quietly, yes) {
11
11
  const releaseName = argument, ///
12
12
  operations = [
13
13
  releaseNamePromptOperation,
14
14
  openOperation,
15
- unpackReleasesOperation
15
+ openReleasesOperation
16
16
  ],
17
17
  context = {
18
+ yes,
18
19
  quietly,
19
20
  releaseName
20
21
  };
package/bin/actions.js CHANGED
@@ -13,7 +13,7 @@ const helpAction = require("./action/help"),
13
13
  createAccountAction = require("./action/createAccount"),
14
14
  resetPasswordAction = require("./action/resetPassword");
15
15
 
16
- const { DEFAULT_HELP, DEFAULT_DRY_RUN, DEFAULT_VERSION, DEFAULT_QUIETLY, DEFAULT_LOG_LEVEL } = require("./defaults"),
16
+ const { DEFAULT_YES, DEFAULT_HELP, DEFAULT_DRY_RUN, DEFAULT_VERSION, DEFAULT_QUIETLY, DEFAULT_LOG_LEVEL } = require("./defaults"),
17
17
  { HELP_COMMAND,
18
18
  OPEN_COMMAND,
19
19
  CLONE_COMMAND,
@@ -29,7 +29,8 @@ const { DEFAULT_HELP, DEFAULT_DRY_RUN, DEFAULT_VERSION, DEFAULT_QUIETLY, DEFAULT
29
29
 
30
30
  function actions(command, argument, options) {
31
31
  const commandMissing = (command === null),
32
- { help = DEFAULT_HELP,
32
+ { yes = DEFAULT_YES,
33
+ help = DEFAULT_HELP,
33
34
  dryRun = DEFAULT_DRY_RUN,
34
35
  version = DEFAULT_VERSION,
35
36
  quietly = DEFAULT_QUIETLY,
@@ -47,8 +48,8 @@ function actions(command, argument, options) {
47
48
 
48
49
  switch (command) {
49
50
  case HELP_COMMAND : helpAction(); break;
50
- case OPEN_COMMAND : openAction(argument, quietly); break;
51
- case CLONE_COMMAND : cloneAction(argument, quietly); break;
51
+ case OPEN_COMMAND : openAction(argument, quietly, yes); break;
52
+ case CLONE_COMMAND : cloneAction(argument, quietly, yes); break;
52
53
  case VERSION_COMMAND : versionAction(); break;
53
54
  case PUBLISH_COMMAND : publishAction(argument, dryRun, logLevel); break;
54
55
  case SIGN_IN_COMMAND : signInAction(argument); break;
package/bin/constants.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
- const END = "end",
3
+ const YES = "yes",
4
+ END = "end",
4
5
  DATA = "data",
5
6
  OPEN = "open",
6
7
  HOST_URL = "hostURL",
@@ -12,6 +13,7 @@ const END = "end",
12
13
  PACKAGE_JSON = "package.json";
13
14
 
14
15
  module.exports = {
16
+ YES,
15
17
  END,
16
18
  DATA,
17
19
  OPEN,
package/bin/defaults.js CHANGED
@@ -4,7 +4,8 @@ const { levels } = require("necessary");
4
4
 
5
5
  const { INFO_LEVEL } = levels;
6
6
 
7
- const DEFAULT_HELP = false,
7
+ const DEFAULT_YES = false,
8
+ DEFAULT_HELP = false,
8
9
  DEFAULT_HOST = "https://openmathematics.org",
9
10
  DEFAULT_DRY_RUN = false,
10
11
  DEFAULT_VERSION = false,
@@ -13,6 +14,7 @@ const DEFAULT_HELP = false,
13
14
  DEFAULT_GITHUB_HOST_NAME = "github.com";
14
15
 
15
16
  module.exports = {
17
+ DEFAULT_YES,
16
18
  DEFAULT_HELP,
17
19
  DEFAULT_HOST,
18
20
  DEFAULT_DRY_RUN,
@@ -8,6 +8,7 @@ const USE_SSH_DESCRIPTION = "Use SSH when cloning: ",
8
8
  EMAIL_ADDRESS_DESCRIPTION = "Email address: ",
9
9
  CONFIRM_PASSWORD_DESCRIPTION = "Confirm password: ",
10
10
  GITHUB_HOST_NAME_DESCRIPTION = "GitHub host name (leave blank for default): ",
11
+ CLONE_DEPENDENCIES_DESCRIPTION = "Clone dependencies? (y)es (n)o: ",
11
12
  EMAIL_ADDRESS_OR_USERNAME_DESCRIPTION = "Email address or username: ";
12
13
 
13
14
  module.exports = {
@@ -19,5 +20,6 @@ module.exports = {
19
20
  EMAIL_ADDRESS_DESCRIPTION,
20
21
  CONFIRM_PASSWORD_DESCRIPTION,
21
22
  GITHUB_HOST_NAME_DESCRIPTION,
23
+ CLONE_DEPENDENCIES_DESCRIPTION,
22
24
  EMAIL_ADDRESS_OR_USERNAME_DESCRIPTION
23
25
  };
package/bin/messages.js CHANGED
@@ -4,6 +4,7 @@ const PASSWORDS_DO_NOT_MATCH_MESSAGE = "The passwords do not match.",
4
4
  SERVER_FAILED_TO_RESPOND_ERROR_MESSAGE = "The server did not respond in a timely or intelligible fashion. If this problem persists then please be kind enough to report it.",
5
5
  CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE = "The action cannot be performed because the configuration file is missing. Run 'open initialise' to create one.",
6
6
  SIGN_OUT_MESSAGE = "You have been signed out.",
7
+ INVALID_ANSWER_MESSAGE = "You must answer (y)es or (n)o.",
7
8
  INVALID_USERNAME_MESSAGE = "Usernames must consist of groups of at least two and no more than sixteen numbers or lowercase letters, separated by dashes.",
8
9
  INVALID_PASSWORD_MESSAGE = "Passwords must consist of at least eight letters, numbers or common punctuation symbols.",
9
10
  INVALID_AFFIRMATION_MESSAGE = "You must answer (y)es or (n)o.",
@@ -29,6 +30,7 @@ module.exports = {
29
30
  SERVER_FAILED_TO_RESPOND_ERROR_MESSAGE,
30
31
  CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE,
31
32
  SIGN_OUT_MESSAGE,
33
+ INVALID_ANSWER_MESSAGE,
32
34
  INVALID_USERNAME_MESSAGE,
33
35
  INVALID_PASSWORD_MESSAGE,
34
36
  INVALID_AFFIRMATION_MESSAGE,
@@ -1,51 +1,25 @@
1
1
  "use strict";
2
2
 
3
- const { exec } = require("child_process"),
4
- { fileSystemUtilities } = require("necessary");
3
+ const post = require("../post");
5
4
 
6
- const { checkEntryExists } = fileSystemUtilities;
7
-
8
- const { getOptions } = require("../configuration"),
9
- { DEFAULT_GITHUB_HOST_NAME } = require("../defaults");
5
+ const { CLONE_API_URI } = require("../uris");
10
6
 
11
7
  function cloneOperation(proceed, abort, context) {
12
8
  const { releaseName } = context,
13
- path = releaseName, ///
14
- entryExists = checkEntryExists(path);
15
-
16
- if (entryExists) {
17
- const { quietly } = context;
18
-
19
- if (!quietly) {
20
- console.log(`Cannot clone the '${releaseName}' package because an entry of that name already exists.`);
21
- }
22
-
23
- proceed();
24
-
25
- return;
26
- }
27
-
28
- let { repository } = context;
29
-
30
- const options = getOptions(),
31
- { ssh } = options;
32
-
33
- if (ssh) {
34
- const { gitHubHostName } = ssh;
35
-
36
- repository = repository.replace(`https://${DEFAULT_GITHUB_HOST_NAME}/`, `git@${gitHubHostName}:`)
37
- }
38
-
39
- const command = `git clone ${repository}.git`;
9
+ uri = `${CLONE_API_URI}/${releaseName}`,
10
+ json = {};
40
11
 
41
- exec(command, (error) => {
42
- if (error) {
43
- abort();
12
+ post(uri, json, (json) => {
13
+ const { success, releases = null } = json;
44
14
 
45
- return;
46
- }
15
+ Object.assign(context, {
16
+ success,
17
+ releases
18
+ });
47
19
 
48
- proceed();
20
+ success ?
21
+ proceed() :
22
+ abort();
49
23
  });
50
24
  }
51
25
 
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ const { exec } = require("child_process"),
4
+ { fileSystemUtilities } = require("necessary");
5
+
6
+ const { checkEntryExists } = fileSystemUtilities;
7
+
8
+ const { getOptions } = require("../configuration"),
9
+ { DEFAULT_GITHUB_HOST_NAME } = require("../defaults");
10
+
11
+ function cloneOperation(proceed, abort, context) {
12
+ const { releaseName } = context,
13
+ path = releaseName, ///
14
+ entryExists = checkEntryExists(path);
15
+
16
+ if (entryExists) {
17
+ const { quietly } = context;
18
+
19
+ if (!quietly) {
20
+ console.log(`Cannot clone the '${releaseName}' package because an entry of that name already exists.`);
21
+ }
22
+
23
+ proceed();
24
+
25
+ return;
26
+ }
27
+
28
+ let { repository } = context;
29
+
30
+ const options = getOptions(),
31
+ { ssh } = options;
32
+
33
+ if (ssh) {
34
+ const { gitHubHostName } = ssh;
35
+
36
+ repository = repository.replace(`https://${DEFAULT_GITHUB_HOST_NAME}/`, `git@${gitHubHostName}:`)
37
+ }
38
+
39
+ const command = `git clone ${repository}.git`;
40
+
41
+ exec(command, (error) => {
42
+ if (error) {
43
+ abort();
44
+
45
+ return;
46
+ }
47
+
48
+ proceed();
49
+ });
50
+ }
51
+
52
+ module.exports = cloneOperation;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ const { exec } = require("child_process"),
4
+ { fileSystemUtilities, asynchronousUtilities } = require("necessary");
5
+
6
+ const { getOptions } = require("../configuration"),
7
+ { DEFAULT_GITHUB_HOST_NAME } = require("../defaults");
8
+
9
+ const { checkEntryExists } = fileSystemUtilities;
10
+
11
+ const { forEach } = asynchronousUtilities;
12
+
13
+ function cloneReleasesOperation(proceed, abort, context) {
14
+ const { releases } = context,
15
+ done = proceed; ///
16
+
17
+ forEach(releases, cloneReleasePromptOperation, done, context);
18
+ }
19
+
20
+ module.exports = cloneReleasesOperation;
21
+
22
+ function cloneReleasePromptOperation(release, next, done, context, index) {
23
+ const { cloneDependencies } = context;
24
+
25
+ if (!cloneDependencies) {
26
+ if (index > 0) {
27
+ next();
28
+
29
+ return;
30
+ }
31
+ }
32
+
33
+ const { name } = release,
34
+ entryPath = name, ///
35
+ entryExists = checkEntryExists(entryPath);
36
+
37
+ if (entryExists) {
38
+ const { quietly } = context;
39
+
40
+ if (!quietly) {
41
+ console.log(`Cannot clone the '${name}' package because a directory of that name already exists.`);
42
+ }
43
+
44
+ next();
45
+
46
+ return;
47
+ }
48
+
49
+ done = next; ///
50
+
51
+ cloneRelease(release, done);
52
+ }
53
+
54
+ function cloneRelease(release, done) {
55
+ let repository = release.getRepository();
56
+
57
+ const options = getOptions(),
58
+ { ssh } = options;
59
+
60
+ if (ssh) {
61
+ const { gitHubHostName } = ssh;
62
+
63
+ repository = repository.replace(`https://${DEFAULT_GITHUB_HOST_NAME}/`, `git@${gitHubHostName}:`)
64
+ }
65
+
66
+ const command = `git clone ${repository}.git`;
67
+
68
+ exec(command, (error) => {
69
+ if (error) {
70
+ console.log(error);
71
+ }
72
+
73
+ done();
74
+ });
75
+ }
@@ -17,7 +17,9 @@ function openOperation(proceed, abort, context) {
17
17
  releases
18
18
  });
19
19
 
20
- proceed();
20
+ success ?
21
+ proceed() :
22
+ abort();
21
23
  });
22
24
  }
23
25
 
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ const { shellUtilities, fileSystemUtilities, asynchronousUtilities } = require("necessary");
4
+
5
+ const { YES } = require("../constants"),
6
+ { validateAnswer } = require("../utilities/validate"),
7
+ { isAnswerAffirmative } = require("../utilities/prompt"),
8
+ { INVALID_ANSWER_MESSAGE } = require("../messages");
9
+
10
+ const { writeFile, removeEntry, checkEntryExists, isEntryDirectory } = fileSystemUtilities;
11
+
12
+ const { prompt } = shellUtilities,
13
+ { forEach } = asynchronousUtilities;
14
+
15
+ function openReleasesOperation(proceed, abort, context) {
16
+ const { releases } = context,
17
+ done = proceed; ///
18
+
19
+ forEach(releases, openReleasePromptOperation, done, context);
20
+ }
21
+
22
+ module.exports = openReleasesOperation;
23
+
24
+ function openReleasePromptOperation(release, next, done, context) {
25
+ const { name } = release,
26
+ entryPath = name, ///
27
+ entryExists = checkEntryExists(entryPath);
28
+
29
+ if (!entryExists) {
30
+ openRelease(release);
31
+
32
+ next();
33
+
34
+ return;
35
+ }
36
+
37
+ const entryDirectory = isEntryDirectory(entryPath);
38
+
39
+ if (entryDirectory) {
40
+ const { quietly } = context;
41
+
42
+ if (!quietly) {
43
+ console.log(`Cannot open the '${name}' package because a directory of that name already exists.`);
44
+ }
45
+
46
+ next();
47
+
48
+ return;
49
+ }
50
+
51
+ const { yes } = context,
52
+ answer = yes ?
53
+ YES :
54
+ null,
55
+ description = `Overwrite the existing '${name}' package? (y)es (n)o: `,
56
+ errorMessage = INVALID_ANSWER_MESSAGE,
57
+ validationFunction = validateAnswer, ///
58
+ options = {
59
+ answer,
60
+ description,
61
+ errorMessage,
62
+ validationFunction
63
+ };
64
+
65
+ prompt(options, (answer) => {
66
+ const valid = (answer !== null);
67
+
68
+ if (valid) {
69
+ const affirmative = isAnswerAffirmative(answer);
70
+
71
+ if (affirmative) {
72
+ removeEntry(entryPath);
73
+
74
+ openRelease(release);
75
+ }
76
+
77
+ next();
78
+ }
79
+ });
80
+ }
81
+
82
+ function openRelease(release) {
83
+ const { name } = release,
84
+ filePath = name, ///
85
+ releaseJSON = release, ///
86
+ releaseJSONString = JSON.stringify(releaseJSON),
87
+ content = releaseJSONString; ///
88
+
89
+ writeFile(filePath, content);
90
+ }
@@ -2,8 +2,8 @@
2
2
 
3
3
  const { shellUtilities } = require("necessary");
4
4
 
5
- const { validateAffirmation } = require("../../utilities/validate"),
6
- { isAnswerAffirmative } = require("../../utilities/prompt"),
5
+ const { isAnswerAffirmative } = require("../../utilities/prompt"),
6
+ { validateAffirmation } = require("../../utilities/validate"),
7
7
  { ARE_YOU_SURE_DESCRIPTION } = require("../../descriptions"),
8
8
  { INVALID_AFFIRMATION_MESSAGE } = require("../../messages");
9
9
 
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ const { shellUtilities } = require("necessary");
4
+
5
+ const { YES } = require("../../constants"),
6
+ { isAnswerAffirmative } = require("../../utilities/prompt"),
7
+ { validateAffirmation } = require("../../utilities/validate"),
8
+ { INVALID_AFFIRMATION_MESSAGE } = require("../../messages"),
9
+ { CLONE_DEPENDENCIES_DESCRIPTION } = require("../../descriptions");
10
+
11
+ const { prompt } = shellUtilities;
12
+
13
+ function cloneDependenciesPromptOperation(proceed, abort, context) {
14
+ const { yes } = context,
15
+ answer = yes ?
16
+ YES :
17
+ null,
18
+ description = CLONE_DEPENDENCIES_DESCRIPTION,
19
+ errorMessage = INVALID_AFFIRMATION_MESSAGE,
20
+ validationFunction = validateAffirmation, ///
21
+ options = {
22
+ answer,
23
+ description,
24
+ errorMessage,
25
+ validationFunction
26
+ };
27
+
28
+ prompt(options, (answer) => {
29
+ const valid = (answer !== null);
30
+
31
+ if (valid) {
32
+ const affirmative = isAnswerAffirmative(answer),
33
+ cloneDependencies = affirmative; ///
34
+
35
+ Object.assign(context, {
36
+ cloneDependencies
37
+ });
38
+
39
+ proceed();
40
+
41
+ return;
42
+ }
43
+
44
+ abort();
45
+ });
46
+ }
47
+
48
+ module.exports = cloneDependenciesPromptOperation;
@@ -19,9 +19,9 @@ function releaseNamePromptOperation(proceed, abort, context) {
19
19
  proceed();
20
20
 
21
21
  return;
22
- } else {
23
- console.log(errorMessage);
24
22
  }
23
+
24
+ console.log(errorMessage);
25
25
  }
26
26
 
27
27
  const description = RELEASE_NAME_DESCRIPTION,
package/bin/options.js CHANGED
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
 
3
- const HELP_OPTION = "help",
3
+ const YES_OPTION = "yes",
4
+ HELP_OPTION = "help",
4
5
  VERSION_OPTION = "version",
5
6
  QUIETLY_OPTION = "quietly",
6
7
  DRY_RUN_OPTION = "dry-run",
7
8
  LOG_LEVEL_OPTION = "log-level";
8
9
 
9
10
  module.exports = {
11
+ YES_OPTION,
10
12
  HELP_OPTION,
11
13
  VERSION_OPTION,
12
14
  QUIETLY_OPTION,
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ function validateAnswer(answer) { return /^(:?yes|no|y|n)$/i.test(answer); }
3
4
 
4
5
  function validateUsername(username) { return /^[a-z0-9]{2,16}(?:-[a-z0-9]{2,16}){0,4}$/.test(username); }
5
6
 
@@ -32,6 +33,7 @@ function validateEmailAddressOrUsername(emailAddressOrUsername) {
32
33
  }
33
34
 
34
35
  module.exports = {
36
+ validateAnswer,
35
37
  validateUsername,
36
38
  validatePassword,
37
39
  validateAffirmation,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "occam-open-cli",
3
3
  "author": "James Smith",
4
- "version": "5.0.122",
4
+ "version": "5.0.125",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/occam-open-cli",
7
7
  "description": "Occam's command line package management tool.",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "argumentative": "^2.0.21",
14
- "necessary": "^11.1.4",
14
+ "necessary": "^11.2.0",
15
15
  "occam-file-system": "^5.0.83"
16
16
  },
17
17
  "scripts": {},
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- const post = require("../post");
4
-
5
- const { CLONE_API_URI } = require("../uris");
6
-
7
- function repositoryOperation(proceed, abort, context) {
8
- const { releaseName } = context,
9
- uri = `${CLONE_API_URI}/${releaseName}`,
10
- json = {};
11
-
12
- post(uri, json, (json) => {
13
- const { repository = null } = json;
14
-
15
- if (repository === null) {
16
- abort();
17
-
18
- return;
19
- }
20
-
21
- Object.assign(context, {
22
- repository
23
- });
24
-
25
- proceed();
26
- });
27
- }
28
-
29
- module.exports = repositoryOperation;
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- const { fileSystemUtilities } = require("necessary");
4
-
5
- const { writeFile, checkEntryExists } = fileSystemUtilities;
6
-
7
- function unpackReleasesOperation(proceed, abort, context) {
8
- const { releases } = context;
9
-
10
- if (releases === null) {
11
- abort();
12
-
13
- return;
14
- }
15
-
16
- releases.forEach((release) => {
17
- const { name } = release,
18
- path = name, ///
19
- entryExists = checkEntryExists(path);
20
-
21
- if (entryExists) {
22
- const { quietly } = context;
23
-
24
- if (!quietly) {
25
- console.log(`Cannot write the '${name}' package to disk because an entry of that name already exists.`);
26
- }
27
-
28
- return;
29
- }
30
-
31
- const filePath = path, ///
32
- releaseJSON = release, ///
33
- releaseJSONString = JSON.stringify(releaseJSON),
34
- content = releaseJSONString; ///
35
-
36
- writeFile(filePath, content);
37
- });
38
-
39
- proceed();
40
- }
41
-
42
- module.exports = unpackReleasesOperation;