|
|
|
|
@@ -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 ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|