Add cmd wrapper script

This commit is contained in:
Michael Wolf
2025-10-25 14:18:08 -06:00
parent de7dbf45cd
commit 6a4a2f7eef
7 changed files with 99 additions and 0 deletions

19
cmd Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
# This file belongs to the framework. You are not expected to modify it.
# FIXME: Obviously this file isn't nearly robust enough. Make it so.
set -eu
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
subcmd="$1"
# echo "$subcmd"
#exit 3
shift
exec "$DIR"/cmd.d/"$subcmd" "$@"

9
cmd.d/list Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
set -eu
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"
ls .

7
cmd.d/pnpm Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
set -eu
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
"$DIR"/../framework/shims/pnpm "$@"

17
cmd.d/sync Normal file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -eu
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# figure out the platform we're on
# source ../framework/versions
# [eventually: check for it in user's cache dir
# download $nodejs_version
# verify its checksum against $nodejs_checksum
cd $DIR/../framework/node

13
framework/shims/node Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
set -eu
export DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$DIR/../versions"
node_bin="$DIR/../../$nodejs_bin_dir/node"
exec "$node_bin" "$@"

View File

@@ -0,0 +1,21 @@
# FIXME this shouldn't be hardcoded here of course
nodejs_binary_dir="$DIR/../binaries/node-v22.15.1-linux-x64/bin"
# This might be too restrictive. Or not restrictive enough.
PATH="$nodejs_binary_dir":/bin:/usr/bin
project_root="$DIR/../.."
node_dir="$project_root/$nodejs_binary_dir"
export NPM_CONFIG_PREFIX="$node_dir/npm"
export NPM_CONFIG_CACHE="$node_dir/cache"
export NPM_CONFIG_TMP="$node_dir/tmp"
export NODE_PATH="$node_dir/node_modules"
echo $NPM_CONFIG_PREFIX
echo $NPM_CONFIG_CACHE
echo $NPM_CONFIG_TMP
echo $NODE_PATH

13
framework/shims/pnpm Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
set -eu
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$DIR"/node.common
# "$DIR"/../.nodejs-config/node_modules/.bin/pnpm "$@"
echo pnpm file: "$DIR"/../shims/pnpm
exec "$DIR"/../binaries/pnpm "$@"