Skip to content

Commit

Permalink
Reorg the project, c/p from https://github.com/starfederation/datasta…
Browse files Browse the repository at this point in the history
  • Loading branch information
delaneyj authored Nov 22, 2024
1 parent 379730c commit 6b5b3a6
Show file tree
Hide file tree
Showing 520 changed files with 12,913 additions and 35,173 deletions.
36 changes: 0 additions & 36 deletions .dockerignore

This file was deleted.

8 changes: 4 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
*.gif filter=lfs diff=lfs merge=lfs -text
*.webp filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.blend* filter=lfs diff=lfs merge=lfs -text
*.hdr* filter=lfs diff=lfs merge=lfs -text
*.wav* filter=lfs diff=lfs merge=lfs -text
*.ttf* filter=lfs diff=lfs merge=lfs -text
*.webp filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

bundles linguist-generated=true
23 changes: 0 additions & 23 deletions .github/workflows/github-releases-to-discord.yml

This file was deleted.

14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
*debug_bin*
node_modules

site_bin
tailwindcli
datastar_site
data
.task
*_templ.go
*.png~
test-results
.idea
node_modules
datastar-website
*_bin
4 changes: 2 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"recommendations": [
"ms-playwright.playwright",
"jdinabox.quicktemplate-vscode",
"golang.go",
"a-h.templ"
]
}
}
17 changes: 13 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,23 @@
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/backends/go/cmd/site/main.go"
"program": "${workspaceFolder}/code/go/cmd/site/main.go",
"preLaunchTask": "build datastar"
},
{
"name": "Go test example",
"name": "Smoke Test",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/backends/example/go/main.go"
"program": "${workspaceFolder}/code/go/cmd/sitesmoketests/main.go"
},
{
"name": "Build Library",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/code/go/cmd/tsbuild/main.go",
"cwd": "${workspaceFolder}"
}
]
}
}
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"go.testTimeout": "200s",
"go.coverOnSingleTestFile": true,
"go.coverOnSingleTest": true,
"go.testFlags": [
"-test.parallel",
"4"
],
"editor.foldingStrategy": "indentation",
"makefile.configureOnOpen": false
}
13 changes: 13 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "build datastar",
"command": "task",
"args": [
"support"
]
}
]
}
58 changes: 58 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Building Datastar using Docker

Datastar comes with a development environment for developing Datastar via a Docker container.

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.

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).

## Why Docker?

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.

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.

It also allows you to easily swap between basic things like Go versions, without affecting your local computer.

## Quick Start

In terminal, `cd` to the `datastar/` directory, and then type:

```
make dev
```

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.

Then just navigate to `http://localhost:8080` in your browser, and Datastar site from `backends/go/site/` will be up and running.

You can freely make changes the `packages/library/` Datastar codebase, and the changes will be rebuilt and reload automatically.

You can also make changes to the `backends/go/site/` Datastar website backend, and the backend will be rebuilt and reload automatically.

## Using Datastar Docker Dev

Datastar Docker Dev uses the venerable `make` command to automate setup and access to the Docker containers used.

It uses `make` because it's available pre-installed on any development machine.

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`.

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.

Below are details and options available in each of the provided `make` commands:

* `make dev` - starts up the Go website server for the backend with hot reloading as you make changes
* `make task xxx` - runs the specified task from the `Taskfile.yml` inside of the Docker container
* `make ssh` - gives you a shell inside of the Docker container
* `make image-build` - rebuilds the Docker image from scratch (you will probably never need this)

### CLI Arguments

You can pass in optional CLI arguments to override the default settings Datastar dev uses:

* `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.

### Terminating

To terminate the `datastar-dev` Docker container, enter `Control-C` in the terminal.
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Release Notes for Datastar

## 0.20.0 - 2024-11-22

> [!WARNING]
> This update contains breaking changes to attributes, actions and SSE events.
### Added

- Added a custom bundle [bundler](https://data-star.dev/bundler).
- Added SDKs for Go, PHP and .NET.
- Added the `data-persist` attribute.
- Added the `data-replace-url` attribute.
- Added the `data-indicator` attribute.
- Added the `datastar-remove-fragments` SSE event.
- Added the `datastar-remove-signals` SSE event.
- Added the `datastar-execute-script` SSE event.

### Changed

- Changed the `$$` prefix to `$` for action plugins.
- The `data-model` attribute now upserts signals into the store.
- The `data-ref` attribute now upserts a signal into the store.
- 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.
- Renamed the `datastar-fragment` SSE event to `datastar-merge-fragments`.
- Renamed the `datastar-signal` SSE event to `datastar-merge-signals`.
- Renamed the `fragment` dataline literal for SSE events to `fragments`.
- Renamed the `store` dataline literal for SSE events to `signals`.
- Renamed the `upsert_attributes` merge mode to `upsertAttributes` in the fragment event.
- Renamed the `settle` option to `settleDuration` in the fragment event and changed the default value to `300`.
- Renamed the `vt` option to `useViewTransition` in the fragment event and changed the default value to `false`.
- Changed the second argument of SSE actions from `onlyRemoteSignals` to an optional object with `headers` and `onlyRemoteSignals` keys, defaulting to `{}` and `true` respectively.
- Error codes that roughly match HTTP status codes are now used.

### Removed

- Removed the `~ref` syntax. Use the signal created by `data-ref` directly instead.
- Removed the `local` and `session` modifiers from `data-store`. Use the new `data-persist` attribute instead.
- Removed the `data-teleport` attribute.
- Removed the `data-header` attribute. Use the `headers` option in SSE actions instead.
- Removed the `$$isFetching` action and the `data-fetch-indicator` attribute. Use `data-indicator` instead.
- Removed the `$$remote` action.
- Removed the `datastar-delete` SSE event. Use the new `datastar-remove-fragments` and `datastar-remove-signals` SSE events instead.
- Removed the `datastar-redirect` and `datastar-console` SSE events. Use the new `datastar-execute-script` SSE event instead.
- Removed `sendDatastarEvent` from ctx. We have to rethink how to expose events for a better try at the inspector.
- Removed the concept of `_dsPlugins`, made unnecessary by a more consistent architecture.
8 changes: 6 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ Anything outside of this scope may not be accepted. If you have a need for a fea

## Bug Reports & Feature Requests

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.
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.

## Documentation

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.
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.

## Pull Requests

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.

## Building

Datastar comes with a development environment for developing Datastar via a Docker container. Read the [Building Guidelines »](BUILDING.md)
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM docker.io/golang:1.23.1-alpine AS build
FROM docker.io/golang:1.23.3-alpine AS build

RUN apk add --no-cache upx
ENV PORT=8080

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

FROM scratch
Expand Down
29 changes: 14 additions & 15 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG TAG=1.23.1-alpine
ARG TAG=1.23-alpine

FROM golang:$TAG

Expand All @@ -8,24 +8,23 @@ WORKDIR /app
RUN set -eux; \
# Packages to install
apk add --no-cache \
g++ \
go-task-task \
git \
git-lfs \
jq \
make \
nodejs \
npm \
python3 \
rsync \
g++ \
go-task-task \
git \
git-lfs \
jq \
make \
rsync \
&& \
# Clean out directories that don't need to be part of the image
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& \
npm install -g \
pnpm \
npm@^10.0.0 \
# Install needed Go tooling
go install github.com/a-h/templ/cmd/templ@latest \
&& \
go install github.com/a-h/templ/cmd/templ@latest
go install github.com/valyala/quicktemplate/qtc@latest \
&& \
# Make this a safe .git directory
git config --global --add safe.directory /app

ENTRYPOINT ["/bin/sh"]
Loading

0 comments on commit 6b5b3a6

Please sign in to comment.