@arcadible/github-release-tools 0.1.0 → 0.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.
@@ -4,6 +4,6 @@ SCRIPT="$(realpath "$0")"
4
4
  DIR="$(dirname "$SCRIPT")"
5
5
  RESULT=$(node "$DIR/../src/assert-tag.js" "$1")
6
6
  if [ "$RESULT" != "true" ]; then
7
- echo "Invalid semver: $1"
7
+ echo "Invalid tag: $1"
8
8
  exit 1
9
9
  fi
@@ -8,12 +8,6 @@ if [ ! -f "$JSON" ]; then
8
8
  else
9
9
  npm --prefix "$PACKAGE" ci --silent
10
10
  fi
11
- if jq -e '.scripts.lint' "$JSON" >/dev/null 2>&1; then
12
- npm --prefix "$PACKAGE" run lint --silent
13
- fi
14
- if jq -e '.scripts.test' "$JSON" >/dev/null 2>&1; then
15
- npm --prefix "$PACKAGE" run test --silent
16
- fi
17
11
  if jq -e '.scripts.build' "$JSON" >/dev/null 2>&1; then
18
12
  npm --prefix "$PACKAGE" run build --silent
19
13
  fi
@@ -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-version.js" "$1")
6
+ echo "version=$RESULT" >> "$GITHUB_OUTPUT"
package/package.json CHANGED
@@ -5,7 +5,8 @@
5
5
  "arctool-build": "bin/arctool-build.sh",
6
6
  "arctool-put-deploy-dir": "bin/arctool-put-deploy-dir.sh",
7
7
  "arctool-put-prerelease": "bin/arctool-put-prerelease.sh",
8
- "arctool-put-skip-build": "bin/arctool-put-skip-build.sh"
8
+ "arctool-put-skip-build": "bin/arctool-put-skip-build.sh",
9
+ "arctool-put-version": "bin/arctool-put-version.sh"
9
10
  },
10
11
  "dependencies": {
11
12
  "semver": "^7.7.3"
@@ -16,5 +17,5 @@
16
17
  },
17
18
  "license": "Apache-2.0",
18
19
  "name": "@arcadible/github-release-tools",
19
- "version": "0.1.0"
20
+ "version": "0.1.1"
20
21
  }
package/src/assert-dir.js CHANGED
@@ -18,7 +18,7 @@ const write = function (data) {
18
18
  process.stdout.write(data.trim().concat("\n"));
19
19
  };
20
20
 
21
- // [start]
21
+ // [main]
22
22
 
23
23
  try {
24
24
  if (!tag) {
package/src/assert-tag.js CHANGED
@@ -18,13 +18,17 @@ const write = function (data) {
18
18
  process.stdout.write(data.trim().concat("\n"));
19
19
  };
20
20
 
21
- // [start]
21
+ // [main]
22
22
 
23
23
  try {
24
24
  if (!tag) {
25
25
  throw new Error("No tag provided.");
26
26
  }
27
- write(valid(tag) ? "true" : "false");
27
+ if (!tag.startsWith("arcadible/")) {
28
+ throw new Error("Invalid tag prefix.");
29
+ }
30
+ const version = tag.split("/").pop();
31
+ write(valid(version) ? "true" : "false");
28
32
  } catch {
29
33
  write("false");
30
34
  }
@@ -21,10 +21,10 @@ const write = function (data) {
21
21
  // [function]
22
22
 
23
23
  const writeErr = function (data) {
24
- process.stdout.write(data.trim().concat("\n"));
24
+ process.stderr.write(data.trim().concat("\n"));
25
25
  };
26
26
 
27
- // [start]
27
+ // [main]
28
28
 
29
29
  try {
30
30
  if (!file) {
@@ -22,16 +22,20 @@ const write = function (data) {
22
22
  // [function]
23
23
 
24
24
  const writeErr = function (data) {
25
- process.stdout.write(data.trim().concat("\n"));
25
+ process.stderr.write(data.trim().concat("\n"));
26
26
  };
27
27
 
28
- // [start]
28
+ // [main]
29
29
 
30
30
  try {
31
31
  if (!tag) {
32
32
  throw new Error("No tag provided.");
33
33
  }
34
- write(valid(tag) && prerelease(tag) ? "true" : "false");
34
+ if (!tag.startsWith("arcadible/")) {
35
+ throw new Error("Invalid tag prefix.");
36
+ }
37
+ const version = tag.split("/").pop();
38
+ write(valid(version) && prerelease(version) ? "true" : "false");
35
39
  } catch (ex) {
36
40
  writeErr(ex.message);
37
41
  process.exit(1);
@@ -21,10 +21,10 @@ const write = function (data) {
21
21
  // [function]
22
22
 
23
23
  const writeErr = function (data) {
24
- process.stdout.write(data.trim().concat("\n"));
24
+ process.stderr.write(data.trim().concat("\n"));
25
25
  };
26
26
 
27
- // [start]
27
+ // [main]
28
28
 
29
29
  try {
30
30
  if (!file) {
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ // [import]
4
+
5
+ const semver = require("semver");
6
+
7
+ // [use]
8
+
9
+ const valid = semver.valid;
10
+
11
+ // [define]
12
+
13
+ const tag = process.argv[2];
14
+
15
+ // [function]
16
+
17
+ const write = function (data) {
18
+ process.stdout.write(data.trim().concat("\n"));
19
+ };
20
+
21
+ // [function]
22
+
23
+ const writeErr = function (data) {
24
+ process.stderr.write(data.trim().concat("\n"));
25
+ };
26
+
27
+ // [main]
28
+
29
+ try {
30
+ if (!tag) {
31
+ throw new Error("No tag provided.");
32
+ }
33
+ if (!tag.startsWith("arcadible/")) {
34
+ throw new Error("Invalid tag prefix.");
35
+ }
36
+ const version = tag.split("/").pop();
37
+ if (!valid(version)) {
38
+ throw new Error("Invalid semver.");
39
+ }
40
+ write(version);
41
+ } catch (ex) {
42
+ writeErr(ex.message);
43
+ process.exit(1);
44
+ }
@@ -1,39 +0,0 @@
1
- {
2
- "lockfileVersion": 3,
3
- "name": "@arcadible/github-release-tools",
4
- "packages": {
5
- "": {
6
- "bin": {
7
- "arctool-assert-dir": "bin/arctool-assert-dir.sh",
8
- "arctool-assert-tag": "bin/arctool-assert-tag.sh",
9
- "arctool-build": "bin/arctool-build.sh",
10
- "arctool-put-deploy-dir": "bin/arctool-put-deploy-dir.sh",
11
- "arctool-put-prerelease": "bin/arctool-put-prerelease.sh",
12
- "arctool-put-skip-build": "bin/arctool-put-skip-build.sh"
13
- },
14
- "dependencies": {
15
- "semver": "^7.7.3"
16
- },
17
- "engines": {
18
- "node": ">=24.11.1"
19
- },
20
- "license": "Apache-2.0",
21
- "name": "@arcadible/github-release-tools",
22
- "version": "0.1.0"
23
- },
24
- "node_modules/semver": {
25
- "bin": {
26
- "semver": "bin/semver.js"
27
- },
28
- "engines": {
29
- "node": ">=10"
30
- },
31
- "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
32
- "license": "ISC",
33
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
34
- "version": "7.8.5"
35
- }
36
- },
37
- "requires": true,
38
- "version": "0.1.0"
39
- }