ship-release 4.3.1 → 5.0.0
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/LICENSE +1 -1
- package/README.md +13 -138
- package/bin/ship-release.js +202 -178
- package/package.json +19 -25
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2016-
|
|
3
|
+
Copyright (c) 2016-26 Ionică Bizău <bizauionica@gmail.com> (https://ionicabizau.net)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
<!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. -->
|
|
2
1
|
|
|
3
2
|
|
|
4
3
|
|
|
@@ -7,98 +6,42 @@
|
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
|
|
10
|
-
[](#)
|
|
11
|
-
|
|
12
9
|
|
|
13
10
|
|
|
14
11
|
|
|
15
12
|
|
|
16
13
|
|
|
17
14
|
|
|
15
|
+

|
|
18
16
|
|
|
19
17
|
|
|
20
18
|
|
|
21
19
|
|
|
22
20
|
# `$ ship-release`
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<a href="https://www.buymeacoffee.com/H96WwChMy" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png" alt="Buy Me A Coffee"></a>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
> Publish new versions on GitHub and npm with ease.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
22
|
+
Publish new versions on GitHub and npm with ease.
|
|
45
23
|
|
|
46
24
|
|
|
47
25
|
|
|
48
26
|
|
|
27
|
+
## Installation
|
|
49
28
|
|
|
29
|
+
```sh
|
|
30
|
+
$ npm i ship-release
|
|
31
|
+
```
|
|
50
32
|
|
|
51
33
|
|
|
52
|
-
## :cloud: Installation
|
|
53
34
|
|
|
35
|
+
### CLI Usage
|
|
54
36
|
You can install the package globally and use it as command line tool:
|
|
55
37
|
|
|
56
|
-
|
|
57
38
|
```sh
|
|
58
|
-
|
|
59
|
-
npm install --global ship-release
|
|
60
|
-
|
|
61
|
-
# Using yarn
|
|
62
|
-
yarn global add ship-release
|
|
39
|
+
$ npm i -g ship-release
|
|
63
40
|
```
|
|
64
41
|
|
|
65
|
-
|
|
66
42
|
Then, run `ship-release --help` and see what the CLI tool can do.
|
|
67
43
|
|
|
68
44
|
|
|
69
|
-
```
|
|
70
|
-
$ ship-release --help
|
|
71
|
-
Usage: ship-release <command> [options]
|
|
72
|
-
|
|
73
|
-
Publish new versions on GitHub and npm with ease.
|
|
74
|
-
|
|
75
|
-
Commands:
|
|
76
|
-
branch Creates a new branch and commits the changes.
|
|
77
|
-
bump Bumps the version and creates a new branch.
|
|
78
|
-
publish Creates a pull request with the changes, merge it
|
|
79
|
-
in the main branch, publish it on npm and create a
|
|
80
|
-
GitHub release.
|
|
81
|
-
|
|
82
|
-
Options:
|
|
83
|
-
-v, --version Displays version information.
|
|
84
|
-
-h, --help Displays this help.
|
|
85
|
-
|
|
86
|
-
Documentation can be found at https://github.com/IonicaBizau/ship-release#readme.
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
45
|
|
|
103
46
|
|
|
104
47
|
|
|
@@ -106,94 +49,26 @@ Documentation can be found at https://github.com/IonicaBizau/ship-release#readme
|
|
|
106
49
|
|
|
107
50
|
|
|
108
51
|
|
|
52
|
+
## Documentation
|
|
109
53
|
|
|
110
|
-
## :question: Get Help
|
|
111
54
|
|
|
112
|
-
There are few ways to get help:
|
|
113
55
|
|
|
114
56
|
|
|
57
|
+
For full API reference, see the [DOCUMENTATION.md][docs] file.
|
|
115
58
|
|
|
116
|
-
1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long you add a link to your Stack Overflow question.
|
|
117
|
-
2. For bug reports and feature requests, open issues. :bug:
|
|
118
|
-
3. For direct and quick help, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket:
|
|
119
59
|
|
|
120
60
|
|
|
121
61
|
|
|
122
62
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
## :yum: How to contribute
|
|
63
|
+
## How to contribute
|
|
136
64
|
Have an idea? Found a bug? See [how to contribute][contributing].
|
|
137
65
|
|
|
138
66
|
|
|
139
|
-
## :sparkling_heart: Support my projects
|
|
140
|
-
I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously,
|
|
141
|
-
this takes time. You can integrate and use these projects in your applications *for free*! You can even change the source code and redistribute (even resell it).
|
|
142
|
-
|
|
143
|
-
However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
- Starring and sharing the projects you like :rocket:
|
|
147
|
-
- [![Buy me a book][badge_amazon]][amazon]—I love books! I will remember you after years if you buy me one. :grin: :book:
|
|
148
|
-
- [![PayPal][badge_paypal]][paypal-donations]—You can make one-time donations via PayPal. I'll probably buy a ~~coffee~~ tea. :tea:
|
|
149
|
-
- [![Support me on Patreon][badge_patreon]][patreon]—Set up a recurring monthly donation and you will get interesting news about what I'm doing (things that I don't share with everyone).
|
|
150
|
-
- **Bitcoin**—You can send me bitcoins at this address (or scanning the code below): `1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6`
|
|
151
|
-
|
|
152
|
-

|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
Thanks! :heart:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
## :scroll: License
|
|
181
|
-
|
|
182
|
-
[MIT][license] © [Ionică Bizău][website]
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
67
|
|
|
68
|
+
## License
|
|
69
|
+
See the [LICENSE][license] file.
|
|
187
70
|
|
|
188
71
|
|
|
189
72
|
[license]: /LICENSE
|
|
190
|
-
[website]: https://ionicabizau.net
|
|
191
73
|
[contributing]: /CONTRIBUTING.md
|
|
192
74
|
[docs]: /DOCUMENTATION.md
|
|
193
|
-
[badge_patreon]: https://ionicabizau.github.io/badges/patreon.svg
|
|
194
|
-
[badge_amazon]: https://ionicabizau.github.io/badges/amazon.svg
|
|
195
|
-
[badge_paypal]: https://ionicabizau.github.io/badges/paypal.svg
|
|
196
|
-
[badge_paypal_donate]: https://ionicabizau.github.io/badges/paypal_donate.svg
|
|
197
|
-
[patreon]: https://www.patreon.com/ionicabizau
|
|
198
|
-
[amazon]: http://amzn.eu/hRo9sIZ
|
|
199
|
-
[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVXDDLKKLQRJW
|
package/bin/ship-release.js
CHANGED
|
@@ -3,69 +3,66 @@
|
|
|
3
3
|
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
6
|
+
const rJson = require("r-json");
|
|
7
|
+
const Logger = require("bug-killer");
|
|
8
|
+
const wJson = require("w-json");
|
|
9
|
+
const PackageJson = require("pkg.json");
|
|
10
|
+
const Semver = require("semver");
|
|
11
|
+
const spawno = require("spawno").promise;
|
|
12
|
+
const Tilda = require("tilda");
|
|
13
|
+
const pp = require("package-json-path");
|
|
14
|
+
const abs = require("abs");
|
|
15
|
+
const GitHub = require("gh.js");
|
|
16
|
+
const gitUrlParse = require("git-url-parse");
|
|
17
|
+
const findValue = require("find-value");
|
|
18
|
+
const barbe = require("barbe");
|
|
19
|
+
const ul = require("ul");
|
|
20
|
+
const mapO = require("map-o");
|
|
21
|
+
const BLAH_PATH = require.resolve("blah/bin/blah");
|
|
22
|
+
const spawn = require("child_process").spawn;
|
|
23
|
+
|
|
24
|
+
const packageJsonPromise = name => new Promise((resolve, reject) => {
|
|
25
|
+
PackageJson(name, "latest", function (err, json) {
|
|
26
|
+
if (err) {
|
|
27
|
+
return reject(err);
|
|
28
|
+
}
|
|
29
|
+
resolve(json);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const done = err => {
|
|
27
34
|
if (err) {
|
|
28
35
|
return Logger.log(err);
|
|
29
36
|
}
|
|
30
|
-
Logger.log("Done.");
|
|
37
|
+
Logger.log("✅ Done.");
|
|
31
38
|
};
|
|
32
39
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
Logger.log("Pushing the new branch");
|
|
43
|
-
spawno("git", ["push", "--all"], { output: true }, next);
|
|
44
|
-
}], cb);
|
|
45
|
-
};
|
|
40
|
+
const commitAll = async msg => {
|
|
41
|
+
Logger.log("📦 Adding the modified files.");
|
|
42
|
+
await spawno("git", ["add", ".", "-A"], { output: true });
|
|
43
|
+
|
|
44
|
+
Logger.log("📝 Committing the changes.");
|
|
45
|
+
await spawno("git", ["commit", "-m", msg], { output: true });
|
|
46
|
+
|
|
47
|
+
Logger.log("🚀 Pushing the new branch.");
|
|
48
|
+
await spawno("git", ["push", "--all"], { output: true });
|
|
46
49
|
};
|
|
47
50
|
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
const npmInstall = async () => {
|
|
52
|
+
await spawno("npm", ["install", "--production"], { output: true });
|
|
50
53
|
};
|
|
51
54
|
|
|
52
|
-
|
|
53
|
-
Logger.log("Generating documentation.");
|
|
54
|
-
spawno(BLAH_PATH, ["-f"], {
|
|
55
|
-
output: true
|
|
56
|
-
}, next);
|
|
55
|
+
const generateDocs = async () => {
|
|
56
|
+
Logger.log("📚 Generating documentation.");
|
|
57
|
+
await spawno(BLAH_PATH, ["-f"], { output: true });
|
|
57
58
|
};
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
spawno("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
|
|
61
|
-
|
|
62
|
-
}, function (err, stdout, stderr) {
|
|
63
|
-
stdout = stdout && stdout.trim();
|
|
64
|
-
cb(stderr || err, stdout);
|
|
65
|
-
});
|
|
60
|
+
const currentBranch = async () => {
|
|
61
|
+
const { stdout, stderr } = await spawno("git", ["rev-parse", "--abbrev-ref", "HEAD"], { output: true });
|
|
62
|
+
return (stdout || stderr || "").trim();
|
|
66
63
|
};
|
|
67
64
|
|
|
68
|
-
new Tilda(pp(__dirname + "/..")).action([{
|
|
65
|
+
const app = new Tilda(pp(__dirname + "/..")).action([{
|
|
69
66
|
name: "branch",
|
|
70
67
|
desc: "Creates a new branch and commits the changes.",
|
|
71
68
|
options: [{
|
|
@@ -124,22 +121,25 @@ new Tilda(pp(__dirname + "/..")).action([{
|
|
|
124
121
|
desc: "The path to a json/js file exporting ",
|
|
125
122
|
type: String
|
|
126
123
|
}]
|
|
127
|
-
}]).on("branch",
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
Logger.log("Creating and switching
|
|
131
|
-
spawno("git", ["checkout", "-B", branchName], { output: true }
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
124
|
+
}]).on("branch", async a => {
|
|
125
|
+
try {
|
|
126
|
+
const branchName = a.options.name.value;
|
|
127
|
+
Logger.log("🌿 Creating and switching to the " + branchName + " branch.");
|
|
128
|
+
await spawno("git", ["checkout", "-B", branchName], { output: true });
|
|
129
|
+
await commitAll(a.options.message.value);
|
|
130
|
+
} catch (e) {
|
|
131
|
+
done(e);
|
|
132
|
+
}
|
|
133
|
+
}).on("bump", async a => {
|
|
134
|
+
try {
|
|
135
|
+
const packPath = pp(process.cwd());
|
|
136
|
+
let newVersion = null;
|
|
137
|
+
|
|
138
|
+
const pack = rJson(packPath);
|
|
139
|
+
try {
|
|
140
|
+
const json = await packageJsonPromise(pack.name);
|
|
141
|
+
if (Semver.major(json.version) === 0) {
|
|
142
|
+
Logger.log("ℹ️ Since there is no 1.x.x release yet, setting 1.0.0.");
|
|
143
143
|
pack.version = "1.0.0";
|
|
144
144
|
} else {
|
|
145
145
|
pack.version = Semver.inc(json.version, a.options.V.value);
|
|
@@ -148,45 +148,38 @@ new Tilda(pp(__dirname + "/..")).action([{
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
if (json) {
|
|
151
|
-
Logger.log("
|
|
151
|
+
Logger.log("⬅️ Old version was: " + json.version);
|
|
152
152
|
}
|
|
153
|
-
Logger.log("
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
oneByOne([function (next) {
|
|
160
|
-
return rJson(packPath, next);
|
|
161
|
-
}, function (next, pack) {
|
|
162
|
-
return setPackVersion(pack, next);
|
|
163
|
-
}, function (next, pack) {
|
|
153
|
+
Logger.log("➡️ New version is: " + pack.version);
|
|
154
|
+
} catch (e) {
|
|
155
|
+
Logger.log(e);
|
|
156
|
+
Logger.log("⚙️ Setting version to 1.0.0.");
|
|
157
|
+
pack.version = "1.0.0";
|
|
158
|
+
}
|
|
164
159
|
newVersion = pack.version;
|
|
165
|
-
Logger.log("Updating package.json (version: " + newVersion + ")");
|
|
166
|
-
wJson(packPath, pack
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
//, generateDocs
|
|
170
|
-
, currentBranch, function (next, currentBranch) {
|
|
171
|
-
var branchName = a.options.branch.value;
|
|
160
|
+
Logger.log("🧩 Updating package.json (version: " + newVersion + ")");
|
|
161
|
+
wJson(packPath, pack);
|
|
162
|
+
const cBranch = await currentBranch();
|
|
163
|
+
const branchName = a.options.branch.value;
|
|
172
164
|
|
|
173
165
|
if (!a.options.c.is_provided) {
|
|
174
166
|
// TODO Check if default branch. Too lazy right now to do that.
|
|
175
|
-
a.options.c.value =
|
|
167
|
+
a.options.c.value = cBranch !== "master" && cBranch !== "gh-pages";
|
|
176
168
|
}
|
|
177
169
|
|
|
178
170
|
if (a.options.c.value) {
|
|
179
|
-
Logger.log("Using the current branch.");
|
|
180
|
-
|
|
171
|
+
Logger.log("📍 Using the current branch.");
|
|
172
|
+
} else {
|
|
173
|
+
Logger.log("🔀 Switching to the " + branchName + " branch.");
|
|
174
|
+
await spawno("git", ["checkout", "-B", branchName], { output: true });
|
|
181
175
|
}
|
|
182
176
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
var config = {};
|
|
177
|
+
await commitAll(":arrow_up: " + newVersion + " :tada:");
|
|
178
|
+
} catch (e) {
|
|
179
|
+
done(e);
|
|
180
|
+
}
|
|
181
|
+
}).on("publish", async a => {
|
|
182
|
+
let config = {};
|
|
190
183
|
|
|
191
184
|
if (a.options.c.value) {
|
|
192
185
|
try {
|
|
@@ -197,12 +190,55 @@ new Tilda(pp(__dirname + "/..")).action([{
|
|
|
197
190
|
}
|
|
198
191
|
}
|
|
199
192
|
|
|
200
|
-
|
|
193
|
+
const readGhToken = () => {
|
|
201
194
|
try {
|
|
202
195
|
return require(abs("~/.github-config.json")).token;
|
|
203
|
-
} catch (e) {};
|
|
196
|
+
} catch (e) { };
|
|
204
197
|
};
|
|
205
198
|
|
|
199
|
+
const getRepoInfo = async (fullName) => {
|
|
200
|
+
return new Promise((resolve, reject) => {
|
|
201
|
+
gh.get("repos/" + fullName, function (err, repo) {
|
|
202
|
+
if (err) {
|
|
203
|
+
return reject(err);
|
|
204
|
+
}
|
|
205
|
+
resolve(repo);
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const createPullRequest = async (fullName, data) => {
|
|
211
|
+
return new Promise((resolve, reject) => {
|
|
212
|
+
gh.get("repos/" + fullName + "/pulls", {
|
|
213
|
+
data: data,
|
|
214
|
+
headers: {
|
|
215
|
+
Accept: "application/vnd.github.sailor-v-preview+json, application/vnd.github.v3+json"
|
|
216
|
+
}
|
|
217
|
+
}, function (err, pr) {
|
|
218
|
+
if (err) {
|
|
219
|
+
return reject(err);
|
|
220
|
+
}
|
|
221
|
+
resolve(pr);
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const createRelease = async (fullName, data) => {
|
|
227
|
+
return new Promise((resolve, reject) => {
|
|
228
|
+
gh.get("repos/" + fullName + "/releases", {
|
|
229
|
+
data: data,
|
|
230
|
+
headers: {
|
|
231
|
+
Accept: "application/vnd.github.sailor-v-preview+json, application/vnd.github.v3+json"
|
|
232
|
+
}
|
|
233
|
+
}, function (err, release) {
|
|
234
|
+
if (err) {
|
|
235
|
+
return reject(err);
|
|
236
|
+
}
|
|
237
|
+
resolve(release);
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
206
242
|
config.token = config.token || a.options.T.value || readGhToken();
|
|
207
243
|
if (!config.token) {
|
|
208
244
|
return Logger.log(new Error("A GitHub token is required."));
|
|
@@ -218,97 +254,85 @@ new Tilda(pp(__dirname + "/..")).action([{
|
|
|
218
254
|
return Logger.log(new Error("The pull request description is required."));
|
|
219
255
|
}
|
|
220
256
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
fullName = null,
|
|
224
|
-
repo = null,
|
|
225
|
-
url = null,
|
|
226
|
-
pack = null;
|
|
227
|
-
|
|
228
|
-
oneByOne([function (next) {
|
|
229
|
-
return rJson(packPath, next);
|
|
230
|
-
}, function (next, _pack) {
|
|
231
|
-
pack = _pack;
|
|
257
|
+
const gh = new GitHub(config.token);
|
|
258
|
+
const packPath = pp(process.cwd());
|
|
232
259
|
|
|
233
|
-
|
|
260
|
+
try {
|
|
261
|
+
const pack = rJson(packPath);
|
|
262
|
+
const repoUrl = findValue(pack, "repository.url");
|
|
234
263
|
if (!repoUrl) {
|
|
235
|
-
return
|
|
264
|
+
return done("Cannot find the repository URL in package.json.");
|
|
236
265
|
}
|
|
237
|
-
|
|
238
|
-
url = gitUrlParse(repoUrl);
|
|
266
|
+
const url = gitUrlParse(repoUrl);
|
|
239
267
|
if (url.source !== "github.com") {
|
|
240
|
-
return
|
|
268
|
+
return done("The repository is not hosted on GitHub.");
|
|
241
269
|
}
|
|
242
270
|
|
|
243
|
-
Logger.log("Getting
|
|
271
|
+
Logger.log("🔎 Getting repository info.");
|
|
244
272
|
config.version = pack.version;
|
|
245
|
-
fullName = url.full_name;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
currentBranch(
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
});
|
|
258
|
-
}, function (next) {
|
|
259
|
-
Logger.log("Creating pull request");
|
|
273
|
+
const fullName = url.full_name;
|
|
274
|
+
|
|
275
|
+
const repo = await getRepoInfo(fullName);
|
|
276
|
+
await npmInstall();
|
|
277
|
+
await generateDocs();
|
|
278
|
+
await commitAll("Updated docs")
|
|
279
|
+
const cBranch = await currentBranch();
|
|
280
|
+
|
|
281
|
+
config.headBranch = cBranch;
|
|
282
|
+
|
|
283
|
+
Logger.log("📬 Creating a pull request.");
|
|
284
|
+
|
|
260
285
|
config.baseBranch = config.baseBranch || repo.default_branch;
|
|
261
286
|
|
|
262
287
|
mapO(config, function (v) {
|
|
263
288
|
return v && barbe(v, ["<", ">"], { pack: pack, repo: repo });
|
|
264
289
|
});
|
|
265
290
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
Logger.log("
|
|
282
|
-
spawno("git", ["
|
|
283
|
-
|
|
284
|
-
Logger.log("
|
|
285
|
-
spawno("git", ["
|
|
286
|
-
|
|
287
|
-
Logger.log("
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
});
|
|
291
|
+
await createPullRequest(fullName, {
|
|
292
|
+
title: config.title,
|
|
293
|
+
body: config.body,
|
|
294
|
+
head: config.headBranch,
|
|
295
|
+
base: config.baseBranch
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
Logger.log("✅ Created the pull request.");
|
|
299
|
+
|
|
300
|
+
Logger.log("🔀 Switching to " + config.baseBranch);
|
|
301
|
+
await spawno("git", ["checkout", config.baseBranch], { output: true });
|
|
302
|
+
|
|
303
|
+
Logger.log("⬇️ Updating from GitHub.");
|
|
304
|
+
await spawno("git", ["pull", "origin", config.baseBranch], { output: true });
|
|
305
|
+
|
|
306
|
+
Logger.log("🔁 Merging " + config.headBranch + " -> " + config.baseBranch);
|
|
307
|
+
await spawno("git", ["merge", config.headBranch], { output: true });
|
|
308
|
+
|
|
309
|
+
Logger.log("🚀 Pushing everything to GitHub.");
|
|
310
|
+
await spawno("git", ["push", "--all"], { output: true });
|
|
311
|
+
|
|
312
|
+
Logger.log("📦 Publishing to npm.");
|
|
313
|
+
await new Promise(
|
|
314
|
+
(res, rej) => spawn("npm", ["publish"], {
|
|
315
|
+
stdio: "inherit"
|
|
316
|
+
}).on("exit", c => c === 0 ? res() : rej(new Error(`exit ${c}`)))
|
|
317
|
+
);
|
|
318
|
+
|
|
319
|
+
Logger.log("🏷️ Creating a new GitHub release.");
|
|
320
|
+
await createRelease(fullName, {
|
|
321
|
+
tag_name: config.version,
|
|
322
|
+
name: config.version,
|
|
323
|
+
body: config.body
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
Logger.log("✅ Created a new release.");
|
|
327
|
+
|
|
328
|
+
Logger.log("🧹 Deleting the " + config.headBranch + " branch locally.");
|
|
329
|
+
await spawno("git", ["branch", "-d", config.headBranch], { output: true });
|
|
330
|
+
|
|
331
|
+
Logger.log("🧹 Deleting the " + config.headBranch + " branch on GitHub.");
|
|
332
|
+
await spawno("git", ["push", "origin", "--delete", config.headBranch], { output: true });
|
|
333
|
+
} catch (e) {
|
|
334
|
+
Logger.log(e);
|
|
335
|
+
}
|
|
336
|
+
}).main(() => {
|
|
337
|
+
app.displayHelp();
|
|
338
|
+
})
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ship-release",
|
|
3
3
|
"description": "Publish new versions on GitHub and npm with ease.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ship-release": "./bin/ship-release.js"
|
|
7
7
|
},
|
|
@@ -11,28 +11,6 @@
|
|
|
11
11
|
},
|
|
12
12
|
"author": "Ionică Bizău <bizauionica@gmail.com> (https://ionicabizau.net)",
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"abs": "^1.3.14",
|
|
16
|
-
"babel-it": "^1.1.11",
|
|
17
|
-
"barbe": "^3.0.16",
|
|
18
|
-
"blah": "^5.2.1",
|
|
19
|
-
"bug-killer": "^4.2.1",
|
|
20
|
-
"find-value": "^1.0.12",
|
|
21
|
-
"gh.js": "^3.2.0",
|
|
22
|
-
"git-up": "^4.0.5",
|
|
23
|
-
"git-url-parse": "^11.6.0",
|
|
24
|
-
"map-o": "^2.0.10",
|
|
25
|
-
"one-by-one": "^3.2.8",
|
|
26
|
-
"package-json-path": "^1.0.9",
|
|
27
|
-
"package.json": "^2.0.1",
|
|
28
|
-
"r-json": "^1.2.10",
|
|
29
|
-
"semver": "^7.3.5",
|
|
30
|
-
"spawn-npm": "^1.4.7",
|
|
31
|
-
"spawno": "^2.1.1",
|
|
32
|
-
"tilda": "^4.4.16",
|
|
33
|
-
"ul": "^5.2.15",
|
|
34
|
-
"w-json": "^1.3.10"
|
|
35
|
-
},
|
|
36
14
|
"repository": {
|
|
37
15
|
"type": "git",
|
|
38
16
|
"url": "git+ssh://git@github.com/IonicaBizau/ship-release.git"
|
|
@@ -65,11 +43,27 @@
|
|
|
65
43
|
"bloggify.json",
|
|
66
44
|
"bloggify/"
|
|
67
45
|
],
|
|
68
|
-
"devDependencies": {},
|
|
69
46
|
"keywords": [
|
|
70
47
|
"ship",
|
|
71
48
|
"release",
|
|
72
49
|
"publish",
|
|
73
50
|
"npm"
|
|
74
|
-
]
|
|
51
|
+
],
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"abs": "^1.3.15",
|
|
54
|
+
"barbe": "^3.0.17",
|
|
55
|
+
"blah": "^5.4.2",
|
|
56
|
+
"bug-killer": "^4.4.4",
|
|
57
|
+
"find-value": "^1.0.13",
|
|
58
|
+
"gh.js": "^3.2.1",
|
|
59
|
+
"git-url-parse": "^16.1.0",
|
|
60
|
+
"map-o": "^2.0.11",
|
|
61
|
+
"package-json-path": "^1.0.10",
|
|
62
|
+
"pkg.json": "^2.0.9",
|
|
63
|
+
"r-json": "^1.3.1",
|
|
64
|
+
"spawno": "^2.1.2",
|
|
65
|
+
"tilda": "^4.4.17",
|
|
66
|
+
"ul": "^5.2.16",
|
|
67
|
+
"w-json": "^1.3.11"
|
|
68
|
+
}
|
|
75
69
|
}
|