@costrict/cs 3.0.0-preview → 3.0.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.
Files changed (3) hide show
  1. package/bin/cs +14 -2
  2. package/package.json +12 -12
  3. package/postinstall.mjs +13 -3
package/bin/cs CHANGED
@@ -6,14 +6,26 @@ const path = require("path")
6
6
  const os = require("os")
7
7
 
8
8
  function run(target) {
9
+ const DEBUG = process.env.DEBUG === "cs"
10
+ if (DEBUG) {
11
+ console.error(`[DEBUG] Executing: ${target} ${process.argv.slice(2).join(' ')}`)
12
+ console.error(`[DEBUG] target exists: ${fs.existsSync(target)}`)
13
+ }
14
+ if (!fs.existsSync(target)) {
15
+ console.error(`[ERROR] Binary not found: ${target}`)
16
+ process.exit(1)
17
+ }
9
18
  const result = childProcess.spawnSync(target, process.argv.slice(2), {
10
19
  stdio: "inherit",
20
+ shell: process.platform === "win32",
11
21
  })
12
22
  if (result.error) {
13
- console.error(result.error.message)
23
+ console.error(`[ERROR] Execution failed: ${result.error.message}`)
24
+ console.error(`[ERROR] Error code: ${result.error.code}`)
14
25
  process.exit(1)
15
26
  }
16
27
  const code = typeof result.status === "number" ? result.status : 0
28
+ if (DEBUG) console.error(`[DEBUG] Exit code: ${code}`)
17
29
  process.exit(code)
18
30
  }
19
31
 
@@ -44,7 +56,7 @@ let arch = archMap[os.arch()]
44
56
  if (!arch) {
45
57
  arch = os.arch()
46
58
  }
47
- const base = "@costrict/cs-" + platform + "-" + arch
59
+ const base = "@costrict/cs-" + platform + "-" + arch + (platform === "windows" || (platform === "linux" && arch === "x64") ? "-baseline" : "")
48
60
  const binary = platform === "windows" ? "cs.exe" : "cs"
49
61
 
50
62
  function findBinary(startDir) {
package/package.json CHANGED
@@ -6,18 +6,18 @@
6
6
  "scripts": {
7
7
  "postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
8
8
  },
9
- "version": "3.0.0-preview",
9
+ "version": "3.0.1",
10
10
  "optionalDependencies": {
11
- "@costrict/cs-linux-arm64": "3.0.0-preview",
12
- "@costrict/cs-linux-x64": "3.0.0-preview",
13
- "@costrict/cs-linux-x64-baseline": "3.0.0-preview",
14
- "@costrict/cs-linux-arm64-musl": "3.0.0-preview",
15
- "@costrict/cs-linux-x64-musl": "3.0.0-preview",
16
- "@costrict/cs-linux-x64-baseline-musl": "3.0.0-preview",
17
- "@costrict/cs-darwin-arm64": "3.0.0-preview",
18
- "@costrict/cs-darwin-x64": "3.0.0-preview",
19
- "@costrict/cs-darwin-x64-baseline": "3.0.0-preview",
20
- "@costrict/cs-windows-x64": "3.0.0-preview",
21
- "@costrict/cs-windows-x64-baseline": "3.0.0-preview"
11
+ "@costrict/cs-linux-arm64": "3.0.1",
12
+ "@costrict/cs-linux-x64": "3.0.1",
13
+ "@costrict/cs-linux-x64-baseline": "3.0.1",
14
+ "@costrict/cs-linux-arm64-musl": "3.0.1",
15
+ "@costrict/cs-linux-x64-musl": "3.0.1",
16
+ "@costrict/cs-linux-x64-baseline-musl": "3.0.1",
17
+ "@costrict/cs-darwin-arm64": "3.0.1",
18
+ "@costrict/cs-darwin-x64": "3.0.1",
19
+ "@costrict/cs-darwin-x64-baseline": "3.0.1",
20
+ "@costrict/cs-windows-x64": "3.0.1",
21
+ "@costrict/cs-windows-x64-baseline": "3.0.1"
22
22
  }
23
23
  }
package/postinstall.mjs CHANGED
@@ -99,10 +99,20 @@ function symlinkBinary(sourcePath, binaryName) {
99
99
 
100
100
  async function main() {
101
101
  try {
102
+ console.log(`[DEBUG] Platform: ${os.platform()}, Arch: ${os.arch()}`)
103
+
102
104
  if (os.platform() === "win32") {
103
- // On Windows, the .exe is already included in the package and bin field points to it
104
- // No postinstall setup needed
105
- console.log("Windows detected: binary setup not needed (using packaged cs.exe)")
105
+ // On Windows, verify the platform-specific package is installed
106
+ try {
107
+ const { binaryPath } = findBinary()
108
+ console.log(`[DEBUG] Windows binary found at: ${binaryPath}`)
109
+ console.log("Windows: Platform binary verified successfully")
110
+ } catch (error) {
111
+ console.error(`[ERROR] Failed to find Windows binary: ${error.message}`)
112
+ console.error("[ERROR] This usually means @costrict/cs-windows-x64 was not installed")
113
+ console.error("[ERROR] Try: npm install @costrict/cs-windows-x64 --save-optional")
114
+ // Don't exit with error for Windows - let the wrapper handle it
115
+ }
106
116
  return
107
117
  }
108
118