Appearance
Plugin Development Workflows
Common development patterns and workflows using the Noorle CLI.
Complete Workflow for New Projects
1. Initial Setup (One-time)
bash
# Authenticate with Noorle Platform
noorle login
# List available templates
noorle plugin list-templates
2. Project Creation
bash
# Create a new Rust project
noorle plugin init weather-plugin --template rust
cd weather-plugin
# Explore the generated structure
ls -la
3. Development Cycle
bash
# Install dependencies
noorle plugin prepare
# Make code changes
# Edit src/lib.rs, src/main.rs, etc.
# Validate configuration
noorle plugin validate noorle.yaml
# Build project
noorle plugin build
# Test locally
wasmtime run dist/plugin.wasm
# Deploy to platform
noorle plugin deploy
4. Iterative Development
bash
# Quick iteration: build and deploy together
noorle plugin publish
# For faster development, build only
noorle plugin build
# ... test changes locally ...
# Then deploy when ready
noorle plugin deploy
Language-Specific Workflows
Rust Development Workflow
bash
# 1. Create Rust project
noorle plugin init rust-service --template rust
cd rust-service
# 2. Set up development environment
noorle plugin prepare
# 3. Development cycle
# Edit Cargo.toml for dependencies
# Edit src/lib.rs for main logic
# 4. Local testing
cargo test
cargo check --target wasm32-unknown-unknown
# 5. Build and deploy
noorle plugin build
noorle plugin deploy
Rust Project Development Example:
rust
// src/lib.rs
use wasm_bindgen::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct PluginConfig {
pub api_key: String,
pub endpoint: String,
}
#[wasm_bindgen]
pub fn process_request(input: &str) -> String {
// Your plugin logic here
format!("Processed: {}", input)
}
Python Development Workflow
bash
# 1. Create Python project
noorle plugin init python-analyzer --template python
cd python-analyzer
# 2. Set up environment
noorle plugin prepare
# 3. Development
# Edit src/main.py
# Add to requirements.txt as needed
# 4. Build and deploy
noorle plugin build
noorle plugin deploy
TypeScript Development Workflow
bash
# 1. Create TypeScript project
noorle plugin init ts-service --template typescript
cd ts-service
# 2. Set up environment
noorle plugin prepare
# 3. Development
# Edit src/index.ts
# Update package.json dependencies
# 4. Local compilation check
npx tsc --noEmit
# 5. Build and deploy
noorle plugin build
noorle plugin deploy
Batch Processing Workflows
Creating Multiple Projects
bash
# Create projects for different languages
templates=("rust" "python" "typescript" "go")
for template in "${templates[@]}"; do
project_name="${template}-service"
noorle plugin init "$project_name" --template "$template"
echo "Created $project_name with $template template"
done
Building Multiple Projects
bash
# Build all projects in current directory
for project_dir in */; do
if [ -f "$project_dir/noorle.yaml" ]; then
echo "Building $project_dir..."
cd "$project_dir"
noorle plugin build
cd ..
fi
done
Deploying Multiple Projects
bash
# Deploy all built projects
for project_dir in */; do
if [ -f "$project_dir/dist/plugin.wasm" ]; then
echo "Deploying $project_dir..."
cd "$project_dir"
noorle plugin deploy
cd ..
fi
done
Validation and Quality Assurance
Pre-Build Validation
bash
# Complete validation workflow
cd my_project
# Validate configuration files
noorle plugin validate noorle.yaml
# Language-specific validation
if [ -f "Cargo.toml" ]; then
cargo check
fi
if [ -f "package.json" ]; then
npm run lint
fi
if [ -f "requirements.txt" ]; then
python -m py_compile src/*.py
fi
# Build with validation
noorle plugin build
Testing Workflow
bash
# Rust testing
if [ -f "Cargo.toml" ]; then
cargo test
cargo test --target wasm32-unknown-unknown
fi
# Python testing
if [ -f "requirements.txt" ]; then
python -m pytest tests/
fi
# TypeScript testing
if [ -f "package.json" ]; then
npm test
fi
# Integration testing
noorle plugin build
# Test the built WASM binary
CI/CD Integration
GitHub Actions Workflow
yaml
name: Build and Deploy
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Noorle CLI
run: |
curl -L cli.noorle.dev | sh
echo "$HOME/.noorle/bin" >> $GITHUB_PATH
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Prepare dependencies
run: noorle plugin prepare --ci
- name: Build project
run: noorle plugin build
- name: Deploy to staging
if: github.ref == 'refs/heads/main'
env:
NOORLE_TOKEN: ${{ secrets.NOORLE_TOKEN }}
run: |
echo "$NOORLE_TOKEN" > ~/.noorle_token
noorle plugin deploy
Docker Workflow
dockerfile
FROM rust:1.70 as builder
# Install Noorle CLI
RUN curl -L cli.noorle.dev | sh && \
echo 'export PATH=$PATH:$HOME/.noorle/bin' >> ~/.bashrc
# Install WASM target
RUN rustup target add wasm32-unknown-unknown
WORKDIR /app
COPY . .
# Prepare dependencies and build project
RUN ~/.noorle/bin/noorle plugin prepare --ci && \
~/.noorle/bin/noorle plugin build
# Deploy stage
FROM alpine:latest
RUN apk add --no-cache ca-certificates
COPY --from=builder /app/dist/ /dist/
Debugging Workflows
Local Debugging
bash
# Enable debug logging
export RUST_LOG=debug
# Detailed build information
noorle plugin build
# Inspect build output
ls -la dist/
file dist/plugin.wasm
# Check WASM binary details
wasm-objdump -h dist/plugin.wasm
Remote Debugging
bash
# Deploy with debug symbols
RUST_LOG=debug noorle plugin deploy
Performance Optimization
Build Optimization
bash
# Profile build times
time noorle plugin build
# Check binary size
ls -lh dist/plugin.wasm
Runtime Optimization
toml
# Cargo.toml optimizations
[profile.release]
lto = "fat"
codegen-units = 1
strip = true
panic = "abort"
opt-level = "z"
Troubleshooting Common Issues
Authentication Problems
bash
# Clear authentication and re-login
noorle logout
rm -f ~/.noorle_token
noorle login
Build Failures
bash
# Clean build environment
rm -rf dist/
rm -rf target/ # For Rust projects
# Rebuild with debug info
RUST_LOG=debug noorle plugin build
# Check build script permissions
chmod +x build.sh
Deployment Issues
bash
# Verify build output exists
ls -la dist/plugin.wasm
# Check file size (ensure it's not too large)
ls -lh dist/plugin.wasm
# Deploy with debug logging
RUST_LOG=debug noorle plugin deploy
Advanced Workflows
Multi-Environment Deployment
bash
# Environment-specific configuration
cp noorle.staging.yaml noorle.yaml
noorle plugin build
noorle plugin deploy
Version Management
bash
# Update version before deployment
sed -i 's/version: .*/version: 1.2.3/' noorle.yaml
noorle plugin validate noorle.yaml
noorle plugin publish
# Tag release
git tag v1.2.3
git push origin v1.2.3
Automated Testing Pipeline
bash
#!/bin/bash
set -e
echo "Starting automated pipeline..."
# Validation phase
noorle plugin validate noorle.yaml
# Prepare and build phase
noorle plugin prepare --ci
noorle plugin build
# Test phase
if [ -f "Cargo.toml" ]; then
cargo test
fi
# Deploy phase
if [ "$ENVIRONMENT" = "production" ]; then
noorle plugin deploy
else
echo "Skipping deployment (not production)"
fi
echo "Pipeline completed successfully!"