Skip to content

Commit 6b5b3a6

Browse files
authored
1 parent 379730c commit 6b5b3a6

File tree

520 files changed

+12913
-35173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

520 files changed

+12913
-35173
lines changed

.dockerignore

Lines changed: 0 additions & 36 deletions
This file was deleted.

.gitattributes

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
*.gif filter=lfs diff=lfs merge=lfs -text
2-
*.webp filter=lfs diff=lfs merge=lfs -text
3-
*.jpg filter=lfs diff=lfs merge=lfs -text
41
*.png filter=lfs diff=lfs merge=lfs -text
2+
*.zst filter=lfs diff=lfs merge=lfs -text
3+
*.gif filter=lfs diff=lfs merge=lfs -text
54
*.blend* filter=lfs diff=lfs merge=lfs -text
65
*.hdr* filter=lfs diff=lfs merge=lfs -text
76
*.wav* filter=lfs diff=lfs merge=lfs -text
87
*.ttf* filter=lfs diff=lfs merge=lfs -text
98
*.webp filter=lfs diff=lfs merge=lfs -text
10-
*.zst filter=lfs diff=lfs merge=lfs -text
9+
10+
bundles linguist-generated=true

.github/workflows/github-releases-to-discord.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.gitignore

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
*debug_bin*
2-
node_modules
3-
4-
site_bin
1+
tailwindcli
2+
datastar_site
3+
data
54
.task
6-
*_templ.go
7-
*.png~
8-
test-results
5+
.idea
6+
node_modules
7+
datastar-website
8+
*_bin

.vscode/extensions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"recommendations": [
3-
"ms-playwright.playwright",
3+
"jdinabox.quicktemplate-vscode",
44
"golang.go",
55
"a-h.templ"
66
]
7-
}
7+
}

.vscode/launch.json

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,23 @@
99
"type": "go",
1010
"request": "launch",
1111
"mode": "auto",
12-
"program": "${workspaceFolder}/backends/go/cmd/site/main.go"
12+
"program": "${workspaceFolder}/code/go/cmd/site/main.go",
13+
"preLaunchTask": "build datastar"
1314
},
1415
{
15-
"name": "Go test example",
16+
"name": "Smoke Test",
1617
"type": "go",
1718
"request": "launch",
1819
"mode": "auto",
19-
"program": "${workspaceFolder}/backends/example/go/main.go"
20+
"program": "${workspaceFolder}/code/go/cmd/sitesmoketests/main.go"
21+
},
22+
{
23+
"name": "Build Library",
24+
"type": "go",
25+
"request": "launch",
26+
"mode": "auto",
27+
"program": "${workspaceFolder}/code/go/cmd/tsbuild/main.go",
28+
"cwd": "${workspaceFolder}"
2029
}
2130
]
22-
}
31+
}

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"go.testTimeout": "200s",
3+
"go.coverOnSingleTestFile": true,
4+
"go.coverOnSingleTest": true,
5+
"go.testFlags": [
6+
"-test.parallel",
7+
"4"
8+
],
9+
"editor.foldingStrategy": "indentation",
10+
"makefile.configureOnOpen": false
11+
}

.vscode/tasks.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "shell",
6+
"label": "build datastar",
7+
"command": "task",
8+
"args": [
9+
"support"
10+
]
11+
}
12+
]
13+
}

BUILDING.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Building Datastar using Docker
2+
3+
Datastar comes with a development environment for developing Datastar via a Docker container.
4+
5+
It takes care of the setup listed in the for you in a Dockerized environment, which allows you to get it up and running quickly & easily.
6+
7+
The only requirement is that you have [Docker](https://www.docker.com/products/docker-desktop) installed (you do not need `golang`, `git-lfs`, or anything else installed locally).
8+
9+
## Why Docker?
10+
11+
Developers who have adopted [Docker](https://www.docker.com/) for a containerized approach to development are used to not having to install a matching development infrastructure each time they approach a project.
12+
13+
This allows you to "shrink-wrap" the devops needed to run a project in a container, which will run anywhere, on any machine, without having to do any meticulous setup.
14+
15+
It also allows you to easily swap between basic things like Go versions, without affecting your local computer.
16+
17+
## Quick Start
18+
19+
In terminal, `cd` to the `datastar/` directory, and then type:
20+
21+
```
22+
make dev
23+
```
24+
25+
The first time you run this command, it may take a bit of time to build the Docker image, and download all of the appropriate packages, and cache them locally.
26+
27+
Then just navigate to `http://localhost:8080` in your browser, and Datastar site from `backends/go/site/` will be up and running.
28+
29+
You can freely make changes the `packages/library/` Datastar codebase, and the changes will be rebuilt and reload automatically.
30+
31+
You can also make changes to the `backends/go/site/` Datastar website backend, and the backend will be rebuilt and reload automatically.
32+
33+
## Using Datastar Docker Dev
34+
35+
Datastar Docker Dev uses the venerable `make` command to automate setup and access to the Docker containers used.
36+
37+
It uses `make` because it's available pre-installed on any development machine.
38+
39+
See the [Using Make & Makefiles to Automate your Frontend Workflow](https://nystudio107.com/blog/using-make-makefiles-to-automate-your-frontend-workflow) article for more on `make`.
40+
41+
The make tool is available for just about every platform you can imagine, and is installed with the [XCode CLI Tools](https://www.embarcadero.com/starthere/xe5/mobdevsetup/ios/en/installing_the_commandline_tools.html) on the Mac, and [WSL2](https://docs.microsoft.com/en-us/windows/wsl/install-win10) on Windows. Probably you have these installed already if you’re doing development.
42+
43+
Below are details and options available in each of the provided `make` commands:
44+
45+
* `make dev` - starts up the Go website server for the backend with hot reloading as you make changes
46+
* `make task xxx` - runs the specified task from the `Taskfile.yml` inside of the Docker container
47+
* `make ssh` - gives you a shell inside of the Docker container
48+
* `make image-build` - rebuilds the Docker image from scratch (you will probably never need this)
49+
50+
### CLI Arguments
51+
52+
You can pass in optional CLI arguments to override the default settings Datastar dev uses:
53+
54+
* `TAG=` (default: `1.23.1-alpine`) - allows you to specify the official [golang Docker image](https://hub.docker.com/_/golang) tag that should be used. Using this, you can change the version of Go the container runs, e.g.: `make image-build TAG="1.23-alpine"` will use the latest version of Go 1.23 for Alpine Linux.
55+
56+
### Terminating
57+
58+
To terminate the `datastar-dev` Docker container, enter `Control-C` in the terminal.

CHANGELOG.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Release Notes for Datastar
2+
3+
## 0.20.0 - 2024-11-22
4+
5+
> [!WARNING]
6+
> This update contains breaking changes to attributes, actions and SSE events.
7+
8+
### Added
9+
10+
- Added a custom bundle [bundler](https://data-star.dev/bundler).
11+
- Added SDKs for Go, PHP and .NET.
12+
- Added the `data-persist` attribute.
13+
- Added the `data-replace-url` attribute.
14+
- Added the `data-indicator` attribute.
15+
- Added the `datastar-remove-fragments` SSE event.
16+
- Added the `datastar-remove-signals` SSE event.
17+
- Added the `datastar-execute-script` SSE event.
18+
19+
### Changed
20+
21+
- Changed the `$$` prefix to `$` for action plugins.
22+
- The `data-model` attribute now upserts signals into the store.
23+
- The `data-ref` attribute now upserts a signal into the store.
24+
- The `data-show` attribute now shows/hides an element using the `style` attribute only. Modifiers have been removed. For anything custom, use `data-class` instead.
25+
- Renamed the `datastar-fragment` SSE event to `datastar-merge-fragments`.
26+
- Renamed the `datastar-signal` SSE event to `datastar-merge-signals`.
27+
- Renamed the `fragment` dataline literal for SSE events to `fragments`.
28+
- Renamed the `store` dataline literal for SSE events to `signals`.
29+
- Renamed the `upsert_attributes` merge mode to `upsertAttributes` in the fragment event.
30+
- Renamed the `settle` option to `settleDuration` in the fragment event and changed the default value to `300`.
31+
- Renamed the `vt` option to `useViewTransition` in the fragment event and changed the default value to `false`.
32+
- Changed the second argument of SSE actions from `onlyRemoteSignals` to an optional object with `headers` and `onlyRemoteSignals` keys, defaulting to `{}` and `true` respectively.
33+
- Error codes that roughly match HTTP status codes are now used.
34+
35+
### Removed
36+
37+
- Removed the `~ref` syntax. Use the signal created by `data-ref` directly instead.
38+
- Removed the `local` and `session` modifiers from `data-store`. Use the new `data-persist` attribute instead.
39+
- Removed the `data-teleport` attribute.
40+
- Removed the `data-header` attribute. Use the `headers` option in SSE actions instead.
41+
- Removed the `$$isFetching` action and the `data-fetch-indicator` attribute. Use `data-indicator` instead.
42+
- Removed the `$$remote` action.
43+
- Removed the `datastar-delete` SSE event. Use the new `datastar-remove-fragments` and `datastar-remove-signals` SSE events instead.
44+
- Removed the `datastar-redirect` and `datastar-console` SSE events. Use the new `datastar-execute-script` SSE event instead.
45+
- Removed `sendDatastarEvent` from ctx. We have to rethink how to expose events for a better try at the inspector.
46+
- Removed the concept of `_dsPlugins`, made unnecessary by a more consistent architecture.

CONTRIBUTING.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ Anything outside of this scope may not be accepted. If you have a need for a fea
1010

1111
## Bug Reports & Feature Requests
1212

13-
Before submitting bug reports and feature requests, please search the [open issues](https://github.com/delaneyj/datastar/issues) and the _#help_ channel in the [Discord server](https://discord.gg/bnRNgZjgPh) to see if it has already been addressed. When submitting a [new issue](https://github.com/delaneyj/datastar/issues/new), please use a descriptive title and include a clear description and as much relevant information as possible.
13+
Before submitting bug reports and feature requests, please search the [open issues](https://github.com/starfederation/datastar/issues) and the _#help_ channel in the [Discord server](https://discord.gg/bnRNgZjgPh) to see if it has already been addressed. When submitting a [new issue](https://github.com/starfederation/datastar/issues/new), please use a descriptive title and include a clear description and as much relevant information as possible.
1414

1515
## Documentation
1616

17-
Datastar’s documentation is under active development. All the markdown files live in [this folder](https://github.com/delaneyj/datastar/tree/main/backends/go/site/static/md). Improvements to them can be submitted via pull requests.
17+
Datastar’s documentation is under active development. All the markdown files live in [this folder](https://github.com/starfederation/datastar/tree/main/code/go/site/static/md). Improvements to them can be submitted via pull requests.
1818

1919
## Pull Requests
2020

2121
If you’re unsure about whether a pull request is within the scope of Datastar, please open an issue to discuss your idea first. Pull requests should have a descriptive title and clearly describe the problem and solution. If the pull request adds or changes behaviour, documentation and examples should be updated accordingly.
22+
23+
## Building
24+
25+
Datastar comes with a development environment for developing Datastar via a Docker container. Read the [Building Guidelines »](BUILDING.md)

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
FROM docker.io/golang:1.23.1-alpine AS build
1+
FROM docker.io/golang:1.23.3-alpine AS build
22

33
RUN apk add --no-cache upx
44
ENV PORT=8080
55

66
WORKDIR /src
77
COPY go.* *.go ./
88
RUN go mod download
9-
COPY backends/go/. ./backends/go/
9+
COPY code/go/. ./code/go/
1010
RUN --mount=type=cache,target=/root/.cache/go-build \
11-
go build -ldflags="-s" -o /out/site backends/go/cmd/site/main.go
11+
go build -ldflags="-s" -o /out/site code/go/cmd/site/main.go
1212
RUN upx -9 -k /out/site
1313

1414
FROM scratch

Dockerfile-dev

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG TAG=1.23.1-alpine
1+
ARG TAG=1.23-alpine
22

33
FROM golang:$TAG
44

@@ -8,24 +8,23 @@ WORKDIR /app
88
RUN set -eux; \
99
# Packages to install
1010
apk add --no-cache \
11-
g++ \
12-
go-task-task \
13-
git \
14-
git-lfs \
15-
jq \
16-
make \
17-
nodejs \
18-
npm \
19-
python3 \
20-
rsync \
11+
g++ \
12+
go-task-task \
13+
git \
14+
git-lfs \
15+
jq \
16+
make \
17+
rsync \
2118
&& \
2219
# Clean out directories that don't need to be part of the image
2320
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
2421
&& \
25-
npm install -g \
26-
pnpm \
27-
npm@^10.0.0 \
22+
# Install needed Go tooling
23+
go install github.com/a-h/templ/cmd/templ@latest \
2824
&& \
29-
go install github.com/a-h/templ/cmd/templ@latest
25+
go install github.com/valyala/quicktemplate/qtc@latest \
26+
&& \
27+
# Make this a safe .git directory
28+
git config --global --add safe.directory /app
3029

3130
ENTRYPOINT ["/bin/sh"]

0 commit comments

Comments
 (0)