nerve init: generate pnpm workspace config + align with new conventions #229

Closed
opened 2026-04-28 11:12:19 +00:00 by xiaoju · 0 comments
Owner

Problem

nerve init scaffolds a workspace that is outdated after recent changes:

  1. No pnpm-workspace.yaml — workspace should declare senses/* and workflows/* as packages
  2. No scripts.build in root package.json — should have "build": "pnpm -r build"
  3. Example sense (cpu-usage) still uses raw index.js instead of src/index.ts + esbuild bundle (fixed in #225 for nerve create sense but not for init)

Tasks

1. Generate pnpm-workspace.yaml

packages:
  - "workflows/*"
  - "senses/*"

2. Update PACKAGE_JSON template

Add build script:

"scripts": {
  "build": "pnpm -r build"
}

3. Update example sense to TypeScript + esbuild

The cpu-usage example sense should match the pattern from #225:

  • senses/cpu-usage/src/index.ts (not index.js)
  • senses/cpu-usage/src/schema.ts (not schema.ts at root)
  • senses/cpu-usage/package.json with esbuild build script
  • migrations/ stays at sense root

4. Run pnpm install && pnpm build after scaffolding

After generating all files, the init should run a workspace-level install and build so the example sense is ready.

5. Update tests

Update e2e-validate-init.test.ts and any other init-related tests.

Reference

## Problem `nerve init` scaffolds a workspace that is outdated after recent changes: 1. No `pnpm-workspace.yaml` — workspace should declare `senses/*` and `workflows/*` as packages 2. No `scripts.build` in root `package.json` — should have `"build": "pnpm -r build"` 3. Example sense (`cpu-usage`) still uses raw `index.js` instead of `src/index.ts` + esbuild bundle (fixed in #225 for `nerve create sense` but not for init) ## Tasks ### 1. Generate `pnpm-workspace.yaml` ```yaml packages: - "workflows/*" - "senses/*" ``` ### 2. Update `PACKAGE_JSON` template Add build script: ```json "scripts": { "build": "pnpm -r build" } ``` ### 3. Update example sense to TypeScript + esbuild The `cpu-usage` example sense should match the pattern from #225: - `senses/cpu-usage/src/index.ts` (not `index.js`) - `senses/cpu-usage/src/schema.ts` (not `schema.ts` at root) - `senses/cpu-usage/package.json` with esbuild build script - `migrations/` stays at sense root ### 4. Run `pnpm install && pnpm build` after scaffolding After generating all files, the init should run a workspace-level install and build so the example sense is ready. ### 5. Update tests Update `e2e-validate-init.test.ts` and any other init-related tests. ## Reference - #225 (`nerve create sense` already generates the right structure) - Working workspace: https://git.shazhou.work/xiaoju/nerve-workspace
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/nerve#229