@arcadible/github-release-tools 0.1.6 → 0.1.8

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.
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+ SCRIPT="$(realpath "$0")"
4
+ DIR="$(dirname "$SCRIPT")"
5
+ RESULT=$(node "$DIR/../src/put-cache.js" "$1")
6
+ echo "cache=$RESULT" >> "$GITHUB_OUTPUT"
package/package.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "arctool-assert-tag": "bin/arctool-assert-tag.sh",
5
5
  "arctool-build": "bin/arctool-build.sh",
6
6
  "arctool-put-build": "bin/arctool-put-build.sh",
7
+ "arctool-put-cache": "bin/arctool-put-cache.sh",
7
8
  "arctool-put-deploy-dir": "bin/arctool-put-deploy-dir.sh",
8
9
  "arctool-put-prerelease": "bin/arctool-put-prerelease.sh",
9
10
  "arctool-put-version": "bin/arctool-put-version.sh"
@@ -17,5 +18,5 @@
17
18
  },
18
19
  "license": "Apache-2.0",
19
20
  "name": "@arcadible/github-release-tools",
20
- "version": "0.1.6"
21
+ "version": "0.1.8"
21
22
  }
package/src/assert-tag.js CHANGED
@@ -2,7 +2,10 @@
2
2
 
3
3
  // [import]
4
4
 
5
- const fs = require("fs");
5
+ const fs = require("node:fs");
6
+
7
+ // [import]
8
+
6
9
  const semver = require("semver");
7
10
 
8
11
  // [use]
package/src/put-build.js CHANGED
@@ -32,7 +32,17 @@ try {
32
32
  }
33
33
  const buf = readFileSync(file, "utf8");
34
34
  const conf = JSON.parse(buf);
35
- write(conf?.workflow?.build ?? "");
35
+ const build = conf?.workflow?.build ?? "";
36
+ if (Array.isArray(build)) {
37
+ write(
38
+ build
39
+ .map((command) => command.trim())
40
+ .filter(Boolean)
41
+ .join(" && "),
42
+ );
43
+ } else {
44
+ write(build);
45
+ }
36
46
  } catch (ex) {
37
47
  writeErr(ex.message);
38
48
  process.exit(1);
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ // [import]
4
+
5
+ const fs = require("node:fs");
6
+ const path = require("node:path");
7
+
8
+ // [use]
9
+
10
+ const dirname = path.dirname;
11
+ const existsSync = fs.existsSync; // eslint-disable-line no-sync
12
+ const join = path.join;
13
+
14
+ // [define]
15
+
16
+ const file = process.argv[2];
17
+
18
+ // [function]
19
+
20
+ const write = function (data) {
21
+ process.stdout.write(data.trim().concat("\n"));
22
+ };
23
+
24
+ // [function]
25
+
26
+ const writeErr = function (data) {
27
+ process.stderr.write(data.trim().concat("\n"));
28
+ };
29
+
30
+ // [main]
31
+
32
+ try {
33
+ if (!file) {
34
+ throw new Error("No file provided.");
35
+ }
36
+ const root = dirname(file);
37
+ if (
38
+ existsSync(join(root, "package-lock.json")) ||
39
+ existsSync(join(root, "npm-shrinkwrap.json"))
40
+ ) {
41
+ write("npm");
42
+ } else if (existsSync(join(root, "pnpm-lock.yaml"))) {
43
+ write("pnpm");
44
+ } else if (existsSync(join(root, "yarn.lock"))) {
45
+ write("yarn");
46
+ } else {
47
+ write("");
48
+ }
49
+ } catch (ex) {
50
+ writeErr(ex.message);
51
+ process.exit(1);
52
+ }
@@ -2,7 +2,10 @@
2
2
 
3
3
  // [import]
4
4
 
5
- const fs = require("fs");
5
+ const fs = require("node:fs");
6
+
7
+ // [import]
8
+
6
9
  const semver = require("semver");
7
10
 
8
11
  // [use]
@@ -2,7 +2,10 @@
2
2
 
3
3
  // [import]
4
4
 
5
- const fs = require("fs");
5
+ const fs = require("node:fs");
6
+
7
+ // [import]
8
+
6
9
  const semver = require("semver");
7
10
 
8
11
  // [use]