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 .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
!/package.json
!/scripts
!/src
!/yarn.lock
!/pnpm-lock.yaml
28 changes: 20 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,22 @@ jobs:
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
with:
node-version: '${{ matrix.node }}'
- name: Get pnpm version from Volta config
id: pnpm-version
run: echo "version=$(jq -r '.volta.pnpm' package.json)" >> $GITHUB_OUTPUT
- uses: pnpm/action-setup@v4
with:
version: ${{ steps.pnpm-version.outputs.version }}
- uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3
id: cache
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package.json', 'yarn.lock') }}
key: ${{ runner.os }}-${{ hashFiles('package.json', 'pnpm-lock.yaml') }}
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile
- name: Test
run: yarn test
run: pnpm test

artifacts:
name: Artifacts Upload
Expand All @@ -47,25 +53,31 @@ jobs:
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
with:
node-version-file: package.json
- name: Get pnpm version from Volta config
id: pnpm-version
run: echo "version=$(jq -r '.volta.pnpm' package.json)" >> $GITHUB_OUTPUT
- uses: pnpm/action-setup@v4
with:
version: ${{ steps.pnpm-version.outputs.version }}
- uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3
id: cache
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package.json', 'yarn.lock') }}
key: ${{ runner.os }}-${{ hashFiles('package.json', 'pnpm-lock.yaml') }}
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile
- name: Build
run: yarn build --define:process.env.CRAFT_BUILD_SHA='"'${{ github.sha }}'"'
run: pnpm build --define:process.env.CRAFT_BUILD_SHA='"'${{ github.sha }}'"'
- name: Smoke Test
run: ./dist/craft --help
- name: NPM Pack
run: npm pack
- name: Build Docs
working-directory: docs
run: |
yarn install --frozen-lockfile
yarn build
pnpm install --frozen-lockfile
pnpm build
- name: Package Docs
run: |
cp .nojekyll docs/dist/
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/docs-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,21 @@ jobs:
with:
node-version: '22'

- name: Get pnpm version from Volta config
id: pnpm-version
run: echo "version=$(jq -r '.volta.pnpm' package.json)" >> $GITHUB_OUTPUT
- uses: pnpm/action-setup@v4
with:
version: ${{ steps.pnpm-version.outputs.version }}

- name: Build Docs for Preview
working-directory: docs
env:
# Override base path for PR preview
DOCS_BASE_PATH: /craft/pr-preview/pr-${{ github.event.pull_request.number }}
run: |
yarn install --frozen-lockfile
yarn build
pnpm install --frozen-lockfile
pnpm build

- name: Ensure .nojekyll at gh-pages root
run: |
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@ jobs:
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
with:
node-version-file: package.json
- name: Get pnpm version from Volta config
id: pnpm-version
run: echo "version=$(jq -r '.volta.pnpm' package.json)" >> $GITHUB_OUTPUT
- uses: pnpm/action-setup@v4
with:
version: ${{ steps.pnpm-version.outputs.version }}
- uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3
id: cache
with:
path: |
node_modules
.eslintcache
key: ${{ runner.os }}-${{ hashFiles('package.json', 'yarn.lock') }}
key: ${{ runner.os }}-${{ hashFiles('package.json', 'pnpm-lock.yaml') }}
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile
- name: Lint
run: yarn lint -f github-annotations
run: pnpm lint -f github-annotations
16 changes: 8 additions & 8 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ This file provides guidance for AI coding assistants working with the Craft code

## Package Management

- **Always use `yarn`** (v1) for package management. Never use `npm` or `pnpm`.
- **Always use `pnpm`** for package management. Never use `npm` or `yarn`.
- Node.js version is managed by [Volta](https://volta.sh/) (currently v22.12.0).
- Install dependencies with `yarn install --frozen-lockfile`.
- Install dependencies with `pnpm install --frozen-lockfile`.

## Development Commands

| Command | Description |
|---------|-------------|
| `yarn build` | Build the project (outputs to `dist/craft`) |
| `yarn test` | Run tests |
| `yarn lint` | Run ESLint |
| `yarn fix` | Auto-fix lint issues |
| `pnpm build` | Build the project (outputs to `dist/craft`) |
| `pnpm test` | Run tests |
| `pnpm lint` | Run ESLint |
| `pnpm fix` | Auto-fix lint issues |

To manually test changes:

```bash
yarn build && ./dist/craft
pnpm build && ./dist/craft
```

## Code Style
Expand Down Expand Up @@ -54,7 +54,7 @@ dist/

- Tests use **Vitest**.
- Test files are located in `src/__tests__/` and follow the `*.test.ts` naming pattern.
- Run tests with `yarn test`.
- Run tests with `pnpm test`.
- Use `vi.fn()`, `vi.mock()`, `vi.spyOn()` for mocking (Vitest's mock API).

## CI/CD
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

## Setup

Craft uses Yarn v1 for managing its dependencies. We also rely on
[Volta](https://volta.sh/) to manage our Node and Yarn versions. We highly
Craft uses pnpm for managing its dependencies. We also rely on
[Volta](https://volta.sh/) to manage our Node and pnpm versions. We highly
recommend installing Volta if you don't already have it.

Then, to get started, install the dependencies and get an initial build:

```shell
yarn install
yarn build
pnpm install
pnpm build
```

## Logging Level
Expand Down
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ FROM node:22-bookworm-slim AS builder

WORKDIR /usr/local/lib

COPY package.json yarn.lock ./
RUN export YARN_CACHE_FOLDER="$(mktemp -d)" \
&& yarn install --frozen-lockfile --quiet \
&& rm -r "$YARN_CACHE_FOLDER"
# Install pnpm (version from Volta config in package.json)
COPY package.json ./
RUN npm install -g pnpm@$(node -p "require('./package.json').volta.pnpm")

COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --quiet

COPY . .

RUN \
NODE_ENV=production \
NODE_PATH=/usr/local/lib/node_modules \
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/lib/node_modules/.bin" \
yarn --modules-folder /usr/local/lib/node_modules build
pnpm build

FROM node:22-bookworm

Expand Down
14 changes: 0 additions & 14 deletions Makefile

This file was deleted.

Loading
Loading