compile before symlink
This commit is contained in:
@@ -130,6 +130,51 @@ main() {
|
||||
echo
|
||||
print_info "Installing extension..."
|
||||
|
||||
# Compile the extension before creating symlink
|
||||
print_info "Compiling extension..."
|
||||
cd "$EXTENSION_SOURCE" || {
|
||||
print_error "Failed to change to extension directory: $EXTENSION_SOURCE"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check if nvm is available and use it if .nvmrc exists
|
||||
if [ -f ".nvmrc" ] && command -v nvm &> /dev/null; then
|
||||
print_info "Using nvm to set Node.js version from .nvmrc"
|
||||
source ~/.nvm/nvm.sh
|
||||
nvm use || {
|
||||
print_warning "Failed to use nvm, continuing with system Node.js"
|
||||
}
|
||||
elif [ -f ".nvmrc" ] && [ -s "$NVM_DIR/nvm.sh" ]; then
|
||||
print_info "Loading nvm and using Node.js version from .nvmrc"
|
||||
source "$NVM_DIR/nvm.sh"
|
||||
nvm use || {
|
||||
print_warning "Failed to use nvm, continuing with system Node.js"
|
||||
}
|
||||
fi
|
||||
|
||||
# Install dependencies if node_modules doesn't exist
|
||||
if [ ! -d "node_modules" ]; then
|
||||
print_info "Installing npm dependencies..."
|
||||
npm install || {
|
||||
print_error "Failed to install npm dependencies"
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
print_info "Dependencies already installed, skipping npm install"
|
||||
fi
|
||||
|
||||
# Compile TypeScript
|
||||
print_info "Compiling TypeScript..."
|
||||
npm run compile || {
|
||||
print_error "Failed to compile TypeScript"
|
||||
exit 1
|
||||
}
|
||||
|
||||
print_success "Extension compiled successfully!"
|
||||
|
||||
# Return to original directory
|
||||
cd - > /dev/null
|
||||
|
||||
# Check if destination already exists
|
||||
if [ -e "$EXTENSION_DEST" ]; then
|
||||
print_warning "Destination already exists: $EXTENSION_DEST"
|
||||
|
||||
Reference in New Issue
Block a user