Installation
ScriptIt can be installed globally for CLI usage or locally as a library dependency. Choose the installation method that best fits your needs.
Global Installation (CLI Usage)
Install ScriptIt globally to use the scriptit
command from anywhere in your system:
bun add -g @glyphtek/scriptit
npm install -g @glyphtek/scriptit
pnpm add -g @glyphtek/scriptit
yarn global add @glyphtek/scriptit
After global installation, verify it works:
scriptit --version
Local Installation (Library Usage)
Install ScriptIt as a dependency in your project:
bun add @glyphtek/scriptit
npm install @glyphtek/scriptit
pnpm add @glyphtek/scriptit
yarn add @glyphtek/scriptit
Development Installation
For development or contributing to ScriptIt:
# Clone the repository
git clone https://github.com/glyphtek/scriptit.git
cd scriptit
# Install dependencies
bun install
# Build the project
bun run build
# Run tests
bun test
# Start development server
bun run dev
Runtime Requirements
ScriptIt supports multiple JavaScript runtimes:
Bun (Recommended)
- Version: 1.0.0 or higher
- Installation: Download from bun.sh
- Benefits: Fastest performance, native TypeScript support
# Install Bun
curl -fsSL https://bun.sh/install | bash
Node.js
- Version: 18.0.0 or higher
- Installation: Download from nodejs.org
- Benefits: Mature ecosystem, wide compatibility
# Using nvm (recommended)
nvm install 18
nvm use 18
Deno
- Version: 1.30.0 or higher
- Installation: Download from deno.land
- Benefits: Secure by default, built-in TypeScript
# Install Deno
curl -fsSL https://deno.land/install.sh | sh
Verification
After installation, verify ScriptIt is working correctly:
CLI Verification
# Check version
scriptit --version
# Run help
scriptit --help
# Test with a simple script
echo 'export async function execute(context) { context.console.log("Hello, ScriptIt!"); }' > test.js
scriptit exec test.js
rm test.js
Library Verification
Create a test file test-scriptit.js
:
import { createScriptRunner } from '@glyphtek/scriptit'
const runner = createScriptRunner({
consoleInterception: true
})
await runner.executeCode(`
export async function execute(context) {
context.console.log('ScriptIt is working!')
context.console.info('Runtime:', process.version)
return { success: true }
}
`)
Run the test:
# With Bun
bun test-scriptit.js
# With Node.js
node test-scriptit.js
# With Deno
deno run test-scriptit.js
Platform-Specific Instructions
macOS
Using Homebrew (if available):
# Install Bun via Homebrew
brew install bun
# Install ScriptIt
bun add -g @glyphtek/scriptit
Linux
# Install Bun
curl -fsSL https://bun.sh/install | bash
# Add to PATH (add to ~/.bashrc or ~/.zshrc)
export PATH="$HOME/.bun/bin:$PATH"
# Install ScriptIt
bun add -g @glyphtek/scriptit
Windows
Using PowerShell:
# Install Bun
powershell -c "irm bun.sh/install.ps1 | iex"
# Install ScriptIt
bun add -g @glyphtek/scriptit
Or using npm:
npm install -g @glyphtek/scriptit
Docker Installation
Use ScriptIt in a Docker container:
FROM oven/bun:latest
# Install ScriptIt globally
RUN bun add -g @glyphtek/scriptit
# Set working directory
WORKDIR /app
# Copy your scripts
COPY . .
# Run your script
CMD ["scriptit", "run", "your-script.js", "--console-colors"]
Build and run:
docker build -t my-scriptit-app .
docker run my-scriptit-app
CI/CD Installation
GitHub Actions
name: Run Scripts with ScriptIt
on: [push]
jobs:
run-scripts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install ScriptIt
run: bun add -g @glyphtek/scriptit
- name: Run scripts
run: scriptit run build.js --console-colors
GitLab CI
stages:
- build
run-scripts:
stage: build
image: oven/bun:latest
script:
- bun add -g @glyphtek/scriptit
- scriptit run deploy.js --runtime bun
Troubleshooting
Permission Issues
If you encounter permission errors during global installation:
# For npm (create .npmrc in home directory)
echo "prefix=~/.npm-global" >> ~/.npmrc
export PATH=~/.npm-global/bin:$PATH
# For Bun
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
Command Not Found
If scriptit
command is not found after installation:
- Check PATH: Ensure the installation directory is in your PATH
- Restart terminal: Close and reopen your terminal
- Verify installation: Check if the package was installed correctly
# Check where scriptit is installed
which scriptit
# Check if it's in your PATH
echo $PATH
Runtime Issues
If you encounter runtime-specific issues:
- Update runtime: Ensure you're using a supported version
- Clear cache: Clear package manager cache
- Reinstall: Remove and reinstall ScriptIt
# Clear Bun cache
bun pm cache rm
# Clear npm cache
npm cache clean --force
# Reinstall ScriptIt
bun remove -g @glyphtek/scriptit
bun add -g @glyphtek/scriptit
Next Steps
After successful installation:
- 📖 Read the Getting Started guide
- 🎨 Try the Colored Console feature
- 🖥️ Explore the CLI Commands
- 📚 Check out Examples
Support
If you encounter installation issues: