Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/docker-build-push-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ on:
push:
branches: [dev]
paths:
- demo/**
- demo-leptos/**
- demo-tauri/**
- docker/**
- crates/**
- tests/fixtures/**
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ jobs:
fi
VERSION="${TAG#v}"
ROOT_VERSION="$(awk '/^\[workspace.package\]/{p=1;next} p&&/^version = /{gsub(/"/,"",$3); print $3; exit}' Cargo.toml)"
DESKTOP_VERSION="$(awk '/^version = /{gsub(/"/,"",$3); print $3; exit}' demo-desktop/src-tauri/Cargo.toml)"
TAURI_VERSION="$(python3 -c "import json; print(json.load(open('demo-desktop/src-tauri/tauri.conf.json'))['version'])")"
DESKTOP_VERSION="$(awk '/^version = /{gsub(/"/,"",$3); print $3; exit}' demo-tauri/src/Cargo.toml)"
TAURI_VERSION="$(python3 -c "import json; print(json.load(open('demo-tauri/src/tauri.conf.json'))['version'])")"
if [ "$VERSION" != "$ROOT_VERSION" ]; then
echo "Tag $VERSION != workspace Cargo.toml $ROOT_VERSION"
exit 1
fi
if [ "$VERSION" != "$DESKTOP_VERSION" ]; then
echo "Tag $VERSION != demo-desktop Cargo.toml $DESKTOP_VERSION"
echo "Tag $VERSION != demo-tauri Cargo.toml $DESKTOP_VERSION"
exit 1
fi
if [ "$VERSION" != "$TAURI_VERSION" ]; then
Expand Down Expand Up @@ -159,8 +159,8 @@ jobs:
uses: Swatinem/rust-cache@v2
with:
workspaces: |
demo-desktop/src-tauri -> target
demo -> target
demo-tauri/src -> target
demo-leptos -> target

- name: Install trunk
run: cargo install --locked trunk --version 0.21.14
Expand All @@ -173,7 +173,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectPath: demo-desktop/src-tauri
projectPath: demo-tauri/src
tauriScript: cargo tauri
releaseId: ${{ github.event.release.id }}
uploadUpdaterJson: false
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/target/
/demo/dist/
/demo/target/
/demo-desktop/src-tauri/target/
/demo-leptos/dist/
/demo-leptos/target/
/demo-tauri/src/target/
**/*.rs.bk
*.pdb
.DS_Store
.idea/
.vscode/

.github_credentials

16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ members = [
"crates/rangular-parser",
"crates/rangular-runtime",
]
exclude = ["demo", "demo-desktop/src-tauri"]
exclude = ["demo-leptos", "demo-tauri/src"]
resolver = "2"

[workspace.package]
edition = "2021"
license = "Apache-2.0"
version = "0.1.0"
version = "1.0.0"
authors = ["Interchouette"]
repository = "https://github.com/Interchouette-ITC/rangular"
rust-version = "1.75"

[workspace.dependencies]
rangular-aot = { path = "crates/rangular-aot", version = "0.1.0" }
rangular-css = { path = "crates/rangular-css", version = "0.1.0" }
rangular-expr = { path = "crates/rangular-expr", version = "0.1.0" }
rangular-host = { path = "crates/rangular-host", version = "0.1.0" }
rangular-macros = { path = "crates/rangular-macros", version = "0.1.0" }
rangular-parser = { path = "crates/rangular-parser", version = "0.1.0" }
rangular-runtime = { path = "crates/rangular-runtime", version = "0.1.0" }
rangular-aot = { path = "crates/rangular-aot", version = "1.0.0" }
rangular-css = { path = "crates/rangular-css", version = "1.0.0" }
rangular-expr = { path = "crates/rangular-expr", version = "1.0.0" }
rangular-host = { path = "crates/rangular-host", version = "1.0.0" }
rangular-macros = { path = "crates/rangular-macros", version = "1.0.0" }
rangular-parser = { path = "crates/rangular-parser", version = "1.0.0" }
rangular-runtime = { path = "crates/rangular-runtime", version = "1.0.0" }
100 changes: 75 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

SHELL := /bin/bash
ROOT := $(abspath .)
DEMO := $(ROOT)/demo
DESKTOP := $(ROOT)/demo-desktop/src-tauri
DEMO_LEPTOS := $(ROOT)/demo-leptos
DEMO_TAURI := $(ROOT)/demo-tauri/src
CARGO ?= cargo
TRUNK := env -u NO_COLOR $(HOME)/.cargo/bin/trunk
CLIPPY_FLAGS := -D warnings -D clippy::all -D clippy::pedantic -D clippy::nursery
DEMO_PORT ?= 4180
DEMO_ADDR ?= 127.0.0.1
DOCKER_PORT ?= 8080
DOCKER_BUILDKIT ?= 1
APP_VERSION := $(shell grep '^version' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
APP_VERSION := $(shell awk '/^\[workspace.package\]/{p=1;next} p&&/^version = /{gsub(/"/,"",$$3); print $$3; exit}' Cargo.toml)
HUB_IMAGE := interchouette/rangular-demo
GHCR_PERSONAL_IMAGE := ghcr.io/groussac/rangular-demo
GHCR_WORKER_IMAGE := ghcr.io/interchouette/rangular-demo
Expand All @@ -22,11 +22,12 @@ TAG ?= dev
.DEFAULT_GOAL := help

.PHONY: help check test lint format format-check clean ci no-panic \
demo demo-build demo-check \
demo-desktop demo-desktop-build \
demo demo-leptos demo-build demo-leptos-build demo-check demo-leptos-check \
demo-desktop demo-tauri demo-desktop-build demo-tauri-build \
docker-build docker-build-dev docker-run \
docker-push-dev-hub docker-push-dev-ghcr-personal docker-push-dev-ghcr-itc \
docker-push-release-hub docker-push-release-ghcr-personal docker-push-release-ghcr-itc
docker-push-release-hub docker-push-release-ghcr-personal docker-push-release-ghcr-itc \
version-show version-bump-patch version-bump-minor version-bump-major version-set

help:
@echo "rangular targets"
Expand All @@ -39,18 +40,25 @@ help:
@echo " make format cargo fmt"
@echo " make clean cargo clean"
@echo ""
@echo "Demo (Leptos CSR / wasm):"
@echo " make demo Trunk serve → http://$(DEMO_ADDR):$(DEMO_PORT)/"
@echo " make demo-build Trunk release dist in demo/"
@echo " make demo-check fmt + clippy on demo wasm target"
@echo " make demo-desktop Tauri window (reuses :$(DEMO_PORT) if already up)"
@echo " make demo-desktop-build Tauri release bundles"
@echo "Demo Leptos (CSR / wasm):"
@echo " make demo / demo-leptos Trunk serve → http://$(DEMO_ADDR):$(DEMO_PORT)/"
@echo " make demo-build / demo-leptos-build"
@echo " make demo-check / demo-leptos-check"
@echo ""
@echo "Demo Tauri:"
@echo " make demo-tauri / demo-desktop Tauri window (reuses :$(DEMO_PORT) if up)"
@echo " make demo-tauri-build / demo-desktop-build"
@echo ""
@echo "Docker (browser SPA for Render):"
@echo " make docker-build Build $(HUB_IMAGE):$(APP_VERSION) + :latest"
@echo " make docker-build-dev Tag :dev + :latest (Hub + GHCR names)"
@echo " make docker-run Run image on :$(DOCKER_PORT)"
@echo ""
@echo "Version:"
@echo " make version-show"
@echo " make version-bump-patch|minor|major"
@echo " make version-set VERSION=x.y.z"
@echo ""
@echo "Overrides: DEMO_PORT=$(DEMO_PORT) DEMO_ADDR=$(DEMO_ADDR) DOCKER_PORT=$(DOCKER_PORT)"

check:
Expand Down Expand Up @@ -78,33 +86,33 @@ ci: lint test no-panic
clean:
cd $(ROOT) && $(CARGO) clean

demo:
demo demo-leptos:
@if ss -tlnp 2>/dev/null | grep -q ':$(DEMO_PORT) '; then \
echo "Port $(DEMO_PORT) already in use - reuse that server or set DEMO_PORT"; \
exit 1; \
fi
cd $(DEMO) && $(TRUNK) serve --release --port $(DEMO_PORT) --address $(DEMO_ADDR)
cd $(DEMO_LEPTOS) && $(TRUNK) serve --release --port $(DEMO_PORT) --address $(DEMO_ADDR)

demo-build:
cd $(DEMO) && $(TRUNK) build --release
demo-build demo-leptos-build:
cd $(DEMO_LEPTOS) && $(TRUNK) build --release

demo-check: format-check
cd $(DEMO) && $(CARGO) clippy --target wasm32-unknown-unknown --all-targets -- $(CLIPPY_FLAGS)
demo-check demo-leptos-check: format-check
cd $(DEMO_LEPTOS) && $(CARGO) clippy --target wasm32-unknown-unknown --all-targets -- $(CLIPPY_FLAGS)

demo-desktop:
@if pgrep -f 'rangular-demo-desktop' >/dev/null 2>&1; then \
echo "rangular-demo-desktop already running - reuse that window"; \
demo-desktop demo-tauri:
@if pgrep -f 'rangular-demo-tauri' >/dev/null 2>&1; then \
echo "rangular-demo-tauri already running - reuse that window"; \
exit 0; \
fi
@if ss -tlnp 2>/dev/null | grep -q ':$(DEMO_PORT) '; then \
echo "Port $(DEMO_PORT) in use - Tauri will attach without starting Trunk"; \
cd $(DESKTOP) && $(CARGO) tauri dev --config '{"build":{"beforeDevCommand":""}}'; \
cd $(DEMO_TAURI) && $(CARGO) tauri dev --config '{"build":{"beforeDevCommand":""}}'; \
else \
cd $(DESKTOP) && $(CARGO) tauri dev; \
cd $(DEMO_TAURI) && $(CARGO) tauri dev; \
fi

demo-desktop-build:
cd $(DESKTOP) && $(CARGO) tauri build
demo-desktop-build demo-tauri-build:
cd $(DEMO_TAURI) && $(CARGO) tauri build

docker-build:
DOCKER_BUILDKIT=$(DOCKER_BUILDKIT) docker build --pull --network=host \
Expand Down Expand Up @@ -162,3 +170,45 @@ docker-push-release-ghcr-itc:
docker push $(GHCR_WORKER_IMAGE):latest
docker push $(GHCR_ORG_IMAGE):$(APP_VERSION)
docker push $(GHCR_ORG_IMAGE):latest

# Version helpers (workspace + demos + tauri.conf); release via GitHub Release tag v$$(APP_VERSION)
version-show:
@echo "Current version: $(APP_VERSION)"; \
echo "demo-leptos: $$(awk '/^version = /{gsub(/"/,"",$$3); print $$3; exit}' demo-leptos/Cargo.toml)"; \
echo "demo-tauri: $$(awk '/^version = /{gsub(/"/,"",$$3); print $$3; exit}' demo-tauri/src/Cargo.toml)"; \
echo "tauri.conf.json: $$(python3 -c "import json; print(json.load(open('demo-tauri/src/tauri.conf.json'))['version'])")"; \
echo ""; \
echo "Suggested GitHub Release tag:"; \
echo " v$(APP_VERSION)"; \
echo ""; \
echo "When creating a GitHub Release, use the Tag field (not only the title)."

define version-apply
@current="$(APP_VERSION)"; \
new="$(1)"; \
if [ -z "$$new" ]; then echo "empty version"; exit 1; fi; \
sed -i "s/version = \"$$current\"/version = \"$$new\"/g" Cargo.toml; \
sed -i "s/^version = \"$$current\"/version = \"$$new\"/" demo-leptos/Cargo.toml; \
sed -i "s/^version = \"$$current\"/version = \"$$new\"/" demo-tauri/src/Cargo.toml; \
python3 -c "import json; p='demo-tauri/src/tauri.conf.json'; c=json.load(open(p)); c['version']='$$new'; json.dump(c, open(p,'w'), indent=2); open(p,'a').write('\n')"; \
$(CARGO) metadata --format-version 1 --no-deps >/dev/null; \
$(CARGO) metadata --manifest-path demo-leptos/Cargo.toml --format-version 1 --no-deps >/dev/null; \
$(CARGO) metadata --manifest-path demo-tauri/src/Cargo.toml --format-version 1 --no-deps >/dev/null; \
echo "Version $$current → $$new (workspace + demos + tauri.conf)"
endef

version-bump-patch:
$(call version-apply,$(shell echo "$(APP_VERSION)" | awk -F. '{print $$1"."$$2"."($$3+1)}'))

version-bump-minor:
$(call version-apply,$(shell echo "$(APP_VERSION)" | awk -F. '{print $$1"."($$2+1)".0"}'))

version-bump-major:
$(call version-apply,$(shell echo "$(APP_VERSION)" | awk -F. '{print ($$1+1)".0.0"}'))

version-set:
@if [ -z "$(VERSION)" ]; then \
echo "Usage: make version-set VERSION=x.y.z"; \
exit 1; \
fi
$(call version-apply,$(VERSION))
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ flowchart LR
| SCSS | `rangular-css` (`compile_scss` or encapsulate; Bootstrap utilities stay global) |
| Registry | Component tags + typed `provide` / `inject` |
| Growth | Fixture corpus in [`tests/fixtures/`](tests/fixtures/) (tests; not the demo) |
| Demo | [`demo/`](demo/) dogfoods AOT with its own panels |
| Demo | [`demo-leptos/`](demo-leptos/) dogfoods AOT with its own panels |

Layers: `tests/fixtures/` is the language growth corpus for crate tests; `demo/` is an independent dogfood app with its own panels; other rangular apps live out of this tree.
Layers: `tests/fixtures/` is the language growth corpus for crate tests; `demo-leptos/` is an independent dogfood app with its own panels; other rangular apps live out of this tree.

Honest subset, not full Angular. New syntax lands through fixtures and semver.
Unsupported input yields `RANG*` diagnostics; templates must never panic the process.
Expand All @@ -87,13 +87,13 @@ Same habit as Angular, with **`.rs` instead of `.ts`**:
| `item_list.rs` | class / component.ts | Rust `Host` + Leptos `#[component]` |

```text
demo/src/components/item_list/
demo-leptos/src/components/item_list/
item_list.html # familiar Angular-shaped template
item_list.scss # familiar component SCSS
item_list.rs # state + handlers
```

Live Host example: [`demo/src/components/item_list/`](demo/src/components/item_list/).
Live Host example: [`demo-leptos/src/components/item_list/`](demo-leptos/src/components/item_list/).
Growth corpus (tests only): [`tests/fixtures/components/`](tests/fixtures/components/).

**Template** (`item_list.html`):
Expand Down Expand Up @@ -255,11 +255,11 @@ macOS is not in v1.
Local shell (same SPA as the browser demo):

```bash
make demo-desktop
make demo-desktop-build # Linux deb/AppImage, Windows NSIS
make demo-tauri
make demo-tauri-build # Linux deb/AppImage, Windows NSIS
```

Details: [`demo-desktop/README.md`](demo-desktop/README.md).
Details: [`demo-tauri/README.md`](demo-tauri/README.md).

```mermaid
flowchart TB
Expand Down Expand Up @@ -288,7 +288,7 @@ docker run --rm -p 8080:8080 interchouette/rangular-demo:latest

Live: [https://rangular.interchouette.net](https://rangular.interchouette.net)

Details: [`demo/README.md`](demo/README.md).
Details: [`demo-leptos/README.md`](demo-leptos/README.md).

## Working on this repo

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions demo/Cargo.toml → demo-leptos/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rangular-demo"
description = "Browser demo for rangular (Leptos CSR + fixture components)"
version = "0.1.0"
description = "Browser demo for rangular (Leptos CSR + colocated panels)"
version = "1.0.0"
edition = "2021"
license = "Apache-2.0"
publish = false
Expand Down
Loading
Loading