Skip to content

Commit 3e997dd

Browse files
committed
chore: update changelog and package.json for version 0.6.0 release; add package integrity tests
1 parent 0b53e4e commit 3e997dd

4 files changed

Lines changed: 125 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.6.0] - 2026-02-23
9+
10+
### Fixed
11+
- **Critical publishing bug** — Previous releases (0.1.0–0.5.0) shipped without `dist/` directory because `.gitignore` excluded `dist/` and npm fell back to it as the exclusion list (no `files` field or `.npmignore` existed). `require("apcore-js")` and `import("apcore-js")` would fail at runtime with "module not found". This is the first version where the package is actually usable from npm.
12+
- **VERSION constant out of sync**`VERSION` export was stuck at `'0.3.0'` while `package.json` was at `0.5.0`.
13+
14+
### Added
15+
- `"files": ["dist", "README.md"]` in `package.json` to restrict npm publish scope to compiled output only (previously published src/, tests/, planning/, .claude/, .github/ — 902 KB of dev files).
16+
- `"prepublishOnly": "pnpm run build"` script to ensure `tsc` runs before every `npm publish` / `pnpm publish`.
17+
- **Package integrity test suite** (`tests/test-package-integrity.test.ts`) — 10 tests that verify:
18+
- `files` field configuration and exclusion of dev directories
19+
- `prepublishOnly` script exists and invokes build
20+
- All entry points (`main`, `types`, `exports`) resolve to files in `dist/`
21+
- `dist/index.js` is importable and exports all 16+ core symbols
22+
- `VERSION` constant matches `package.json` version
23+
24+
### Changed
25+
- **Version aligned with apcore-python** — Bumped to 0.6.0 for cross-language version consistency.
26+
- Package size reduced from 192.6 kB (source-only, broken) to 86.3 kB (compiled, working).
27+
828
## [0.5.0] - 2026-02-23
929

1030
### Added

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "apcore-js",
3-
"version": "0.5.0",
3+
"version": "0.6.0",
44
"description": "AI-Perceivable Core — schema-driven module development framework",
55
"type": "module",
66
"main": "./dist/index.js",
@@ -11,12 +11,17 @@
1111
"types": "./dist/index.d.ts"
1212
}
1313
},
14+
"files": [
15+
"dist",
16+
"README.md"
17+
],
1418
"scripts": {
1519
"build": "tsc -p tsconfig.build.json",
1620
"typecheck": "tsc --noEmit",
1721
"test": "vitest run",
1822
"test:watch": "vitest",
19-
"test:coverage": "vitest run --coverage"
23+
"test:coverage": "vitest run --coverage",
24+
"prepublishOnly": "pnpm run build"
2025
},
2126
"engines": {
2227
"node": ">=18.0.0"

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,4 @@ export { ContextLogger, ObsLoggingMiddleware } from './observability/context-log
9696
export { TraceContext } from './trace-context.js';
9797
export type { TraceParent } from './trace-context.js';
9898

99-
export const VERSION = '0.3.0';
99+
export const VERSION = '0.6.0';
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/**
2+
* Package integrity tests.
3+
*
4+
* Verifies that the npm package is correctly configured for publishing:
5+
* - Entry points (main, types, exports) reference files that exist after build
6+
* - The "files" field restricts what gets published
7+
* - The "prepublishOnly" script ensures build runs before publish
8+
* - The VERSION constant matches package.json version
9+
*/
10+
11+
import { describe, it, expect } from 'vitest';
12+
import { existsSync } from 'node:fs';
13+
import { resolve, join } from 'node:path';
14+
import { readFileSync } from 'node:fs';
15+
16+
const ROOT = resolve(import.meta.dirname, '..');
17+
const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'));
18+
19+
describe('package.json publishing config', () => {
20+
it('has "files" field that includes dist', () => {
21+
expect(pkg.files).toBeDefined();
22+
expect(pkg.files).toContain('dist');
23+
});
24+
25+
it('"files" does not include source or dev directories', () => {
26+
const forbidden = ['src', 'tests', 'planning', 'coverage', '.claude', '.github'];
27+
for (const dir of forbidden) {
28+
expect(pkg.files, `files should not include "${dir}"`).not.toContain(dir);
29+
}
30+
});
31+
32+
it('has prepublishOnly script that runs build', () => {
33+
expect(pkg.scripts.prepublishOnly).toBeDefined();
34+
expect(pkg.scripts.prepublishOnly).toContain('build');
35+
});
36+
});
37+
38+
describe('dist entry points exist', () => {
39+
it('main entry (./dist/index.js) exists', () => {
40+
const mainPath = resolve(ROOT, pkg.main);
41+
expect(existsSync(mainPath), `${pkg.main} should exist`).toBe(true);
42+
});
43+
44+
it('types entry (./dist/index.d.ts) exists', () => {
45+
const typesPath = resolve(ROOT, pkg.types);
46+
expect(existsSync(typesPath), `${pkg.types} should exist`).toBe(true);
47+
});
48+
49+
it('exports "." import entry exists', () => {
50+
const importPath = resolve(ROOT, pkg.exports['.'].import);
51+
expect(existsSync(importPath), `exports["."].import should exist`).toBe(true);
52+
});
53+
54+
it('exports "." types entry exists', () => {
55+
const typesPath = resolve(ROOT, pkg.exports['.'].types);
56+
expect(existsSync(typesPath), `exports["."].types should exist`).toBe(true);
57+
});
58+
});
59+
60+
describe('dist exports are loadable', () => {
61+
it('can import the package entry point', async () => {
62+
const mod = await import('../dist/index.js');
63+
expect(mod).toBeDefined();
64+
expect(typeof mod).toBe('object');
65+
});
66+
67+
it('exports key symbols', async () => {
68+
const mod = await import('../dist/index.js');
69+
// Core classes/functions that consumers depend on
70+
expect(mod.Registry).toBeDefined();
71+
expect(mod.Executor).toBeDefined();
72+
expect(mod.Context).toBeDefined();
73+
expect(mod.Config).toBeDefined();
74+
expect(mod.ACL).toBeDefined();
75+
expect(mod.CancelToken).toBeDefined();
76+
expect(mod.MiddlewareManager).toBeDefined();
77+
expect(mod.ExtensionManager).toBeDefined();
78+
expect(mod.AsyncTaskManager).toBeDefined();
79+
expect(mod.BindingLoader).toBeDefined();
80+
expect(mod.SchemaLoader).toBeDefined();
81+
expect(mod.SchemaValidator).toBeDefined();
82+
expect(mod.TracingMiddleware).toBeDefined();
83+
expect(mod.MetricsCollector).toBeDefined();
84+
expect(mod.ContextLogger).toBeDefined();
85+
expect(mod.TraceContext).toBeDefined();
86+
// Error classes
87+
expect(mod.ModuleError).toBeDefined();
88+
expect(mod.ErrorCodes).toBeDefined();
89+
});
90+
});
91+
92+
describe('VERSION constant', () => {
93+
it('matches package.json version', async () => {
94+
const mod = await import('../dist/index.js');
95+
expect(mod.VERSION).toBe(pkg.version);
96+
});
97+
});

0 commit comments

Comments
 (0)