You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The published package was shipping 25 test files and 5 dev scripts: the
`files` allowlist listed `src/` and `scripts/` wholesale, and with a
`files` field present npm ignores `.npmignore` entirely — so its test/dev
excludes silently did nothing.
Packaging (industry-standard allowlist, no .npmignore):
- Relocate tests src/tests/ -> top-level test/ so the `src` allowlist entry
no longer pulls them in. Rewrite their `../` imports to `../src/` and fix
bug-fixes.test.js path anchors (srcDir/projectDir) for the new depth.
- Tighten `files` to a precise allowlist (src, mcp.json, .env.example,
README, LICENSE, CLAUDE.md, AGENTS.md) and delete the dead `.npmignore`.
Tarball: 61 -> 31 files, 0 tests, 0 dev scripts.
- Add publint (npm run lint:package) and a prepublishOnly gate that runs
the offline suites + publint before publish (omits the live integration
test so publishing never hits a real site).
Dev tooling:
- Add scripts/verify-tool-names.mjs: cross-checks every gf_/gv_ name in the
server instructions, docs and demo against the tools the server actually
registers (gv_* are generated from the live abilities catalog and can
drift). Run via npm run verify:tool-names against a live site.
- Document packaging and the verifier in AGENTS.md.
Verified: full test:all incl. live integration green; npm pack --dry-run
clean (31 files); publint passes; verify:tool-names passes.
5.**Add tests** — create test in `src/tests/` following existing patterns (see `forms.test.js` for reference).
237
+
5.**Add tests** — create test in `test/` following existing patterns (see `forms.test.js` for reference). Import source under test as `../src/…`.
249
238
250
239
### Adding a New Field Type to the Registry
251
240
@@ -340,7 +329,7 @@ npm run test:all # Run everything sequentially
340
329
npm test# Integration tests (requires live API)
341
330
```
342
331
343
-
Tests use a custom runner (`src/tests/run.js`), not Jest/Mocha. Test helpers in `src/tests/helpers.js` provide mock data generators (`generateMockForm`, `generateMockEntry`, `generateMockFeed`).
332
+
Tests use a custom runner (`test/run.js`), not Jest/Mocha. Test helpers in `test/helpers.js` provide mock data generators (`generateMockForm`, `generateMockEntry`, `generateMockFeed`).
344
333
345
334
For integration tests, set `GRAVITY_FORMS_TEST_*` env vars pointing to a test WordPress site. Test forms are prefixed with `TEST_` and auto-cleaned via `TestFormManager`.
346
335
@@ -374,6 +363,15 @@ No build step — pure ESM JavaScript, runs directly with `node src/index.js`. R
374
363
375
364
12.**Test mode resolves env vars at client construction.** When `GRAVITYKIT_MCP_TEST_MODE=true` (or legacy `GRAVITYMCP_TEST_MODE=true`), `testConfig.resolveEnv()` remaps `GRAVITY_FORMS_TEST_BASE_URL` → `GRAVITY_FORMS_BASE_URL` (and consumer key/secret). The rest of the client and AuthManager work unchanged. — `config/test-config.js:60-95`, `gravity-forms-client.js:16`
376
365
366
+
## Packaging
367
+
368
+
What ships to npm is governed solely by the **`files` allowlist** in `package.json` — there is intentionally **no `.npmignore`** (with a `files` field present npm ignores it, so keeping one is misleading). Allowlist, not denylist: a new file ships only if it matches `files`.
-**Excluded by omission:**`test/` (tests are top-level, not under `src/`), `scripts/` (dev tooling), `.github/`, `package-lock.json`.
372
+
-**`npm run lint:package`** runs [publint](https://publint.dev) to validate package correctness; **`prepublishOnly`** runs the offline test suites + publint, so a broken or mis-packaged build can't be published. It deliberately omits the live integration test (`npm test`) to avoid hitting a real site during publish.
373
+
-**Verify before publishing:**`npm pack --dry-run` lists exactly what will ship.
374
+
377
375
## Releasing
378
376
379
377
**Every version tag MUST include a CHANGELOG.md update.** Follow this checklist:
@@ -388,6 +386,8 @@ No build step — pure ESM JavaScript, runs directly with `node src/index.js`. R
388
386
389
387
Skipping any step (especially CHANGELOG) will leave the release history incomplete for future developers and AI agents.
390
388
389
+
**Before tagging, run `npm run verify:tool-names` against a live site.** The `gv_*` tools are generated from the installed GravityView/Foundation Abilities catalog, so a catalog rename can silently leave the server `instructions` string, README, or the demo referencing tools that no longer exist. The script cross-checks every `gf_`/`gv_` name in prose against what the server actually registers and exits non-zero on a mismatch. Requires WordPress credentials in the environment (see Required Environment). Dev-only — not shipped in the npm package.
390
+
391
391
## Related Resources
392
392
393
393
-**CLAUDE.md** — Concise project identity and critical rules
"test:all": "npm run test:unit && npm run test:field-ops && npm run test:auth && npm run test:forms && npm run test:entries && npm run test:feeds && npm run test:submissions && npm run test:validation && npm run test:field-validation && npm run test:tools && npm run test:views && npm test",
30
-
"test:coverage": "echo 'Running all tests with coverage analysis' && npm run test:all"
31
+
"test:coverage": "echo 'Running all tests with coverage analysis' && npm run test:all",
32
+
"lint:package": "publint",
33
+
"prepublishOnly": "npm run test:unit && npm run test:field-ops && npm run test:field-validation && npm run test:views && publint"
0 commit comments