feat: initial release of Strata framework v0.1.0
- Static compiler with STRC pattern (Static Template Resolution with
Compartmentalized Layers)
- Template syntax: { } interpolation, { s-for }, { s-if/s-elif/s-else
}
- File types: .strata, .compiler.sts, .service.sts, .api.sts, .sts,
.scss
- CLI tools: strata-compile dev, strata-compile build, strata-compile
g (generators)
- create-strata-compile scaffolding CLI with Pokemon API example
- Dev server with WebSocket HMR (Hot Module Replacement)
- Documentation: README, ARCHITECTURE, CHANGELOG, CONTRIBUTING,
LICENSE
This commit is contained in:
@@ -585,7 +585,7 @@ VIOLATION = BUILD ERROR
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────────┐
|
||||
│ strata dev │
|
||||
│ strata-compile dev │
|
||||
├─────────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ ┌───────────────┐ │
|
||||
|
||||
18
CHANGELOG.md
18
CHANGELOG.md
@@ -58,16 +58,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- `.scss` - Component/page styles
|
||||
|
||||
#### CLI Tools
|
||||
- `strata dev` - Development server with Hot Module Replacement (HMR)
|
||||
- `strata build` - Production build
|
||||
- `strata preview` - Preview production build
|
||||
- `strata-compile dev` - Development server with Hot Module Replacement (HMR)
|
||||
- `strata-compile build` - Production build
|
||||
- `strata-compile preview` - Preview production build
|
||||
- Generator commands:
|
||||
- `strata g component <Name>`
|
||||
- `strata g page <name>`
|
||||
- `strata g service <name>`
|
||||
- `strata g api <name>`
|
||||
- `strata g util <name>`
|
||||
- `strata g store <name>`
|
||||
- `strata-compile gcomponent <Name>`
|
||||
- `strata-compile gpage <name>`
|
||||
- `strata-compile gservice <name>`
|
||||
- `strata-compile gapi <name>`
|
||||
- `strata-compile gutil <name>`
|
||||
- `strata-compile gstore <name>`
|
||||
|
||||
#### Project Scaffolding
|
||||
- `create-strata` CLI tool
|
||||
|
||||
@@ -90,7 +90,7 @@ A one-line description of the bug.
|
||||
- **Strata version**: 0.1.0
|
||||
|
||||
### Steps to Reproduce
|
||||
1. Create a new project with `npx create-strata my-app`
|
||||
1. Create a new project with `npx create-strata-compile my-app`
|
||||
2. Add a for loop in `index.strata`
|
||||
3. Run `npm run dev`
|
||||
4. Observe the error
|
||||
|
||||
48
Makefile
48
Makefile
@@ -11,15 +11,15 @@
|
||||
build:
|
||||
@echo "Building Strata compiler..."
|
||||
@mkdir -p bin
|
||||
@cd compiler && go mod tidy && go build -ldflags="-s -w" -o ../bin/strata ./cmd/strata
|
||||
@echo "Done! Binary at ./bin/strata"
|
||||
@cd compiler && go mod tidy && go build -ldflags="-s -w" -o ../bin/strata-compile ./cmd/strata
|
||||
@echo "Done! Binary at ./bin/strata-compile"
|
||||
|
||||
# Build with race detector (for development)
|
||||
build-debug:
|
||||
@echo "Building Strata compiler (debug)..."
|
||||
@mkdir -p bin
|
||||
@cd compiler && go build -race -o ../bin/strata-debug ./cmd/strata
|
||||
@echo "Done! Binary at ./bin/strata-debug"
|
||||
@cd compiler && go build -race -o ../bin/strata-compile-debug ./cmd/strata
|
||||
@echo "Done! Binary at ./bin/strata-compile-debug"
|
||||
|
||||
# ============================================================================
|
||||
# INSTALLATION
|
||||
@@ -46,27 +46,27 @@ setup: build
|
||||
@npm install --silent
|
||||
@echo ""
|
||||
@echo "Strata setup complete!"
|
||||
@echo " Binary: ./bin/strata"
|
||||
@echo " Binary: ./bin/strata-compile"
|
||||
@echo ""
|
||||
@echo "Run 'make install' for full installation with shell config."
|
||||
|
||||
# Link binary to /usr/local/bin (quick global access)
|
||||
link: build
|
||||
@echo "Linking strata to /usr/local/bin..."
|
||||
@echo "Linking strata-compile to /usr/local/bin..."
|
||||
@if [ -w /usr/local/bin ]; then \
|
||||
ln -sf "$(PWD)/bin/strata" /usr/local/bin/strata; \
|
||||
ln -sf "$(PWD)/bin/strata-compile" /usr/local/bin/strata-compile; \
|
||||
else \
|
||||
sudo ln -sf "$(PWD)/bin/strata" /usr/local/bin/strata; \
|
||||
sudo ln -sf "$(PWD)/bin/strata-compile" /usr/local/bin/strata-compile; \
|
||||
fi
|
||||
@echo "Done! 'strata' command is now available globally."
|
||||
@echo "Done! 'strata-compile' command is now available globally."
|
||||
|
||||
# Unlink from /usr/local/bin
|
||||
unlink:
|
||||
@echo "Unlinking strata from /usr/local/bin..."
|
||||
@echo "Unlinking strata-compile from /usr/local/bin..."
|
||||
@if [ -w /usr/local/bin ]; then \
|
||||
rm -f /usr/local/bin/strata; \
|
||||
rm -f /usr/local/bin/strata-compile; \
|
||||
else \
|
||||
sudo rm -f /usr/local/bin/strata; \
|
||||
sudo rm -f /usr/local/bin/strata-compile; \
|
||||
fi
|
||||
@echo "Done!"
|
||||
|
||||
@@ -110,19 +110,19 @@ doctor-fix:
|
||||
|
||||
# Run dev server on example app
|
||||
dev: build
|
||||
@cd examples/basic-app && ../../bin/strata dev
|
||||
@cd examples/basic-app && ../../bin/strata-compile dev
|
||||
|
||||
# Run dev server with browser open
|
||||
dev-open: build
|
||||
@cd examples/basic-app && ../../bin/strata dev --open
|
||||
@cd examples/basic-app && ../../bin/strata-compile dev --open
|
||||
|
||||
# Build example app for production
|
||||
example-build: build
|
||||
@cd examples/basic-app && ../../bin/strata build
|
||||
@cd examples/basic-app && ../../bin/strata-compile build
|
||||
|
||||
# Preview example app production build
|
||||
example-preview: build
|
||||
@cd examples/basic-app && ../../bin/strata preview
|
||||
@cd examples/basic-app && ../../bin/strata-compile preview
|
||||
|
||||
# Watch and rebuild compiler on changes
|
||||
watch:
|
||||
@@ -171,7 +171,7 @@ gen-component: build
|
||||
echo "Usage: make gen-component NAME=MyComponent"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@cd examples/basic-app && ../../bin/strata generate component $(NAME)
|
||||
@cd examples/basic-app && ../../bin/strata-compile generate component $(NAME)
|
||||
|
||||
# Generate page (usage: make gen-page NAME=about)
|
||||
gen-page: build
|
||||
@@ -179,7 +179,7 @@ gen-page: build
|
||||
echo "Usage: make gen-page NAME=about"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@cd examples/basic-app && ../../bin/strata generate page $(NAME)
|
||||
@cd examples/basic-app && ../../bin/strata-compile generate page $(NAME)
|
||||
|
||||
# Generate store (usage: make gen-store NAME=cart)
|
||||
gen-store: build
|
||||
@@ -187,7 +187,7 @@ gen-store: build
|
||||
echo "Usage: make gen-store NAME=cart"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@cd examples/basic-app && ../../bin/strata generate store $(NAME)
|
||||
@cd examples/basic-app && ../../bin/strata-compile generate store $(NAME)
|
||||
|
||||
# Shorthand aliases
|
||||
c: gen-component
|
||||
@@ -223,11 +223,11 @@ clean-all: clean
|
||||
release:
|
||||
@echo "Building release binaries..."
|
||||
@mkdir -p dist/release
|
||||
@cd compiler && GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o ../dist/release/strata-darwin-amd64 ./cmd/strata
|
||||
@cd compiler && GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o ../dist/release/strata-darwin-arm64 ./cmd/strata
|
||||
@cd compiler && GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o ../dist/release/strata-linux-amd64 ./cmd/strata
|
||||
@cd compiler && GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o ../dist/release/strata-linux-arm64 ./cmd/strata
|
||||
@cd compiler && GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o ../dist/release/strata-windows-amd64.exe ./cmd/strata
|
||||
@cd compiler && GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o ../dist/release/strata-compile-darwin-amd64 ./cmd/strata
|
||||
@cd compiler && GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o ../dist/release/strata-compile-darwin-arm64 ./cmd/strata
|
||||
@cd compiler && GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o ../dist/release/strata-compile-linux-amd64 ./cmd/strata
|
||||
@cd compiler && GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o ../dist/release/strata-compile-linux-arm64 ./cmd/strata
|
||||
@cd compiler && GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o ../dist/release/strata-compile-windows-amd64.exe ./cmd/strata
|
||||
@echo "Release binaries built in dist/release/"
|
||||
|
||||
# ============================================================================
|
||||
|
||||
30
README.md
30
README.md
@@ -126,7 +126,7 @@ This installs:
|
||||
|
||||
```bash
|
||||
# Create a new Strata project
|
||||
npx create-strata my-app
|
||||
npx create-strata-compile my-app
|
||||
|
||||
# Navigate to project
|
||||
cd my-app
|
||||
@@ -156,13 +156,13 @@ Output is in the `dist/` folder - pure static HTML ready for any hosting.
|
||||
|
||||
```bash
|
||||
# Development server with HMR
|
||||
strata dev [--port 3000] [--open]
|
||||
strata-compile dev [--port 3000] [--open]
|
||||
|
||||
# Production build
|
||||
strata build [--output dist]
|
||||
strata-compile build [--output dist]
|
||||
|
||||
# Preview production build
|
||||
strata preview [--port 4000]
|
||||
strata-compile preview [--port 4000]
|
||||
```
|
||||
|
||||
### Generator Commands
|
||||
@@ -171,7 +171,7 @@ Generate new files with the correct structure:
|
||||
|
||||
```bash
|
||||
# Generate a component
|
||||
strata g component Button
|
||||
strata-compile gcomponent Button
|
||||
# Creates: src/components/Button/
|
||||
# ├── Button.strata
|
||||
# ├── Button.compiler.sts
|
||||
@@ -179,7 +179,7 @@ strata g component Button
|
||||
# └── Button.scss
|
||||
|
||||
# Generate a page
|
||||
strata g page about
|
||||
strata-compile gpage about
|
||||
# Creates: src/pages/about/
|
||||
# ├── about.strata
|
||||
# ├── about.compiler.sts
|
||||
@@ -187,30 +187,30 @@ strata g page about
|
||||
# └── about.scss
|
||||
|
||||
# Generate a service
|
||||
strata g service auth
|
||||
strata-compile gservice auth
|
||||
# Creates: src/services/auth.service.sts
|
||||
|
||||
# Generate an API contract
|
||||
strata g api users
|
||||
strata-compile gapi users
|
||||
# Creates: src/api/users.api.sts
|
||||
|
||||
# Generate a utility
|
||||
strata g util format
|
||||
strata-compile gutil format
|
||||
# Creates: src/utils/format.sts
|
||||
|
||||
# Generate a store
|
||||
strata g store cart
|
||||
strata-compile gstore cart
|
||||
# Creates: src/stores/cart.store.sts
|
||||
```
|
||||
|
||||
### Shorthand Commands
|
||||
|
||||
```bash
|
||||
strata g c Button # component
|
||||
strata g p about # page
|
||||
strata g s auth # service
|
||||
strata g a users # api
|
||||
strata g u format # util
|
||||
strata-compile gc Button # component
|
||||
strata-compile gp about # page
|
||||
strata-compile gs auth # service
|
||||
strata-compile ga users # api
|
||||
strata-compile gu format # util
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -11,26 +11,26 @@ const template = templateArg ? templateArg.split('=')[1] : 'pokemon';
|
||||
|
||||
if (!projectName || projectName === '--help' || projectName === '-h') {
|
||||
console.log(`
|
||||
create-strata - Create a new Strata project
|
||||
create-strata-compile - Create a new Strata project
|
||||
|
||||
Usage:
|
||||
npx create-strata <project-name> [options]
|
||||
npx create-strata-compile <project-name> [options]
|
||||
|
||||
Options:
|
||||
--template=<name> Use a specific template (default: pokemon)
|
||||
Available: pokemon, minimal
|
||||
|
||||
Examples:
|
||||
npx create-strata my-app
|
||||
npx create-strata my-app --template=minimal
|
||||
npx create-strata-compile my-app
|
||||
npx create-strata-compile my-app --template=minimal
|
||||
|
||||
CLI Generator Commands (after project creation):
|
||||
strata g component <Name> Create component with all files
|
||||
strata g page <name> Create page with all files
|
||||
strata g service <name> Create service file
|
||||
strata g api <name> Create API contract file
|
||||
strata g util <name> Create utility file
|
||||
strata g store <name> Create store definition
|
||||
strata-compile g component <Name> Create component with all files
|
||||
strata-compile g page <name> Create page with all files
|
||||
strata-compile g service <name> Create service file
|
||||
strata-compile g api <name> Create API contract file
|
||||
strata-compile g util <name> Create utility file
|
||||
strata-compile g store <name> Create store definition
|
||||
|
||||
File Structure:
|
||||
.strata → Template (HTML structure only)
|
||||
@@ -93,9 +93,9 @@ const packageJson = {
|
||||
version: '0.1.0',
|
||||
private: true,
|
||||
scripts: {
|
||||
dev: '~/.strata/bin/strata dev',
|
||||
build: '~/.strata/bin/strata build',
|
||||
preview: '~/.strata/bin/strata preview',
|
||||
dev: '~/.strata/bin/strata-compile dev',
|
||||
build: '~/.strata/bin/strata-compile build',
|
||||
preview: '~/.strata/bin/strata-compile preview',
|
||||
},
|
||||
devDependencies: {
|
||||
typescript: '^5.3.0',
|
||||
@@ -1041,12 +1041,12 @@ src/
|
||||
### Generate Components
|
||||
|
||||
\`\`\`bash
|
||||
strata g component UserCard # Create component
|
||||
strata g page users # Create page
|
||||
strata g service user # Create service
|
||||
strata g api user # Create API contract
|
||||
strata g util format # Create utility
|
||||
strata g store user # Create store
|
||||
strata-compile g component UserCard # Create component
|
||||
strata-compile g page users # Create page
|
||||
strata-compile g service user # Create service
|
||||
strata-compile g api user # Create API contract
|
||||
strata-compile g util format # Create utility
|
||||
strata-compile g store user # Create store
|
||||
\`\`\`
|
||||
|
||||
## Template Syntax
|
||||
@@ -1114,11 +1114,11 @@ console.log(`
|
||||
npm run dev
|
||||
|
||||
CLI generator commands:
|
||||
strata g component <Name> - Create component
|
||||
strata g page <name> - Create page
|
||||
strata g service <name> - Create service
|
||||
strata g api <name> - Create API contract
|
||||
strata g util <name> - Create utility
|
||||
strata-compile g component <Name> - Create component
|
||||
strata-compile g page <name> - Create page
|
||||
strata-compile g service <name> - Create service
|
||||
strata-compile g api <name> - Create API contract
|
||||
strata-compile g util <name> - Create utility
|
||||
|
||||
Happy coding with Strata!
|
||||
`);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "create-strata",
|
||||
"name": "create-strata-compile",
|
||||
"version": "0.1.0",
|
||||
"description": "Create a new Strata project",
|
||||
"bin": {
|
||||
"create-strata": "./index.js"
|
||||
"create-strata-compile": "./index.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
@@ -14,10 +14,11 @@
|
||||
},
|
||||
"keywords": [
|
||||
"strata",
|
||||
"strata-compile",
|
||||
"create",
|
||||
"scaffold",
|
||||
"cli"
|
||||
],
|
||||
"author": "Strata Team",
|
||||
"author": "Carlos Gutierrez (CarGDev)",
|
||||
"license": "MIT"
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/CarGDev/strata/internal/generator"
|
||||
"github.com/CarGDev/strata-compile/internal/generator"
|
||||
)
|
||||
|
||||
func runBuild(analyze bool, watch bool) {
|
||||
@@ -89,7 +89,7 @@ func startPreviewServer(port int) {
|
||||
distDir := filepath.Join(cwd, "dist")
|
||||
|
||||
if _, err := os.Stat(distDir); os.IsNotExist(err) {
|
||||
log.Fatal("No build found. Run 'strata build' first.")
|
||||
log.Fatal("No build found. Run 'strata-compile build' first.")
|
||||
}
|
||||
|
||||
fmt.Printf("\n Preview server running at http://localhost:%d\n", port)
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
"github.com/CarGDev/strata/internal/server"
|
||||
"github.com/CarGDev/strata/internal/watcher"
|
||||
"github.com/CarGDev/strata-compile/internal/server"
|
||||
"github.com/CarGDev/strata-compile/internal/watcher"
|
||||
)
|
||||
|
||||
func startDevServer(port int, open bool) {
|
||||
|
||||
@@ -11,7 +11,7 @@ var version = "0.1.0"
|
||||
|
||||
func main() {
|
||||
rootCmd := &cobra.Command{
|
||||
Use: "strata",
|
||||
Use: "strata-compile",
|
||||
Short: "Strata - Static Template Rendering Architecture",
|
||||
Version: version,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module github.com/CarGDev/strata
|
||||
module github.com/CarGDev/strata-compile
|
||||
|
||||
go 1.22
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/CarGDev/strata/internal/ast"
|
||||
"github.com/CarGDev/strata/internal/parser"
|
||||
"github.com/CarGDev/strata-compile/internal/ast"
|
||||
"github.com/CarGDev/strata-compile/internal/parser"
|
||||
)
|
||||
|
||||
// StaticCompiler compiles .strata files to pure HTML at build time
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/CarGDev/strata/internal/ast"
|
||||
"github.com/CarGDev/strata-compile/internal/ast"
|
||||
)
|
||||
|
||||
// StrataParser parses .strata files
|
||||
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/CarGDev/strata/internal/ast"
|
||||
"github.com/CarGDev/strata/internal/compiler"
|
||||
"github.com/CarGDev/strata/internal/parser"
|
||||
"github.com/CarGDev/strata-compile/internal/ast"
|
||||
"github.com/CarGDev/strata-compile/internal/compiler"
|
||||
"github.com/CarGDev/strata-compile/internal/parser"
|
||||
"github.com/gorilla/websocket"
|
||||
)
|
||||
|
||||
|
||||
@@ -3,13 +3,11 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "strata dev",
|
||||
"build": "strata build",
|
||||
"preview": "strata preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"strata": "^0.1.0"
|
||||
"dev": "strata-compile dev",
|
||||
"build": "strata-compile build",
|
||||
"preview": "strata-compile preview"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.3.0"
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@ export STRATA_REPO="$REPO_DIR"
|
||||
export PATH="$REPO_DIR/bin:$PATH"
|
||||
|
||||
# Set aliases
|
||||
alias st='strata'
|
||||
alias stdev='strata dev'
|
||||
alias stbuild='strata build'
|
||||
alias stgen='strata generate'
|
||||
alias stnew='npx create-strata'
|
||||
alias st='strata-compile'
|
||||
alias stdev='strata-compile dev'
|
||||
alias stbuild='strata-compile build'
|
||||
alias stgen='strata-compile generate'
|
||||
alias stnew='npx create-strata-compile'
|
||||
|
||||
# Development aliases
|
||||
alias stmake='make -C "$STRATA_REPO"'
|
||||
@@ -47,7 +47,7 @@ strebuild() {
|
||||
|
||||
# Function to run example app
|
||||
stexample() {
|
||||
cd "$STRATA_REPO/examples/basic-app" && strata dev
|
||||
cd "$STRATA_REPO/examples/basic-app" && strata-compile dev
|
||||
}
|
||||
|
||||
echo ""
|
||||
|
||||
@@ -220,11 +220,11 @@ export STRATA_HOME="$HOME/.strata"
|
||||
export PATH="$STRATA_HOME/bin:$PATH"
|
||||
|
||||
# Strata aliases
|
||||
alias st='strata'
|
||||
alias stdev='strata dev'
|
||||
alias stbuild='strata build'
|
||||
alias stgen='strata generate'
|
||||
alias stnew='npx create-strata'
|
||||
alias st='strata-compile'
|
||||
alias stdev='strata-compile dev'
|
||||
alias stbuild='strata-compile build'
|
||||
alias stgen='strata-compile generate'
|
||||
alias stnew='npx create-strata-compile'
|
||||
SHELL_CONFIG
|
||||
echo -e "${GREEN}✓${NC} Added to $shell_config"
|
||||
fi
|
||||
@@ -249,9 +249,9 @@ CONFIG
|
||||
echo -e " ${CYAN}source $shell_config${NC}"
|
||||
echo ""
|
||||
echo " Then create your first project:"
|
||||
echo -e " ${CYAN}npx create-strata my-app${NC}"
|
||||
echo -e " ${CYAN}npx create-strata-compile my-app${NC}"
|
||||
echo -e " ${CYAN}cd my-app${NC}"
|
||||
echo -e " ${CYAN}strata dev${NC}"
|
||||
echo -e " ${CYAN}strata-compile dev${NC}"
|
||||
echo ""
|
||||
echo " Documentation: https://stratajs.dev/docs"
|
||||
echo ""
|
||||
|
||||
@@ -224,16 +224,16 @@ build_compiler() {
|
||||
|
||||
# Build the compiler
|
||||
echo " Compiling..."
|
||||
go build -ldflags="-s -w" -o "$REPO_DIR/bin/strata" ./cmd/strata
|
||||
go build -ldflags="-s -w" -o "$REPO_DIR/bin/strata-compile" ./cmd/strata
|
||||
|
||||
# Copy to strata home
|
||||
cp "$REPO_DIR/bin/strata" "$STRATA_BIN/strata"
|
||||
chmod +x "$STRATA_BIN/strata"
|
||||
cp "$REPO_DIR/bin/strata-compile" "$STRATA_BIN/strata-compile"
|
||||
chmod +x "$STRATA_BIN/strata-compile"
|
||||
|
||||
# Copy create-strata CLI
|
||||
if [ -f "$REPO_DIR/bin/create-strata" ]; then
|
||||
cp "$REPO_DIR/bin/create-strata" "$STRATA_BIN/create-strata"
|
||||
chmod +x "$STRATA_BIN/create-strata"
|
||||
# Copy create-strata-compile CLI
|
||||
if [ -f "$REPO_DIR/bin/create-strata-compile" ]; then
|
||||
cp "$REPO_DIR/bin/create-strata-compile" "$STRATA_BIN/create-strata-compile"
|
||||
chmod +x "$STRATA_BIN/create-strata-compile"
|
||||
fi
|
||||
|
||||
cd "$REPO_DIR"
|
||||
@@ -257,12 +257,12 @@ install_global() {
|
||||
print_step "Installing globally to $LOCAL_BIN..."
|
||||
|
||||
if [ -w "$LOCAL_BIN" ]; then
|
||||
ln -sf "$STRATA_BIN/strata" "$LOCAL_BIN/strata"
|
||||
print_success "Linked strata to $LOCAL_BIN/strata"
|
||||
ln -sf "$STRATA_BIN/strata-compile" "$LOCAL_BIN/strata-compile"
|
||||
print_success "Linked strata-compile to $LOCAL_BIN/strata-compile"
|
||||
else
|
||||
echo " Requires sudo to write to $LOCAL_BIN"
|
||||
sudo ln -sf "$STRATA_BIN/strata" "$LOCAL_BIN/strata"
|
||||
print_success "Linked strata to $LOCAL_BIN/strata (with sudo)"
|
||||
sudo ln -sf "$STRATA_BIN/strata-compile" "$LOCAL_BIN/strata-compile"
|
||||
print_success "Linked strata-compile to $LOCAL_BIN/strata-compile (with sudo)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -326,11 +326,11 @@ export STRATA_HOME="$HOME/.strata"
|
||||
export PATH="$STRATA_HOME/bin:$PATH"
|
||||
|
||||
# Strata aliases
|
||||
alias st='strata'
|
||||
alias stdev='strata dev'
|
||||
alias stbuild='strata build'
|
||||
alias stgen='strata generate'
|
||||
alias stnew='create-strata'
|
||||
alias st='strata-compile'
|
||||
alias stdev='strata-compile dev'
|
||||
alias stbuild='strata-compile build'
|
||||
alias stgen='strata-compile generate'
|
||||
alias stnew='create-strata-compile'
|
||||
|
||||
# Strata completions
|
||||
SHELL_CONFIG
|
||||
@@ -389,7 +389,7 @@ _strata_completions() {
|
||||
local generate_types="component page store layout middleware"
|
||||
|
||||
case "$prev" in
|
||||
strata|st)
|
||||
strata-compile|st)
|
||||
COMPREPLY=( $(compgen -W "$commands" -- "$cur") )
|
||||
return 0
|
||||
;;
|
||||
@@ -423,13 +423,13 @@ _strata_completions() {
|
||||
fi
|
||||
}
|
||||
|
||||
complete -F _strata_completions strata
|
||||
complete -F _strata_completions strata-compile
|
||||
complete -F _strata_completions st
|
||||
BASH_COMP
|
||||
|
||||
# Generate zsh completion
|
||||
cat > "$STRATA_COMPLETIONS/_strata" << 'ZSH_COMP'
|
||||
#compdef strata st
|
||||
#compdef strata-compile st
|
||||
|
||||
# Strata zsh completion
|
||||
|
||||
@@ -461,7 +461,7 @@ _strata() {
|
||||
|
||||
case "$state" in
|
||||
command)
|
||||
_describe -t commands 'strata commands' commands
|
||||
_describe -t commands 'strata-compile commands' commands
|
||||
;;
|
||||
args)
|
||||
case "$words[2]" in
|
||||
@@ -506,33 +506,33 @@ ZSH_COMP
|
||||
# Strata fish completion
|
||||
|
||||
# Main commands
|
||||
complete -c strata -f -n "__fish_use_subcommand" -a "dev" -d "Start development server"
|
||||
complete -c strata -f -n "__fish_use_subcommand" -a "build" -d "Build for production"
|
||||
complete -c strata -f -n "__fish_use_subcommand" -a "preview" -d "Preview production build"
|
||||
complete -c strata -f -n "__fish_use_subcommand" -a "generate" -d "Generate component/page/store"
|
||||
complete -c strata -f -n "__fish_use_subcommand" -a "init" -d "Initialize new project"
|
||||
complete -c strata -f -n "__fish_use_subcommand" -a "help" -d "Show help"
|
||||
complete -c strata -f -n "__fish_use_subcommand" -a "version" -d "Show version"
|
||||
complete -c strata-compile -f -n "__fish_use_subcommand" -a "dev" -d "Start development server"
|
||||
complete -c strata-compile -f -n "__fish_use_subcommand" -a "build" -d "Build for production"
|
||||
complete -c strata-compile -f -n "__fish_use_subcommand" -a "preview" -d "Preview production build"
|
||||
complete -c strata-compile -f -n "__fish_use_subcommand" -a "generate" -d "Generate component/page/store"
|
||||
complete -c strata-compile -f -n "__fish_use_subcommand" -a "init" -d "Initialize new project"
|
||||
complete -c strata-compile -f -n "__fish_use_subcommand" -a "help" -d "Show help"
|
||||
complete -c strata-compile -f -n "__fish_use_subcommand" -a "version" -d "Show version"
|
||||
|
||||
# Generate subcommands
|
||||
complete -c strata -f -n "__fish_seen_subcommand_from generate" -a "component" -d "Generate component"
|
||||
complete -c strata -f -n "__fish_seen_subcommand_from generate" -a "page" -d "Generate page"
|
||||
complete -c strata -f -n "__fish_seen_subcommand_from generate" -a "store" -d "Generate store"
|
||||
complete -c strata -f -n "__fish_seen_subcommand_from generate" -a "layout" -d "Generate layout"
|
||||
complete -c strata-compile -f -n "__fish_seen_subcommand_from generate" -a "component" -d "Generate component"
|
||||
complete -c strata-compile -f -n "__fish_seen_subcommand_from generate" -a "page" -d "Generate page"
|
||||
complete -c strata-compile -f -n "__fish_seen_subcommand_from generate" -a "store" -d "Generate store"
|
||||
complete -c strata-compile -f -n "__fish_seen_subcommand_from generate" -a "layout" -d "Generate layout"
|
||||
|
||||
# Dev options
|
||||
complete -c strata -f -n "__fish_seen_subcommand_from dev" -l port -d "Port number"
|
||||
complete -c strata -f -n "__fish_seen_subcommand_from dev" -l open -d "Open browser"
|
||||
complete -c strata -f -n "__fish_seen_subcommand_from dev" -l host -d "Host to bind"
|
||||
complete -c strata-compile -f -n "__fish_seen_subcommand_from dev" -l port -d "Port number"
|
||||
complete -c strata-compile -f -n "__fish_seen_subcommand_from dev" -l open -d "Open browser"
|
||||
complete -c strata-compile -f -n "__fish_seen_subcommand_from dev" -l host -d "Host to bind"
|
||||
|
||||
# Build options
|
||||
complete -c strata -f -n "__fish_seen_subcommand_from build" -l analyze -d "Analyze bundle"
|
||||
complete -c strata -f -n "__fish_seen_subcommand_from build" -l watch -d "Watch mode"
|
||||
complete -c strata -f -n "__fish_seen_subcommand_from build" -l minify -d "Minify output"
|
||||
complete -c strata -f -n "__fish_seen_subcommand_from build" -l sourcemap -d "Generate sourcemaps"
|
||||
complete -c strata-compile -f -n "__fish_seen_subcommand_from build" -l analyze -d "Analyze bundle"
|
||||
complete -c strata-compile -f -n "__fish_seen_subcommand_from build" -l watch -d "Watch mode"
|
||||
complete -c strata-compile -f -n "__fish_seen_subcommand_from build" -l minify -d "Minify output"
|
||||
complete -c strata-compile -f -n "__fish_seen_subcommand_from build" -l sourcemap -d "Generate sourcemaps"
|
||||
|
||||
# Alias
|
||||
complete -c st -w strata
|
||||
complete -c st -w strata-compile
|
||||
FISH_COMP
|
||||
|
||||
print_success "Shell completions installed"
|
||||
@@ -575,32 +575,32 @@ print_final() {
|
||||
echo -e " ${CYAN}source $(get_shell_config $(detect_shell))${NC}"
|
||||
echo ""
|
||||
echo " 2. Create a new project:"
|
||||
echo -e " ${CYAN}npx create-strata my-app${NC}"
|
||||
echo -e " ${CYAN}npx create-strata-compile my-app${NC}"
|
||||
echo -e " ${CYAN}cd my-app${NC}"
|
||||
echo -e " ${CYAN}npm install${NC}"
|
||||
echo -e " ${CYAN}strata dev${NC}"
|
||||
echo -e " ${CYAN}strata-compile dev${NC}"
|
||||
echo ""
|
||||
echo " Or try the example app:"
|
||||
echo -e " ${CYAN}cd $REPO_DIR/examples/basic-app${NC}"
|
||||
echo -e " ${CYAN}strata dev${NC}"
|
||||
echo -e " ${CYAN}strata-compile dev${NC}"
|
||||
echo ""
|
||||
echo -e " ${BOLD}Available Commands:${NC}"
|
||||
echo ""
|
||||
echo " strata dev Start dev server with hot reload"
|
||||
echo " strata build Build for production"
|
||||
echo " strata preview Preview production build"
|
||||
echo " strata generate Generate component/page/store"
|
||||
echo " strata-compile dev Start dev server with hot reload"
|
||||
echo " strata-compile build Build for production"
|
||||
echo " strata-compile preview Preview production build"
|
||||
echo " strata-compile generate Generate component/page/store"
|
||||
echo ""
|
||||
echo -e " ${BOLD}Aliases:${NC}"
|
||||
echo ""
|
||||
echo " st → strata"
|
||||
echo " stdev → strata dev"
|
||||
echo " stbuild → strata build"
|
||||
echo " stgen → strata generate"
|
||||
echo " stnew → npx create-strata"
|
||||
echo " st → strata-compile"
|
||||
echo " stdev → strata-compile dev"
|
||||
echo " stbuild → strata-compile build"
|
||||
echo " stgen → strata-compile generate"
|
||||
echo " stnew → npx create-strata-compile"
|
||||
echo ""
|
||||
echo -e " ${BOLD}Documentation:${NC} https://stratajs.dev/docs"
|
||||
echo -e " ${BOLD}GitHub:${NC} https://github.com/strata/strata"
|
||||
echo -e " ${BOLD}GitHub:${NC} https://github.com/CarGDev/strata-compile"
|
||||
echo ""
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ echo " ✓ Setup complete!"
|
||||
echo ""
|
||||
echo " Quick start:"
|
||||
echo " cd examples/basic-app"
|
||||
echo " ../../bin/strata dev"
|
||||
echo " ../../bin/strata-compile dev"
|
||||
echo ""
|
||||
echo " Or use make:"
|
||||
echo " make dev"
|
||||
|
||||
Reference in New Issue
Block a user