csskit 0.0.11 → 0.0.12-canary.a379503e03

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 (2) hide show
  1. package/bin/csskit +34 -40
  2. package/package.json +7 -7
package/bin/csskit CHANGED
@@ -2,55 +2,49 @@
2
2
  set -e
3
3
 
4
4
  SOURCE="${BASH_SOURCE[0]}"
5
+ SCRIPT_DIR="$(cd "$(dirname "$SOURCE")" && pwd)"
6
+
7
+ # Resolve if bin is symlink; like `readlink -f`/`realpath` but cross-platform
5
8
  while [ -L "$SOURCE" ]; do
6
- DIR="$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)"
7
- TARGET="$(readlink "$SOURCE")"
8
- case "$TARGET" in
9
- /*) SOURCE="$TARGET" ;;
10
- *) SOURCE="$DIR/$TARGET" ;;
11
- esac
9
+ TARGET="$(readlink "$SOURCE")"
10
+ case "$TARGET" in
11
+ /*) SOURCE="$TARGET" ;;
12
+ *) SOURCE="$SCRIPT_DIR/$TARGET" ;;
13
+ esac
14
+ SCRIPT_DIR="$(cd "$(dirname "$SOURCE")" && pwd)"
12
15
  done
13
16
 
14
- # Get script directory
15
- SCRIPT_DIR="$(cd "$(dirname "${SOURCE}")" && pwd)"
16
-
17
- # Detect platform
18
- case "$(uname -s)" in
19
- Linux*) PLATFORM="linux" ;;
20
- Darwin*) PLATFORM="darwin" ;;
21
- MINGW* | MSYS* | CYGWIN*) PLATFORM="win32" ;;
22
- *)
23
- echo "Unsupported platform: $(uname -s)" >&2
24
- exit 1
25
- ;;
26
- esac
27
-
28
- # Detect architecture
29
- case "$(uname -m)" in
30
- x86_64 | amd64) ARCH="x64" ;;
31
- aarch64 | arm64) ARCH="arm64" ;;
17
+ # Detect platform and architecture for sub-package path
18
+ case "$(uname -sm)" in
19
+ "Linux x86_64" | "Linux amd64") BIN="csskit-linux-x64/bin/csskit" ;;
20
+ "Linux aarch64" | "Linux arm64") BIN="csskit-linux-arm64/bin/csskit" ;;
21
+ "Darwin x86_64" | "Darwin amd64") BIN="csskit-darwin-x64/bin/csskit" ;;
22
+ "Darwin arm64") BIN="csskit-darwin-arm64/bin/csskit" ;;
23
+ MINGW*x86_64 | MINGW*amd64 | MSYS*x86_64 | MSYS*amd64 | CYGWIN*x86_64 | CYGWIN*amd64) BIN="csskit-win32-x64/bin/csskit.exe" ;;
24
+ MINGW*aarch64 | MINGW*arm64 | MSYS*aarch64 | MSYS*arm64 | CYGWIN*aarch64 | CYGWIN*arm64) BIN="csskit-win32-arm64/bin/csskit.exe" ;;
32
25
  *)
33
- echo "Unsupported architecture: $(uname -m)" >&2
34
- exit 1
35
- ;;
26
+ echo "Unsupported platform: $(uname -sm)" >&2
27
+ exit 1
28
+ ;;
36
29
  esac
37
30
 
38
- # Package name for this platform
39
- PACKAGE_NAME="csskit-${PLATFORM}-${ARCH}"
31
+ # Walk up directory tree to find node_modules with the binary
32
+ CURRENT_DIR="$(dirname "$SCRIPT_DIR")"
33
+ while [ "$CURRENT_DIR" != "/" ]; do
34
+ # Skip if parent directory is named node_modules to avoid nested node_modules paths
35
+ if [ "$(basename "$CURRENT_DIR")" != "node_modules" ]; then
36
+ BIN_PATH="${CURRENT_DIR}/node_modules/${BIN}"
40
37
 
41
- # Find binary in platform-specific optional dependency
42
- if [ "$PLATFORM" = "win32" ]; then
43
- BIN_PATH="${SCRIPT_DIR}/../node_modules/${PACKAGE_NAME}/bin/csskit.exe"
44
- else
45
- BIN_PATH="${SCRIPT_DIR}/../node_modules/${PACKAGE_NAME}/bin/csskit"
46
- fi
38
+ if [ -f "$BIN_PATH" ]; then
39
+ exec "$BIN_PATH" "$@"
40
+ fi
41
+ fi
47
42
 
48
- if [ -f "$BIN_PATH" ]; then
49
- exec "$BIN_PATH" "$@"
50
- fi
43
+ CURRENT_DIR="$(dirname "$CURRENT_DIR")"
44
+ done
51
45
 
52
46
  # Binary not found
53
- echo "Error: csskit binary not found for ${PLATFORM}-${ARCH}" >&2
47
+ echo "Error: csskit binary not found for ${BIN%%/*}" >&2
54
48
  echo "Please ensure the appropriate platform package is installed:" >&2
55
- echo " npm install ${PACKAGE_NAME}" >&2
49
+ echo " npm install ${BIN%%/*}" >&2
56
50
  exit 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "csskit",
3
- "version": "0.0.11",
3
+ "version": "0.0.12-canary.a379503e03",
4
4
  "description": "Refreshing CSS",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -11,12 +11,12 @@
11
11
  "./bin"
12
12
  ],
13
13
  "optionalDependencies": {
14
- "csskit-linux-x64": "0.0.11",
15
- "csskit-linux-arm64": "0.0.11",
16
- "csskit-darwin-x64": "0.0.11",
17
- "csskit-darwin-arm64": "0.0.11",
18
- "csskit-win32-x64": "0.0.11",
19
- "csskit-win32-arm64": "0.0.11"
14
+ "csskit-linux-x64": "0.0.12-canary.a379503e03",
15
+ "csskit-linux-arm64": "0.0.12-canary.a379503e03",
16
+ "csskit-darwin-x64": "0.0.12-canary.a379503e03",
17
+ "csskit-darwin-arm64": "0.0.12-canary.a379503e03",
18
+ "csskit-win32-x64": "0.0.12-canary.a379503e03",
19
+ "csskit-win32-arm64": "0.0.12-canary.a379503e03"
20
20
  },
21
21
  "funding": {
22
22
  "url": "https://github.com/sponsors/keithamus"