npm-update-package 0.22.0 → 0.22.1

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
@@ -122,7 +122,7 @@ endif
122
122
  :Get pull requests;
123
123
 
124
124
  group OutdatedPackagesProcessor
125
- repeat
125
+ while (Package exists) is (yes)
126
126
  group OutdatedPackageProcessor
127
127
  if (Remote branch exists) then (yes)
128
128
  else (no)
@@ -133,7 +133,8 @@ repeat
133
133
  :Remove branch;
134
134
  endif
135
135
  end group
136
- repeat while (Next package exists)
136
+ endwhile (no)
137
+
137
138
  end group
138
139
 
139
140
  end group
@@ -142,7 +143,7 @@ end
142
143
  ```
143
144
  -->
144
145
 
145
- [![](http://www.plantuml.com/plantuml/svg/RL0nKiCm4Epl5LlQHJuGDs4ew23330yGzYRs85j2Ea7uFNPanoP38vtsLhUxTuXgWgRUohMGSt39epVT8FidAbpInYWRU5D_c3DZ9TATK3nOUuDW0f7yJjrkufRGbWEA7yPI00wDq4QY65mfuwixIPuTs3ibteCPwdQSd56Vh4NWPsBK4PiTlSm-ZhFcCRYQCReWWPv61VYNkFA0oVVhLXEyTAF8dU7LB03i7mFDxKULiJS_QImBgBR4F_wNZdMHSBQv2vUxawMlhS1rH_dEeUQC-6uxInJFlEYYlKIGbRoMKoM7yKYz_GK0)](http://www.plantuml.com/plantuml/uml/RL0nKiCm4Epl5LlQHJuGDs4ew23330yGzYRs85j2Ea7uFNPanoP38vtsLhUxTuXgWgRUohMGSt39epVT8FidAbpInYWRU5D_c3DZ9TATK3nOUuDW0f7yJjrkufRGbWEA7yPI00wDq4QY65mfuwixIPuTs3ibteCPwdQSd56Vh4NWPsBK4PiTlSm-ZhFcCRYQCReWWPv61VYNkFA0oVVhLXEyTAF8dU7LB03i7mFDxKULiJS_QImBgBR4F_wNZdMHSBQv2vUxawMlhS1rH_dEeUQC-6uxInJFlEYYlKIGbRoMKoM7yKYz_GK0)
146
+ [![](http://www.plantuml.com/plantuml/svg/RL0vSiCm3EpnYYsbmX-m6cTIf8mdCta08y4M9n39yCZn-uYYJ4kPD3omm1uuXQXyJ9FGyg2hjybXKjhGyOaZR8g3YZp0gVvTNJbqHFg2va6abg0y8xb3j8VSsoAERD3yS6W9O3CGIs0qnhOq__I52hVdoKR6crUc7sVcKdL919u_4eUOrOgZvzN7UTKyUzjp2DRJrwY5qQm0-5lFSorqg0x-PRWJ03dGozPCPTadgIa0uFZeMTM9hjHUNTQuRQRRDkw2tH2nWM5b-9EweDdIvrPWMLwvIwYypf9_iKLtW7OzT9gFDCal)](http://www.plantuml.com/plantuml/uml/RL0vSiCm3EpnYYsbmX-m6cTIf8mdCta08y4M9n39yCZn-uYYJ4kPD3omm1uuXQXyJ9FGyg2hjybXKjhGyOaZR8g3YZp0gVvTNJbqHFg2va6abg0y8xb3j8VSsoAERD3yS6W9O3CGIs0qnhOq__I52hVdoKR6crUc7sVcKdL919u_4eUOrOgZvzN7UTKyUzjp2DRJrwY5qQm0-5lFSorqg0x-PRWJ03dGozPCPTadgIa0uFZeMTM9hjHUNTQuRQRRDkw2tH2nWM5b-9EweDdIvrPWMLwvIwYypf9_iKLtW7OzT9gFDCal)
146
147
 
147
148
  ## FAQ
148
149
 
package/dist/app.js CHANGED
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.app = void 0;
4
4
  exports.app = {
5
5
  name: 'npm-update-package',
6
- version: '0.22.0',
6
+ version: '0.22.1',
7
7
  web: 'https://github.com/npm-update-package/npm-update-package'
8
8
  };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createBranchName = void 0;
4
+ const mustache_1 = require("mustache");
5
+ const TEMPLATE = 'npm-update-package/{{{packageName}}}/v{{newVersion}}';
6
+ const createBranchName = (outdatedPackage) => {
7
+ const packageName = outdatedPackage.name;
8
+ const currentVersion = outdatedPackage.currentVersion.version;
9
+ const newVersion = outdatedPackage.newVersion.version;
10
+ const updateType = outdatedPackage.type;
11
+ return (0, mustache_1.render)(TEMPLATE, {
12
+ packageName,
13
+ currentVersion,
14
+ newVersion,
15
+ updateType
16
+ });
17
+ };
18
+ exports.createBranchName = createBranchName;
package/dist/git/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GitRepository = exports.Git = exports.CommitMessageCreator = exports.BranchNameCreator = void 0;
4
- var BranchNameCreator_1 = require("./BranchNameCreator");
5
- Object.defineProperty(exports, "BranchNameCreator", { enumerable: true, get: function () { return BranchNameCreator_1.BranchNameCreator; } });
3
+ exports.GitRepository = exports.Git = exports.CommitMessageCreator = exports.createBranchName = void 0;
4
+ var createBranchName_1 = require("./createBranchName");
5
+ Object.defineProperty(exports, "createBranchName", { enumerable: true, get: function () { return createBranchName_1.createBranchName; } });
6
6
  var CommitMessageCreator_1 = require("./CommitMessageCreator");
7
7
  Object.defineProperty(exports, "CommitMessageCreator", { enumerable: true, get: function () { return CommitMessageCreator_1.CommitMessageCreator; } });
8
8
  var Git_1 = require("./Git");
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PullRequestCreator = void 0;
4
+ const createPullRequestBody_1 = require("./createPullRequestBody");
4
5
  class PullRequestCreator {
5
- constructor({ github, gitRepo, githubRepo, pullRequestTitleCreator, pullRequestBodyCreator, logger }) {
6
+ constructor({ github, gitRepo, githubRepo, pullRequestTitleCreator, logger }) {
6
7
  this.github = github;
7
8
  this.gitRepo = gitRepo;
8
9
  this.githubRepo = githubRepo;
9
10
  this.pullRequestTitleCreator = pullRequestTitleCreator;
10
- this.pullRequestBodyCreator = pullRequestBodyCreator;
11
11
  this.logger = logger;
12
12
  }
13
13
  async create({ outdatedPackage, branchName }) {
14
14
  const title = this.pullRequestTitleCreator.create(outdatedPackage);
15
15
  this.logger.debug(`title=${title}`);
16
- const body = this.pullRequestBodyCreator.create(outdatedPackage);
16
+ const body = (0, createPullRequestBody_1.createPullRequestBody)(outdatedPackage);
17
17
  this.logger.debug(`body=${body}`);
18
18
  const pullRequest = await this.github.createPullRequest({
19
19
  owner: this.gitRepo.owner,
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PullRequestBodyCreator = void 0;
3
+ exports.createPullRequestBody = void 0;
4
4
  const mustache_1 = require("mustache");
5
5
  const app_1 = require("../app");
6
- class PullRequestBodyCreator {
7
- constructor() {
8
- this.template = `This PR updates these packages:
6
+ const TEMPLATE = `This PR updates these packages:
9
7
 
10
8
  |package|type|current version|new version|
11
9
  |---|---|---|---|
@@ -37,24 +35,22 @@ class PullRequestBodyCreator {
37
35
 
38
36
  ---
39
37
  This PR has been generated by [{{{appName}}}]({{{appWeb}}}) v{{appVersion}}`;
40
- }
41
- create(outdatedPackage) {
42
- const appName = app_1.app.name;
43
- const appVersion = app_1.app.version;
44
- const appWeb = app_1.app.web;
45
- const currentVersion = outdatedPackage.currentVersion.version;
46
- const newVersion = outdatedPackage.newVersion.version;
47
- const packageName = outdatedPackage.name;
48
- const updateType = outdatedPackage.type;
49
- return (0, mustache_1.render)(this.template, {
50
- appName,
51
- appVersion,
52
- appWeb,
53
- currentVersion,
54
- newVersion,
55
- packageName,
56
- updateType
57
- });
58
- }
59
- }
60
- exports.PullRequestBodyCreator = PullRequestBodyCreator;
38
+ const createPullRequestBody = (outdatedPackage) => {
39
+ const appName = app_1.app.name;
40
+ const appVersion = app_1.app.version;
41
+ const appWeb = app_1.app.web;
42
+ const currentVersion = outdatedPackage.currentVersion.version;
43
+ const newVersion = outdatedPackage.newVersion.version;
44
+ const packageName = outdatedPackage.name;
45
+ const updateType = outdatedPackage.type;
46
+ return (0, mustache_1.render)(TEMPLATE, {
47
+ appName,
48
+ appVersion,
49
+ appWeb,
50
+ currentVersion,
51
+ newVersion,
52
+ packageName,
53
+ updateType
54
+ });
55
+ };
56
+ exports.createPullRequestBody = createPullRequestBody;
@@ -1,14 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RemoteBranchExistenceChecker = exports.PullRequestTitleCreator = exports.PullRequestFinder = exports.PullRequestCreator = exports.PullRequestBodyCreator = exports.PullRequestCloser = exports.GitHub = exports.createGitHub = void 0;
3
+ exports.RemoteBranchExistenceChecker = exports.PullRequestTitleCreator = exports.PullRequestFinder = exports.PullRequestCreator = exports.PullRequestCloser = exports.GitHub = exports.createGitHub = void 0;
4
4
  var createGitHub_1 = require("./createGitHub");
5
5
  Object.defineProperty(exports, "createGitHub", { enumerable: true, get: function () { return createGitHub_1.createGitHub; } });
6
6
  var GitHub_1 = require("./GitHub");
7
7
  Object.defineProperty(exports, "GitHub", { enumerable: true, get: function () { return GitHub_1.GitHub; } });
8
8
  var PullRequestCloser_1 = require("./PullRequestCloser");
9
9
  Object.defineProperty(exports, "PullRequestCloser", { enumerable: true, get: function () { return PullRequestCloser_1.PullRequestCloser; } });
10
- var PullRequestBodyCreator_1 = require("./PullRequestBodyCreator");
11
- Object.defineProperty(exports, "PullRequestBodyCreator", { enumerable: true, get: function () { return PullRequestBodyCreator_1.PullRequestBodyCreator; } });
12
10
  var PullRequestCreator_1 = require("./PullRequestCreator");
13
11
  Object.defineProperty(exports, "PullRequestCreator", { enumerable: true, get: function () { return PullRequestCreator_1.PullRequestCreator; } });
14
12
  var PullRequestFinder_1 = require("./PullRequestFinder");
package/dist/main.js CHANGED
@@ -61,16 +61,13 @@ const main = async ({ options, logger }) => {
61
61
  packageManager: options.packageManager
62
62
  });
63
63
  const pullRequestTitleCreator = new github_1.PullRequestTitleCreator(options.pullRequestTitle);
64
- const pullRequestBodyCreator = new github_1.PullRequestBodyCreator();
65
64
  const pullRequestCreator = new github_1.PullRequestCreator({
66
65
  github,
67
66
  gitRepo,
68
67
  githubRepo,
69
68
  pullRequestTitleCreator,
70
- pullRequestBodyCreator,
71
69
  logger
72
70
  });
73
- const branchNameCreator = new git_1.BranchNameCreator();
74
71
  const commitMessageCreator = new git_1.CommitMessageCreator(options.commitMessage);
75
72
  const pullRequestFinder = new github_1.PullRequestFinder(pullRequests);
76
73
  const pullRequestCloser = new github_1.PullRequestCloser(github);
@@ -81,7 +78,6 @@ const main = async ({ options, logger }) => {
81
78
  pullRequestCreator,
82
79
  remoteBranchExistenceChecker,
83
80
  logger,
84
- branchNameCreator,
85
81
  commitMessageCreator,
86
82
  pullRequestFinder,
87
83
  pullRequestCloser
@@ -2,16 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OutdatedPackageProcessor = void 0;
4
4
  const Either_1 = require("fp-ts/lib/Either");
5
+ const git_1 = require("../git");
5
6
  // TODO: add test
6
7
  class OutdatedPackageProcessor {
7
- constructor({ git, ncu, packageManager, pullRequestCreator, remoteBranchExistenceChecker, logger, branchNameCreator, commitMessageCreator, pullRequestFinder, pullRequestCloser }) {
8
+ constructor({ git, ncu, packageManager, pullRequestCreator, remoteBranchExistenceChecker, logger, commitMessageCreator, pullRequestFinder, pullRequestCloser }) {
8
9
  this.git = git;
9
10
  this.ncu = ncu;
10
11
  this.packageManager = packageManager;
11
12
  this.pullRequestCreator = pullRequestCreator;
12
13
  this.remoteBranchExistenceChecker = remoteBranchExistenceChecker;
13
14
  this.logger = logger;
14
- this.branchNameCreator = branchNameCreator;
15
15
  this.commitMessageCreator = commitMessageCreator;
16
16
  this.pullRequestFinder = pullRequestFinder;
17
17
  this.pullRequestCloser = pullRequestCloser;
@@ -20,7 +20,7 @@ class OutdatedPackageProcessor {
20
20
  * Don't run in parallel because it includes file operations.
21
21
  */
22
22
  async process(outdatedPackage) {
23
- const branchName = this.branchNameCreator.create(outdatedPackage);
23
+ const branchName = (0, git_1.createBranchName)(outdatedPackage);
24
24
  this.logger.debug(`branchName=${branchName}`);
25
25
  if (this.remoteBranchExistenceChecker.check(branchName)) {
26
26
  this.logger.info(`Skip ${outdatedPackage.name} because ${branchName} branch already exists on remote.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-update-package",
3
- "version": "0.22.0",
3
+ "version": "0.22.1",
4
4
  "description": "CLI tool for creating pull request to update npm packages",
5
5
  "scripts": {
6
6
  "build": "tsc --project tsconfig.build.json",
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BranchNameCreator = void 0;
4
- const mustache_1 = require("mustache");
5
- class BranchNameCreator {
6
- constructor() {
7
- this.template = 'npm-update-package/{{{packageName}}}/v{{newVersion}}';
8
- }
9
- create(outdatedPackage) {
10
- const packageName = outdatedPackage.name;
11
- const currentVersion = outdatedPackage.currentVersion.version;
12
- const newVersion = outdatedPackage.newVersion.version;
13
- const updateType = outdatedPackage.type;
14
- return (0, mustache_1.render)(this.template, {
15
- packageName,
16
- currentVersion,
17
- newVersion,
18
- updateType
19
- });
20
- }
21
- }
22
- exports.BranchNameCreator = BranchNameCreator;