donder-release-cli 1.1.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/LICENSE +9 -0
- package/README.md +34 -0
- package/npm/pre-install.js +49 -0
- package/npm/start.js +27 -0
- package/npm/uninstall.js +41 -0
- package/package.json +22 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Cloudoki <opensource@cloudoki.com> (cloudoki.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# donder-release
|
|
2
|
+
|
|
3
|
+
Quickly create releases on Github from the command line or CI using conventional commits.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
#### With Cargo
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cargo install donder-release
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
See CLI options:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
donder-release --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
#### With Npm
|
|
20
|
+
|
|
21
|
+
See CLI options:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx donder-release@latest --help
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
#### TODO
|
|
28
|
+
|
|
29
|
+
- Footer links support
|
|
30
|
+
- Add documentation
|
|
31
|
+
- Add tests
|
|
32
|
+
- Add CI
|
|
33
|
+
- Add support to other git providers(?)
|
|
34
|
+
- Add support for mono-repos(?)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { exec } = require("child_process");
|
|
6
|
+
|
|
7
|
+
const cargoDir = path.dirname("$HOME" + ".cargo");
|
|
8
|
+
|
|
9
|
+
// check if directory exists
|
|
10
|
+
if (fs.existsSync(cargoDir)) {
|
|
11
|
+
// console.log("Cargo found.");
|
|
12
|
+
} else {
|
|
13
|
+
const setCargo = 'PATH="/$HOME/.cargo/bin:${PATH}"';
|
|
14
|
+
console.log("Installing deps [cargo].");
|
|
15
|
+
|
|
16
|
+
exec(
|
|
17
|
+
`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && ${setCargo}`,
|
|
18
|
+
(error) => {
|
|
19
|
+
if (error) {
|
|
20
|
+
console.log(
|
|
21
|
+
"curl failed! Curl may not be installed on the OS. View https://curl.se/download.html to install."
|
|
22
|
+
);
|
|
23
|
+
console.log(error);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const features = process.env.npm_config_features
|
|
30
|
+
? `--features ${process.env.npm_config_features.replace(",", " ")}`
|
|
31
|
+
: "";
|
|
32
|
+
const version = process.env.npm_config_version
|
|
33
|
+
? process.env.npm_config_version
|
|
34
|
+
: require("../package.json").version;
|
|
35
|
+
|
|
36
|
+
console.log(
|
|
37
|
+
`Installing and compiling donder-release ${version} ${features} ...`
|
|
38
|
+
);
|
|
39
|
+
exec(
|
|
40
|
+
`cargo install donder-release --vers ${version} ${features}`,
|
|
41
|
+
(error, stdout, stderr) => {
|
|
42
|
+
console.log(stdout);
|
|
43
|
+
if (error || stderr) {
|
|
44
|
+
console.log(error || stderr);
|
|
45
|
+
} else {
|
|
46
|
+
console.log("install finished!");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
);
|
package/npm/start.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { exec } = require("child_process");
|
|
4
|
+
|
|
5
|
+
const controller =
|
|
6
|
+
typeof AbortController !== "undefined"
|
|
7
|
+
? new AbortController()
|
|
8
|
+
: { abort: () => {} };
|
|
9
|
+
const { signal } = controller;
|
|
10
|
+
|
|
11
|
+
const [, , ...args] = process.argv;
|
|
12
|
+
|
|
13
|
+
exec(
|
|
14
|
+
`donder-release ${args.join(" ")}`,
|
|
15
|
+
{ signal },
|
|
16
|
+
(error, stdout, stderr) => {
|
|
17
|
+
stdout && console.log(stdout);
|
|
18
|
+
stderr && console.error(stderr);
|
|
19
|
+
if (error !== null) {
|
|
20
|
+
console.log(`exec error: ${error}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
process.on("SIGTERM", () => {
|
|
26
|
+
controller.abort();
|
|
27
|
+
});
|
package/npm/uninstall.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { exec } = require("child_process");
|
|
6
|
+
|
|
7
|
+
const cargoDir = path.dirname("$HOME" + ".cargo");
|
|
8
|
+
|
|
9
|
+
// check if directory exists
|
|
10
|
+
if (fs.existsSync(cargoDir)) {
|
|
11
|
+
// console.log("Cargo found.");
|
|
12
|
+
} else {
|
|
13
|
+
const setCargo = 'PATH="/$HOME/.cargo/bin:${PATH}"';
|
|
14
|
+
console.log("Installing deps [cargo].");
|
|
15
|
+
|
|
16
|
+
exec(
|
|
17
|
+
`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && ${setCargo}`,
|
|
18
|
+
(error) => {
|
|
19
|
+
if (error) {
|
|
20
|
+
console.log(
|
|
21
|
+
"curl failed! Curl may not be installed on the OS. View https://curl.se/download.html to install."
|
|
22
|
+
);
|
|
23
|
+
console.log(error);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const binp = path.join(cargoDir, "bin", "donder-release");
|
|
30
|
+
|
|
31
|
+
if (fs.existsSync(binp)) {
|
|
32
|
+
console.log("Uninstalling donder-release...");
|
|
33
|
+
exec(`cargo uninstall donder-release`, (error, stdout, stderr) => {
|
|
34
|
+
console.log(stdout);
|
|
35
|
+
if (error || stderr) {
|
|
36
|
+
console.log(error || stderr);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
console.log("donder-release not found skipping!");
|
|
41
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "donder-release-cli",
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "Quickly create releases on Github from the command line or CI using conventional commits.",
|
|
5
|
+
"author": "Bruno Morgado <bruno@cloudoki.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "npm/start.js",
|
|
8
|
+
"bin": {
|
|
9
|
+
"donder-release": "npm/start.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"npm/**/*",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
18
|
+
"postinstall": "node ./npm/pre-install.js",
|
|
19
|
+
"uninstall": "node ./npm/uninstall.js",
|
|
20
|
+
"deploy": "cargo publish && npm publish"
|
|
21
|
+
}
|
|
22
|
+
}
|