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