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
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Node.js",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm",
"image": "mcr.microsoft.com/devcontainers/javascript-node:24",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
Expand Down
64 changes: 59 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Contributing to Arcjet Examples

## Development environment

We recommend using the provided
[devcontainer](https://code.visualstudio.com/docs/devcontainers/containers) to
develop examples in this repository. This ensures a consistent development
environment across all contributors.
Comment thread
qw-in marked this conversation as resolved.

## Static analysis

We use [Trunk](https://docs.trunk.io/) to manage formatting and linting in this
Expand Down Expand Up @@ -30,12 +37,59 @@ trunk check
> This guide is for adding new examples using the Arcjet JS SDK.

1. Place your example in the `examples` directory.
2. Set up the shared stylesheet
1. Set up the shared stylesheet
1. Add the shared `*.css` files to your example (for now copy from [examples/astro/src/styles](./examples/astro/src/styles))
2. Install the required dependencies:
1. Install the required dependencies:
```bash
npm install @fontsource-variable/figtree @fontsource/ibm-plex-mono @oddbird/css-anchor-positioning
```
3. Import `styles.css` via your frameworks canonical method
4. Conditionally import the [`@oddbird/css-anchor-positioning` polyfill](https://github.com/oddbird/css-anchor-positioning?tab=readme-ov-file#getting-started)
3. Follow the html structure of the other examples
1. Import `styles.css` via your frameworks canonical method
1. Conditionally import the [`@oddbird/css-anchor-positioning` polyfill](https://github.com/oddbird/css-anchor-positioning?tab=readme-ov-file#getting-started)
1. Follow the html structure of the other examples

### Publishing to a repository

1. Once the example has been merged into the `main` branch it can be published to it's own repository.
1. Create a new public repository on GitHub
1. Following the naming convention
> arcjet/example-[example-name]
Comment thread
qw-in marked this conversation as resolved.
1. Do not initialize a README, .gitignore, or license
1. Set the repository description
> An example [framework] application protected by Arcjet
1. Set the repository as a Template repository
<!-- TODO(#8): Social preview -->
1. Disable repository features
- Wikis
- Issues
- Sponsorships
- Discussions
- Projects
1. Disable GitHub actions
1. Add the `repository` field to the `package.json` of your example
```json
{
"repository": "github:arcjet/example-[example-name]"
}
```
Comment thread
qw-in marked this conversation as resolved.

Your new example repository is now ready to be published to. Follow [Publishing an example](#publishing-an-example).

## Publishing an example

> [!NOTE]
> For now, publishing is only semi-automated. In the future we will likely fully
> automate this process via a GitHub Action & GitHub App.

1. Ensure you have `main` checked out and the working directory is clean.
1. Run the node script to prepare the examples for publishing:
```bash
npm run prepare-to-publish
```
This will:
- Build the examples to verify they work
- Shallow clone the corresponding example repositories into `dist/[example-name]`
- Overwrite the `dist/[example-name]` with the current example
- Write out an isolated `package-lock.json` for the example
- If there are any changes, commit them to the example repository
- Prompt you to push the changes to the example repository
1. Where prompted, sanity check and then push as directed
1 change: 1 addition & 0 deletions examples/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
}
]
},
"repository": "github:arcjet/example-astro",
"scripts": {
"build": "astro build",
"check": "astro check",
Expand Down
Loading