From 29f5780570f163ae87060b1c6cf10ff78be514b8 Mon Sep 17 00:00:00 2001 From: Ethan Davidson <31261035+EthanThatOneKid@users.noreply.github.com> Date: Fri, 5 Apr 2024 12:57:49 -0700 Subject: [PATCH] initial commit --- .github/workflows/check.yaml | 18 ++++++++ .github/workflows/publish.yaml | 17 +++++++ .vscode/settings.json | 19 ++++++++ README.md | 83 +++++++++++++++++++++++++++++++++- deno.json | 1 + 5 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/check.yaml create mode 100644 .github/workflows/publish.yaml create mode 100644 .vscode/settings.json create mode 100644 deno.json diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml new file mode 100644 index 0000000..79cff88 --- /dev/null +++ b/.github/workflows/check.yaml @@ -0,0 +1,18 @@ +name: Check +"on": + push: + branches: + - main + pull_request: + branches: + - main +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: denoland/setup-deno@v1 + - name: Format + run: deno fmt && git diff-index --quiet HEAD + - name: Lint + run: deno lint && git diff-index --quiet HEAD diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..24b0f5e --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,17 @@ +name: Publish +"on": + push: + branches: + - main + workflow_dispatch: {} +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: denoland/setup-deno@v1 + - name: Publish package + run: deno publish diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0d99cbf --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,19 @@ +{ + "deno.enable": true, + "deno.unstable": true, + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "[markdown]": { + "editor.defaultFormatter": "denoland.vscode-deno" + }, + "[jsonc]": { + "editor.defaultFormatter": "denoland.vscode-deno" + }, + "[typescript]": { + "editor.defaultFormatter": "denoland.vscode-deno" + }, + "[typescriptreact]": { + "editor.defaultFormatter": "denoland.vscode-deno" + }, + "files.eol": "\n" +} diff --git a/README.md b/README.md index 4ac069a..9b58a4c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,81 @@ -# htx -An HTML rendering library in JSX. +# [@fartlabs/htx](https://jsr.io/@fartlabs/htx) + +[![GitHub Actions][GitHub Actions badge]][GitHub Actions] + +Render HTML components with JSX. + +## API documentation + +Generated API documentation is available at . + +## Getting started + +### Deno + +Let's learn how to get started with rtx by creating a simple router in Deno. + +1\. [Install Deno](https://docs.deno.com/runtime/manual). + +2\. Start a new Deno project. + +```sh +deno init +``` + +3\. Add `@fartlabs/jsonx` and `@fartlabs/htx` as project dependencies. + +```sh +deno add @fartlabs/jsonx @fartlabs/htx +``` + +4\. Add the following values to your `deno.json(c)` file. + +```json +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "@fartlabs/jsonx" + } +} +``` + +5\. Add a file ending in `.[j|t]sx` to your project. For example, `main.tsx`. + +```tsx +import { a } from "@fartlabs/htx"; + +const html = Hello, world!; + +Deno.writeTextFileSync("index.html", html); +``` + +6\. Compile your HTML by running the `.[j|t]sx` file. + +```sh +deno run --allow-net main.tsx +``` + +Resulting `index.html`: + +```html +Hello, world! +``` + +## Contribute + +### Style + +Run `deno fmt` to format the code. + +Run `deno lint` to lint the code. + +--- + +Developed with ❤️ [**@FartLabs**](https://github.com/FartLabs) + +[JSR]: https://jsr.io/@fartlabs/htx +[JSR badge]: https://jsr.io/badges/@fartlabs/htx +[JSR score]: https://jsr.io/@fartlabs/htx/score +[JSR score badge]: https://jsr.io/badges/@fartlabs/htx/score +[GitHub Actions]: https://github.com/FartLabs/htx/actions/workflows/check.yaml +[GitHub Actions badge]: https://github.com/FartLabs/htx/actions/workflows/check.yaml/badge.svg diff --git a/deno.json b/deno.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/deno.json @@ -0,0 +1 @@ +{}