compile before symlink

This commit is contained in:
2025-09-07 02:50:17 +02:00
parent 9c2a6cb7e7
commit c9a13afbe8
3 changed files with 94 additions and 7 deletions

View File

@@ -130,6 +130,51 @@ main() {
echo echo
print_info "Installing extension..." 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 # Check if destination already exists
if [ -e "$EXTENSION_DEST" ]; then if [ -e "$EXTENSION_DEST" ]; then
print_warning "Destination already exists: $EXTENSION_DEST" print_warning "Destination already exists: $EXTENSION_DEST"

View File

@@ -0,0 +1 @@
v22

View File

@@ -2,16 +2,45 @@
## Quick Installation ## Quick Installation
1. **Copy the extension folder** to your VS Code extensions directory: ### Automated Installation (Recommended)
Use the provided installation script for the easiest setup:
```bash
./install-extension.sh
```
This script will:
1. **Compile the extension** using npm and the correct Node.js version (via nvm if available)
2. **Create a symlink** to your VS Code extensions directory
3. **Handle dependencies** automatically
### Manual Installation
1. **Compile the extension**:
```bash
cd vscode-extension-ashes
# Use nvm if available (recommended)
nvm use # Uses version from .nvmrc
# Install dependencies
npm install
# Compile TypeScript
npm run compile
```
2. **Copy the extension folder** to your VS Code extensions directory:
- **Linux**: `~/.vscode/extensions/` - **Linux**: `~/.vscode/extensions/`
- **macOS**: `~/.vscode/extensions/` - **macOS**: `~/.vscode/extensions/`
- **Windows**: `%USERPROFILE%\.vscode\extensions\` - **Windows**: `%USERPROFILE%\.vscode\extensions\`
2. **Rename the folder** to `ashes-language-support-0.1.0` (or similar) 3. **Rename the folder** to `ashes-language-support-0.1.0` (or similar)
3. **Reload VS Code** or restart the application 4. **Reload VS Code** or restart the application
4. **Test the extension** by opening any `.esc` file 5. **Test the extension** by opening any `.esc` file
## Alternative Installation (Development Mode) ## Alternative Installation (Development Mode)
@@ -27,17 +56,23 @@
## Building from Source ## Building from Source
1. **Install dependencies**: 1. **Set up Node.js version** (recommended):
```bash
# Use nvm if available to get the correct Node.js version
nvm use # Uses version from .nvmrc (v22)
```
2. **Install dependencies**:
```bash ```bash
npm install npm install
``` ```
2. **Compile TypeScript**: 3. **Compile TypeScript**:
```bash ```bash
npm run compile npm run compile
``` ```
3. **Package the extension** (optional): 4. **Package the extension** (optional):
```bash ```bash
npx vsce package npx vsce package
``` ```
@@ -79,6 +114,12 @@
- Press `Ctrl+Space` to manually trigger completion - Press `Ctrl+Space` to manually trigger completion
- Check that the extension is activated (should show in the Extensions panel) - Check that the extension is activated (should show in the Extensions panel)
### Compilation errors
- Make sure you're using the correct Node.js version: `nvm use` (uses v22 from .nvmrc)
- Clear node_modules and reinstall: `rm -rf node_modules && npm install`
- Check that TypeScript is installed: `npm list typescript`
- Ensure all dependencies are installed: `npm install`
## Uninstalling ## Uninstalling
Simply delete the extension folder from your VS Code extensions directory and restart VS Code. Simply delete the extension folder from your VS Code extensions directory and restart VS Code.