Skip to content

Commit

Permalink
Update CONTRIBUTING, add publish script (bump.sh)n
Browse files Browse the repository at this point in the history
  • Loading branch information
benvinegar committed Feb 11, 2025
1 parent 03a38fb commit 1877396
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 10 deletions.
39 changes: 29 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ Counterscale development is 100% volunteer-driven. If you use and like this soft

## Development

### Dependencies

Install dependencies:

```bash
pnpm install
```

Install Playwright browsers:

```bash
cd packages/tracker && pnpm playwright install
```

### Config

To get started, in the `packages/server` folder, copy `.dev.vars.example` to `.dev.vars`.
Expand All @@ -12,12 +26,23 @@ Open `.dev.vars` and enter the same values for `CF_BEARER_TOKEN` and `CF_ACCOUNT

### Running the Server

Counterscale is built on Remix and Cloudflare Workers. In development, you have two options:
Counterscale is built on Vite/React Router (v7+) and Cloudflare Workers.

In development, you have two options:

1. `pnpm turbo dev` → This runs the Vite development server in Node.js. This server will automatically rebuild files when you change them, but it does not best reflect Cloudflare's serverless platform.

2. `pnpm turbo preview` → This runs Cloudflare's Miniflare server with a build of the Remix files. This closer matches the deployment environment, but does not (yet) automatically rebuild your app.

-1. `npx turbo dev` → This runs the Vite development server in Node.js. This server will automatically rebuild files when you change them, but it does not best reflect Cloudflare's serverless platform.
-2. `npx turbo preview` → This runs Cloudflare's Miniflare server with a build of the Remix files. This closer matches the deployment environment, but does not (yet) automatically rebuild your app.
## Publishing

When publishing a new version, use this little utility script:

```
./bump.sh <new_version>
```

### Development Philosophy
## Development Philosophy

The primary goal of Counterscale is to be super easy to self-host and maintain. It should be "set up once and forget".

Expand All @@ -30,9 +55,3 @@ To achieve that:
- We prioritize backwards compatibility
- New `metricsDataset` columns can be added, but old columns cannot be removed or renamed (they can however, be "forgotten").
- That also means it's okay if a feature only works during a period where the data is active.

## Publishing

```
pnpm publish -r # --dry-run
```
30 changes: 30 additions & 0 deletions bump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
# Small janky utility for bumping package versions across the monorepo,
# because `npm version` doesn't really work w/ pnpm

# get version from 1st argument
VERSION=$1

# error if no version
if [ -z "$VERSION" ]; then
echo "Usage: bump.sh <version>"
exit 1
fi

for d in packages/*; do
echo "Bumping $d to version $VERSION"
npm pkg set -w $d version=$VERSION
done

echo ""
echo "Bumping @counterscale/server subdep in packages/cli to version $VERSION"
npm pkg set -w packages/cli dependencies.@counterscale/server=$VERSION


echo ""
echo "Next steps ..."
echo ""
echo "$ git diff # Review changes"
echo "$ git commit -am \"$VERSION\""
echo "$ git tag $VERSION"
echo "$ pnpm publish -r"

0 comments on commit 1877396

Please sign in to comment.