@rbbtsn0w/idocs 1.3.0 → 1.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbbtsn0w/idocs",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -37,15 +37,16 @@
37
37
  "smoke": "idocs --help"
38
38
  },
39
39
  "engines": {
40
- "node": ">=20"
40
+ "node": ">=20.8.1"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@semantic-release/changelog": "^6.0.3",
44
44
  "@semantic-release/commit-analyzer": "^13.0.1",
45
+ "@semantic-release/exec": "^7.1.0",
45
46
  "@semantic-release/git": "^10.0.1",
46
47
  "@semantic-release/github": "^11.0.6",
47
48
  "@semantic-release/npm": "^12.0.2",
48
- "@semantic-release/release-notes-generator": "^14.1.0",
49
+ "@semantic-release/release-notes-generator": "^14.1.1",
49
50
  "semantic-release": "^25.0.3"
50
51
  }
51
52
  }
@@ -1,4 +1,4 @@
1
- import { chmodSync, copyFileSync, cpSync, existsSync, mkdirSync, readdirSync, rmSync } from "node:fs";
1
+ import { chmodSync, copyFileSync, cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
2
2
  import { dirname, resolve } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { spawnSync } from "node:child_process";
@@ -8,6 +8,7 @@ const npmRoot = resolve(here, "..");
8
8
  const repoRoot = resolve(npmRoot, "..");
9
9
  const distDir = resolve(npmRoot, "dist");
10
10
  const targetPath = resolve(distDir, "idocs");
11
+ const versionPath = resolve(distDir, "idocs.version");
11
12
  const frameworksTargetDir = resolve(distDir, "Frameworks");
12
13
 
13
14
  function info(msg) {
@@ -51,6 +52,8 @@ if (!sourcePath) {
51
52
  mkdirSync(distDir, { recursive: true });
52
53
  copyFileSync(sourcePath, targetPath);
53
54
  chmodSync(targetPath, 0o755);
55
+ const pkg = JSON.parse(readFileSync(resolve(npmRoot, "package.json"), "utf8"));
56
+ writeFileSync(versionPath, `${pkg.version}\n`);
54
57
 
55
58
  const sourceDir = dirname(sourcePath);
56
59
  rmSync(frameworksTargetDir, { recursive: true, force: true });
@@ -7,6 +7,7 @@ const here = dirname(fileURLToPath(import.meta.url));
7
7
  const npmRoot = resolve(here, "..");
8
8
  const distDir = resolve(npmRoot, "dist");
9
9
  const binaryPath = resolve(distDir, "idocs");
10
+ const versionPath = resolve(distDir, "idocs.version");
10
11
  const frameworksPath = resolve(distDir, "Frameworks");
11
12
  const tmpArchive = resolve(distDir, "idocs-darwin-arm64.tar.gz");
12
13
  const extractedBundleDir = resolve(distDir, "idocs-darwin-arm64");
@@ -33,6 +34,10 @@ function getVersion() {
33
34
  return pkg.version;
34
35
  }
35
36
 
37
+ function writeVersionSidecar(version = getVersion()) {
38
+ writeFileSync(versionPath, `${version}\n`);
39
+ }
40
+
36
41
  function releaseBaseURL(version) {
37
42
  const configured = process.env.IDOCS_RELEASE_BASE_URL;
38
43
  if (configured && configured.trim().length > 0) {
@@ -51,6 +56,10 @@ function normalizeExtractedLayout(root) {
51
56
  cpSync(resolve(bundleDir, "idocs"), binaryPath);
52
57
  }
53
58
 
59
+ if (existsSync(resolve(bundleDir, "idocs.version"))) {
60
+ cpSync(resolve(bundleDir, "idocs.version"), versionPath);
61
+ }
62
+
54
63
  const frameworksDir = resolve(bundleDir, "Frameworks");
55
64
  if (existsSync(frameworksDir)) {
56
65
  rmSync(frameworksPath, { recursive: true, force: true });
@@ -65,11 +74,17 @@ async function main() {
65
74
 
66
75
  if (process.env.IDOCS_LOCAL_BINARY && existsSync(process.env.IDOCS_LOCAL_BINARY)) {
67
76
  log("IDOCS_LOCAL_BINARY found; skipping download.");
77
+ if (existsSync(binaryPath) && !existsSync(versionPath)) {
78
+ writeVersionSidecar();
79
+ }
68
80
  return;
69
81
  }
70
82
 
71
83
  if (!force && existsSync(binaryPath)) {
72
84
  chmodSync(binaryPath, 0o755);
85
+ if (!existsSync(versionPath)) {
86
+ writeVersionSidecar();
87
+ }
73
88
  log("Binary already present; skipping download.");
74
89
  return;
75
90
  }
@@ -111,6 +126,9 @@ async function main() {
111
126
  }
112
127
 
113
128
  chmodSync(binaryPath, 0o755);
129
+ if (!existsSync(versionPath)) {
130
+ writeVersionSidecar(version);
131
+ }
114
132
  unlinkSync(tmpArchive);
115
133
  log("Binary installed successfully.");
116
134
  } catch (error) {