mirror of
https://github.com/selfxyz/self.git
synced 2026-01-10 15:18:18 -05:00
* Add tree-shakeable exports * Migrate imports for tree-shakeable paths * Document ESM extension requirement * udpates * install new lock * yarn nice * build deps * save working index export no wildcard approach * save wip * fix building * add tree shaking doc and examples * sort package json files * update package.json * fix analyzing web * make sure that web is built * wip tree shaking * building works again. save wip logic * use granular imports * wip test * save wip * Remove hardcoded .d.ts files and setup automatic TypeScript declaration generation - Remove redundant constants.d.ts, types.d.ts, utils.d.ts files - Add build:types script to automatically generate TypeScript declarations - Update tsup config to disable DTS generation (handled separately) - Update .gitignore to prevent future commits of generated .d.ts files - Fixes import resolution errors in app by ensuring declarations are always generated * Add .gitignore rules for generated TypeScript declarations * ignore dts files * Remove redundant index.js re-export files - Remove constants.js, types.js, utils.js as they're redundant with tsup build - These were just re-exports pointing to dist files that tsup generates - package.json exports already point directly to built files - Update .gitignore to prevent future commits of these generated files - tsup handles all the building, no manual re-export files needed * save current wip fixes * add tsup config for web building * common prettier and fix imports * prettier * fix tests * implement level 3 tree shaking * improve splitting * optimize vite web building and prettier * remove comments * sort export params * feedback and fix pipelines * fix circuit-names path * fix test * fix building * sort * fix building * allow cursor to edit scripts * fix loadDocumentCatalog undefined * fix build settings * fix build settings * additional metro tree shaking * improved discovery script for xcode building * pr feedback and fix camelCasing * simplify shim setup * fix xcode building and add command to test building * remove comment * simplify
58 lines
1.8 KiB
Bash
58 lines
1.8 KiB
Bash
# Environment configuration for Xcode script phases
|
|
# Create `.xcode.env.local` for local customizations (not versioned)
|
|
|
|
# Dynamic Node.js binary detection with security validation
|
|
find_node_binary() {
|
|
# Check PATH first (safest option)
|
|
if command -v node >/dev/null 2>&1; then
|
|
local node_path=$(command -v node)
|
|
# Validate it's actually executable
|
|
if [ -x "$node_path" ] && [ -f "$node_path" ]; then
|
|
echo "$node_path"
|
|
return 0
|
|
fi
|
|
fi
|
|
|
|
# Common installation paths (hardcoded for security)
|
|
local paths=(
|
|
"/opt/homebrew/bin/node"
|
|
"/usr/local/bin/node"
|
|
"/opt/node/bin/node"
|
|
"/usr/bin/node"
|
|
)
|
|
|
|
for path in "${paths[@]}"; do
|
|
# Validate path is absolute and executable
|
|
if [ -x "$path" ] && [ -f "$path" ] && [[ "$path" = /* ]]; then
|
|
echo "$path"
|
|
return 0
|
|
fi
|
|
done
|
|
|
|
# Check NVM installation with validation
|
|
if [ -n "$NVM_DIR" ] && [ -f "$NVM_DIR/nvm.sh" ] && [[ "$NVM_DIR" = /* ]]; then
|
|
local nvmrc_file="$HOME/.nvmrc"
|
|
if [ -f "$nvmrc_file" ] && [ -r "$nvmrc_file" ]; then
|
|
# Read and sanitize version string
|
|
local nvmrc_version
|
|
nvmrc_version=$(head -n1 "$nvmrc_file" 2>/dev/null | tr -cd 'a-zA-Z0-9.-_' || echo "v18.17.0")
|
|
|
|
# Validate version format (should start with 'v' and contain only safe chars)
|
|
if [[ "$nvmrc_version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
local nvm_node="$HOME/.nvm/versions/node/$nvmrc_version/bin/node"
|
|
# Validate the constructed path is safe
|
|
if [ -x "$nvm_node" ] && [ -f "$nvm_node" ] && [[ "$nvm_node" = /* ]] && [[ "$nvm_node" = "$HOME/.nvm/versions/node/"* ]]; then
|
|
echo "$nvm_node"
|
|
return 0
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
# Fallback to system node (least secure but necessary)
|
|
echo "node"
|
|
return 1
|
|
}
|
|
|
|
export NODE_BINARY=$(find_node_binary)
|