|
1 | 1 | {
|
| 2 | + // HPKE-JS Project Configuration |
| 3 | + // This file configures the Deno workspace for the HPKE (Hybrid Public Key Encryption) implementation |
| 4 | + |
| 5 | + // Workspace members - all packages and their sample projects |
2 | 6 | "workspace": [
|
3 | 7 | "./packages/common",
|
4 | 8 | "./packages/core",
|
|
19 | 23 | "./packages/ml-kem/samples/deno",
|
20 | 24 | "./utils"
|
21 | 25 | ],
|
| 26 | + // Import map for dependencies used across the project |
22 | 27 | "imports": {
|
23 | 28 | "@dajiaji/mlkem": "jsr:@dajiaji/mlkem@^2.5.0",
|
24 | 29 | "@deno/dnt": "jsr:@deno/[email protected]",
|
|
29 | 34 | "@std/path": "jsr:@std/[email protected]",
|
30 | 35 | "@std/testing/bdd": "jsr:@std/[email protected]/bdd"
|
31 | 36 | },
|
| 37 | + // Code formatting configuration |
32 | 38 | "fmt": {
|
| 39 | + // Exclude generated files and external dependencies |
33 | 40 | "exclude": [
|
34 | 41 | "npm/",
|
35 | 42 | "packages/hybridkem-x25519-kyber768/",
|
|
39 | 46 | "coverage/"
|
40 | 47 | ]
|
41 | 48 | },
|
| 49 | + // Linting configuration |
42 | 50 | "lint": {
|
| 51 | + // Exclude same files as formatting |
43 | 52 | "exclude": [
|
44 | 53 | "npm/",
|
45 | 54 | "packages/hybridkem-x25519-kyber768/",
|
|
49 | 58 | "coverage/"
|
50 | 59 | ]
|
51 | 60 | },
|
| 61 | + // Test configuration |
52 | 62 | "test": {
|
| 63 | + // Exclude non-test files and generated content |
53 | 64 | "exclude": [
|
54 | 65 | "npm/",
|
55 | 66 | "packages/hybridkem-x25519-kyber768/",
|
|
60 | 71 | "coverage/"
|
61 | 72 | ]
|
62 | 73 | },
|
| 74 | + // Task definitions for development workflow |
| 75 | + // Main tasks use object format with descriptions, sub-tasks use string format for brevity |
63 | 76 | "tasks": {
|
64 |
| - "test": "deno task test:deno && deno task npm && deno task test:browsers && deno task test:cloudflare && deno task bun-link && deno task test:bun && deno task test:node", |
| 77 | + // === MAIN DEVELOPMENT TASKS === |
| 78 | + // Primary tasks for daily development workflow |
| 79 | + "test": { |
| 80 | + "description": "Run comprehensive test suite across all environments (Deno, browsers, Cloudflare Workers, Bun, Node.js)", |
| 81 | + "command": "deno task test:deno && deno task npm && deno task test:browsers && deno task test:cloudflare && deno task bun-link && deno task test:bun && deno task test:node" |
| 82 | + }, |
| 83 | + |
| 84 | + // === TESTING TASKS === |
| 85 | + // Deno environment testing |
65 | 86 | "test:deno": "deno fmt && deno lint && deno task check && deno test --fail-fast --doc --coverage=coverage --parallel --allow-read",
|
66 | 87 | "test:deno:common": "cd packages/common && deno task test",
|
67 | 88 | "test:deno:core": "cd packages/core && deno task test",
|
|
72 | 93 | "test:deno:hybridkem-x-wing": "cd packages/hybridkem-x-wing && deno task test",
|
73 | 94 | "test:deno:hpke-js": "cd packages/hpke-js && deno task test",
|
74 | 95 | "test:deno:ml-kem": "cd packages/ml-kem && deno task test",
|
| 96 | + |
| 97 | + // Node.js environment testing (via DNT build) |
75 | 98 | "test:node": "deno task test:node:common && deno task test:node:core && deno task test:node:chacha20poly1305 && deno task test:node:dhkem-x25519 && deno task test:node:dhkem-x448 && deno task test:node:dhkem-secp256k1 && deno task test:node:hybridkem-x-wing && deno task test:node:hpke-js && deno task test:node:ml-kem",
|
76 | 99 | "test:node:common": "cd packages/common && deno task dnt",
|
77 | 100 | "test:node:core": "cd packages/core && deno task dnt",
|
|
82 | 105 | "test:node:hybridkem-x-wing": "cd packages/hybridkem-x-wing && deno task dnt",
|
83 | 106 | "test:node:hpke-js": "cd packages/hpke-js && deno task dnt",
|
84 | 107 | "test:node:ml-kem": "cd packages/ml-kem && deno task dnt",
|
| 108 | + |
| 109 | + // Browser environment testing |
85 | 110 | "test:browsers": "deno task test:browsers:prepare && deno task test:browsers:core && deno task test:browsers:chacha20poly1305 && deno task test:browsers:dhkem-x25519 && deno task test:browsers:dhkem-x448 && deno task test:browsers:dhkem-secp256k1 && deno task test:browsers:hybridkem-x-wing && deno task test:browsers:hpke-js && deno task test:browsers:ml-kem",
|
86 | 111 | "test:browsers:prepare": "deno task test:browsers:prepare:npm && deno task test:browsers:prepare:core && deno task test:browsers:prepare:chacha20poly1305 && deno task test:browsers:prepare:dhkem-x25519 && deno task test:browsers:prepare:dhkem-x448 && deno task test:browsers:prepare:dhkem-secp256k1 && deno task test:browsers:prepare:hybridkem-x-wing && deno task test:browsers:prepare:hpke-js && deno task test:browsers:prepare:ml-kem",
|
87 | 112 | "test:browsers:prepare:npm": "cd npm && npx playwright install-deps && npx playwright install",
|
|
101 | 126 | "test:browsers:hybridkem-x-wing": "cd npm && npm run test -w test/hybridkem-x-wing/runtimes/browsers",
|
102 | 127 | "test:browsers:hpke-js": "cd npm && npm run test -w test/hpke-js/runtimes/browsers",
|
103 | 128 | "test:browsers:ml-kem": "cd npm && npm run test -w test/ml-kem/runtimes/browsers",
|
| 129 | + |
| 130 | + // Cloudflare Workers environment testing |
104 | 131 | "test:cloudflare": "deno task test:cloudflare:core && deno task test:cloudflare:chacha20poly1305 && deno task test:cloudflare:dhkem-x25519 && deno task test:cloudflare:dhkem-x448 && deno task test:cloudflare:dhkem-secp256k1 && deno task test:cloudflare:hybridkem-x-wing && deno task test:cloudflare:hpke-js && deno task test:cloudflare:ml-kem",
|
105 | 132 | "test:cloudflare:core": "cd npm && npm run test -w test/core/runtimes/cloudflare",
|
106 | 133 | "test:cloudflare:chacha20poly1305": "cd npm && npm run test -w test/chacha20poly1305/runtimes/cloudflare",
|
|
110 | 137 | "test:cloudflare:hybridkem-x-wing": "cd npm && npm run test -w test/hybridkem-x-wing/runtimes/cloudflare",
|
111 | 138 | "test:cloudflare:hpke-js": "cd npm && npm run test -w test/hpke-js/runtimes/cloudflare",
|
112 | 139 | "test:cloudflare:ml-kem": "cd npm && npm run test -w test/ml-kem/runtimes/cloudflare",
|
| 140 | + |
| 141 | + // Bun environment testing |
113 | 142 | "test:bun": "deno task test:bun:core && deno task test:bun:chacha20poly1305 && deno task test:bun:dhkem-x25519 && deno task test:bun:dhkem-x448 && deno task test:bun:dhkem-secp256k1 && deno task test:bun:hybridkem-x-wing && deno task test:bun:hpke-js && deno task test:bun:ml-kem",
|
114 | 143 | "test:bun:core": "cd packages/core && deno task test:bun",
|
115 | 144 | "test:bun:chacha20poly1305": "cd packages/chacha20poly1305 && deno task test:bun",
|
|
119 | 148 | "test:bun:hybridkem-x-wing": "cd packages/hybridkem-x-wing && deno task test:bun",
|
120 | 149 | "test:bun:hpke-js": "cd packages/hpke-js && deno task test:bun",
|
121 | 150 | "test:bun:ml-kem": "cd packages/ml-kem && deno task test:bun",
|
122 |
| - "cov": "deno coverage ./coverage --lcov --exclude='test'", |
123 |
| - "check": "deno task check:common && deno task check:core && deno task check:chacha20poly1305 && deno task check:dhkem-x25519 && deno task check:dhkem-x448 && deno task check:dhkem-secp256k1 && deno task check:hybridkem-x-wing && deno task check:hpke-js && deno task check:ml-kem", |
| 151 | + |
| 152 | + // === CODE QUALITY TASKS === |
| 153 | + "cov": { |
| 154 | + "description": "Generate LCOV coverage report from test results", |
| 155 | + "command": "deno coverage ./coverage --lcov --exclude='test'" |
| 156 | + }, |
| 157 | + "check": { |
| 158 | + "description": "Run type checking across all packages", |
| 159 | + "command": "deno task check:common && deno task check:core && deno task check:chacha20poly1305 && deno task check:dhkem-x25519 && deno task check:dhkem-x448 && deno task check:dhkem-secp256k1 && deno task check:hybridkem-x-wing && deno task check:hpke-js && deno task check:ml-kem" |
| 160 | + }, |
124 | 161 | "check:common": "cd packages/common && deno task check",
|
125 | 162 | "check:core": "cd packages/core && deno task check",
|
126 | 163 | "check:chacha20poly1305": "cd packages/chacha20poly1305 && deno task check",
|
|
130 | 167 | "check:hybridkem-x-wing": "cd packages/hybridkem-x-wing && deno task check",
|
131 | 168 | "check:hpke-js": "cd packages/hpke-js && deno task check",
|
132 | 169 | "check:ml-kem": "cd packages/ml-kem && deno task check",
|
133 |
| - "npm": "deno task npm-build && deno task npm-link && deno task npm-pack && cd npm && npm install", |
134 |
| - "npm-clean": "rm -rf npm/packages npm/samples npm/test", |
135 |
| - "npm-build": "deno task npm-build:common && deno task npm-build:core && deno task npm-build:chacha20poly1305 && deno task npm-build:dhkem-x25519 && deno task npm-build:dhkem-x448 && deno task npm-build:dhkem-secp256k1 && deno task npm-build:hybridkem-x-wing && deno task npm-build:hpke-js && deno task npm-build:ml-kem", |
| 170 | + |
| 171 | + // === NPM DISTRIBUTION TASKS === |
| 172 | + "npm": { |
| 173 | + "description": "Build, link, pack, and install NPM packages", |
| 174 | + "command": "deno task npm-build && deno task npm-link && deno task npm-pack && cd npm && npm install" |
| 175 | + }, |
| 176 | + "npm-clean": { |
| 177 | + "description": "Clean up generated NPM distribution files", |
| 178 | + "command": "rm -rf npm/packages npm/samples npm/test" |
| 179 | + }, |
| 180 | + "npm-build": { |
| 181 | + "description": "Build NPM packages for all modules using DNT", |
| 182 | + "command": "deno task npm-build:common && deno task npm-build:core && deno task npm-build:chacha20poly1305 && deno task npm-build:dhkem-x25519 && deno task npm-build:dhkem-x448 && deno task npm-build:dhkem-secp256k1 && deno task npm-build:hybridkem-x-wing && deno task npm-build:hpke-js && deno task npm-build:ml-kem" |
| 183 | + }, |
136 | 184 | "npm-build:common": "cd packages/common && deno task npm-build",
|
137 | 185 | "npm-build:core": "cd packages/core && deno task npm-build",
|
138 | 186 | "npm-build:chacha20poly1305": "cd packages/chacha20poly1305 && deno task npm-build",
|
|
142 | 190 | "npm-build:hybridkem-x-wing": "cd packages/hybridkem-x-wing && deno task npm-build",
|
143 | 191 | "npm-build:hpke-js": "cd packages/hpke-js && deno task npm-build",
|
144 | 192 | "npm-build:ml-kem": "cd packages/ml-kem && deno task npm-build",
|
145 |
| - "npm-link": "deno task npm-link:common && deno task npm-link:core && deno task npm-link:chacha20poly1305 && deno task npm-link:dhkem-x25519 && deno task npm-link:dhkem-x448 && deno task npm-link:dhkem-secp256k1 && deno task npm-link:hybridkem-x-wing && deno task npm-link:hpke-js && deno task npm-link:ml-kem", |
| 193 | + "npm-link": { |
| 194 | + "description": "Create symlinks for all NPM packages for local development", |
| 195 | + "command": "deno task npm-link:common && deno task npm-link:core && deno task npm-link:chacha20poly1305 && deno task npm-link:dhkem-x25519 && deno task npm-link:dhkem-x448 && deno task npm-link:dhkem-secp256k1 && deno task npm-link:hybridkem-x-wing && deno task npm-link:hpke-js && deno task npm-link:ml-kem" |
| 196 | + }, |
146 | 197 | "npm-link:common": "cd npm/packages/common && npm link",
|
147 | 198 | "npm-link:core": "cd npm/packages/core && npm link",
|
148 | 199 | "npm-link:chacha20poly1305": "cd npm/packages/chacha20poly1305 && npm link",
|
|
152 | 203 | "npm-link:hybridkem-x-wing": "cd npm/packages/hybridkem-x-wing && npm link",
|
153 | 204 | "npm-link:hpke-js": "cd npm/packages/hpke-js && npm link",
|
154 | 205 | "npm-link:ml-kem": "cd npm/packages/ml-kem && npm link",
|
155 |
| - "npm-pack": "deno task npm-pack:common && deno task npm-pack:core && deno task npm-pack:chacha20poly1305 && deno task npm-pack:dhkem-x25519 && deno task npm-pack:dhkem-x448 && deno task npm-pack:dhkem-secp256k1 && deno task npm-pack:hybridkem-x-wing && deno task npm-pack:hpke-js && deno task npm-pack:ml-kem", |
| 206 | + "npm-pack": { |
| 207 | + "description": "Validate NPM package contents with dry-run pack for all modules", |
| 208 | + "command": "deno task npm-pack:common && deno task npm-pack:core && deno task npm-pack:chacha20poly1305 && deno task npm-pack:dhkem-x25519 && deno task npm-pack:dhkem-x448 && deno task npm-pack:dhkem-secp256k1 && deno task npm-pack:hybridkem-x-wing && deno task npm-pack:hpke-js && deno task npm-pack:ml-kem" |
| 209 | + }, |
156 | 210 | "npm-pack:common": "cd npm/packages/common && npm pack --dry-run",
|
157 | 211 | "npm-pack:core": "cd npm/packages/core && npm pack --dry-run",
|
158 | 212 | "npm-pack:chacha20poly1305": "cd npm/packages/chacha20poly1305 && npm pack --dry-run",
|
|
162 | 216 | "npm-pack:hybridkem-x-wing": "cd npm/packages/hybridkem-x-wing && npm pack --dry-run",
|
163 | 217 | "npm-pack:hpke-js": "cd npm/packages/hpke-js && npm pack --dry-run",
|
164 | 218 | "npm-pack:ml-kem": "cd npm/packages/ml-kem && npm pack --dry-run",
|
165 |
| - "bun-link": "deno task bun-link:common && deno task bun-link:core && deno task bun-link:chacha20poly1305 && deno task bun-link:dhkem-x25519 && deno task bun-link:dhkem-x448 && deno task bun-link:dhkem-secp256k1 && deno task bun-link:hybridkem-x-wing && deno task bun-link:hpke-js && deno task bun-link:ml-kem", |
| 219 | + |
| 220 | + // === DEVELOPMENT ENVIRONMENT SETUP === |
| 221 | + "bun-link": { |
| 222 | + "description": "Create Bun symlinks for all packages for local development", |
| 223 | + "command": "deno task bun-link:common && deno task bun-link:core && deno task bun-link:chacha20poly1305 && deno task bun-link:dhkem-x25519 && deno task bun-link:dhkem-x448 && deno task bun-link:dhkem-secp256k1 && deno task bun-link:hybridkem-x-wing && deno task bun-link:hpke-js && deno task bun-link:ml-kem" |
| 224 | + }, |
166 | 225 | "bun-link:common": "cd npm/packages/common && bun link",
|
167 | 226 | "bun-link:core": "cd npm/packages/core && bun link",
|
168 | 227 | "bun-link:chacha20poly1305": "cd npm/packages/chacha20poly1305 && bun link",
|
|
172 | 231 | "bun-link:hybridkem-x-wing": "cd npm/packages/hybridkem-x-wing && bun link",
|
173 | 232 | "bun-link:hpke-js": "cd npm/packages/hpke-js && bun link",
|
174 | 233 | "bun-link:ml-kem": "cd npm/packages/ml-kem && bun link",
|
175 |
| - "sample": "deno task sample:deno && deno task sample:node", |
| 234 | + |
| 235 | + // === SAMPLE EXECUTION TASKS === |
| 236 | + "sample": { |
| 237 | + "description": "Run sample code demonstrations for Deno and Node.js environments", |
| 238 | + "command": "deno task sample:deno && deno task sample:node" |
| 239 | + }, |
176 | 240 | "sample:deno": "deno task sample:deno:core && deno task sample:deno:chacha20poly1305 && deno task sample:deno:dhkem-x25519 && deno task sample:deno:dhkem-x448 && deno task sample:deno:dhkem-secp256k1 && deno task sample:deno:hybridkem-x-wing && deno task sample:deno:hpke-js && deno task sample:deno:ml-kem",
|
177 | 241 | "sample:deno:core": "cd packages/core && deno task sample:deno",
|
178 | 242 | "sample:deno:chacha20poly1305": "cd packages/chacha20poly1305 && deno task sample:deno",
|
|
191 | 255 | "sample:node:hybridkem-x-wing": "cd npm && npm run test -w samples/hybridkem-x-wing",
|
192 | 256 | "sample:node:hpke-js": "cd npm && npm run test -w samples/hpke-js",
|
193 | 257 | "sample:node:ml-kem": "cd npm && npm run test -w samples/ml-kem",
|
194 |
| - "update": "deno task update:cloudflare && deno task update:browsers && deno task update:bun", |
| 258 | + |
| 259 | + // === DEPENDENCY MANAGEMENT === |
| 260 | + "update": { |
| 261 | + "description": "Update dependencies for all test environments (Cloudflare, browsers, Bun)", |
| 262 | + "command": "deno task update:cloudflare && deno task update:browsers && deno task update:bun" |
| 263 | + }, |
195 | 264 | "update:cloudflare": "deno task update:cloudflare:core && deno task update:cloudflare:chacha20poly1305 && deno task update:cloudflare:dhkem-x25519 && deno task update:cloudflare:dhkem-x448 && deno task update:cloudflare:dhkem-secp256k1 && deno task update:cloudflare:hybridkem-x-wing && deno task update:cloudflare:hpke-js && deno task update:cloudflare:ml-kem",
|
196 | 265 | "update:cloudflare:core": "cd packages/core/test/runtimes/cloudflare && npm update && npm audit fix --force && ncu && ncu -u && rm package-lock.json",
|
197 | 266 | "update:cloudflare:chacha20poly1305": "cd packages/chacha20poly1305/test/runtimes/cloudflare && npm update && npm audit fix --force && ncu && ncu -u && rm package-lock.json",
|
|
219 | 288 | "update:bun:hybridkem-x-wing": "cd packages/hybridkem-x-wing/test/runtimes/bun && bun update",
|
220 | 289 | "update:bun:hpke-js": "cd packages/hpke-js/test/runtimes/bun && bun update",
|
221 | 290 | "update:bun:ml-kem": "cd packages/ml-kem/test/runtimes/bun && bun update",
|
222 |
| - "minify": "deno task minify:common && deno task minify:core && deno task minify:chacha20poly1305 && deno task minify:dhkem-x25519 && deno task minify:dhkem-x448 && deno task minify:dhkem-secp256k1 && deno task minify:hybridkem-x-wing && deno task minify:hpke-js && deno task minify:ml-kem", |
| 291 | + |
| 292 | + // === BUILD AND DISTRIBUTION === |
| 293 | + "minify": { |
| 294 | + "description": "Create minified bundles for all packages for browser distribution", |
| 295 | + "command": "deno task minify:common && deno task minify:core && deno task minify:chacha20poly1305 && deno task minify:dhkem-x25519 && deno task minify:dhkem-x448 && deno task minify:dhkem-secp256k1 && deno task minify:hybridkem-x-wing && deno task minify:hpke-js && deno task minify:ml-kem" |
| 296 | + }, |
223 | 297 | "minify:common": "cd packages/common && deno task minify > ../../npm/packages/common/hpke-common.min.js",
|
224 | 298 | "minify:core": "cd packages/core && deno task minify > ../../npm/packages/core/hpke-core.min.js",
|
225 | 299 | "minify:chacha20poly1305": "cd packages/chacha20poly1305 && deno task minify > ../../npm/packages/chacha20poly1305/hpke-chacha20poly1305.min.js",
|
|
229 | 303 | "minify:hybridkem-x-wing": "cd packages/hybridkem-x-wing && deno task minify > ../../npm/packages/hybridkem-x-wing/hpke-hybridkem-x-wing.min.js",
|
230 | 304 | "minify:hpke-js": "cd packages/hpke-js && deno task minify > ../../npm/packages/hpke-js/hpke-js.min.js",
|
231 | 305 | "minify:ml-kem": "cd packages/ml-kem && deno task minify > ../../npm/packages/ml-kem/hpke-ml-kem.min.js",
|
232 |
| - "dry-publish": "deno task dry-publish:common && deno task dry-publish:core && deno task dry-publish:chacha20poly1305 && deno task dry-publish:dhkem-x25519 && deno task dry-publish:dhkem-x448 && deno task dry-publish:dhkem-secp256k1 && deno task dry-publish:hybridkem-x-wing && deno task dry-publish:hpke-js && deno task dry-publish:ml-kem", |
| 306 | + "dry-publish": { |
| 307 | + "description": "Test package publishing process without actually publishing", |
| 308 | + "command": "deno task dry-publish:common && deno task dry-publish:core && deno task dry-publish:chacha20poly1305 && deno task dry-publish:dhkem-x25519 && deno task dry-publish:dhkem-x448 && deno task dry-publish:dhkem-secp256k1 && deno task dry-publish:hybridkem-x-wing && deno task dry-publish:hpke-js && deno task dry-publish:ml-kem" |
| 309 | + }, |
233 | 310 | "dry-publish:common": "cd npm/packages/common && npm pack --dry-run",
|
234 | 311 | "dry-publish:core": "cd npm/packages/core && npm pack --dry-run",
|
235 | 312 | "dry-publish:chacha20poly1305": "cd npm/packages/chacha20poly1305 && npm pack --dry-run",
|
|
239 | 316 | "dry-publish:hybridkem-x-wing": "cd npm/packages/hybridkem-x-wing && npm pack --dry-run",
|
240 | 317 | "dry-publish:hpke-js": "cd npm/packages/hpke-js && npm pack --dry-run",
|
241 | 318 | "dry-publish:ml-kem": "cd npm/packages/ml-kem && npm pack --dry-run",
|
242 |
| - "update-lock": "deno cache --reload **/deno.json --config deno.json" |
| 319 | + |
| 320 | + // === MAINTENANCE TASKS === |
| 321 | + "update-lock": { |
| 322 | + "description": "Update Deno lock file by reloading all dependencies", |
| 323 | + "command": "deno cache --reload **/deno.json --config deno.jsonc" |
| 324 | + } |
243 | 325 | }
|
244 | 326 | }
|
0 commit comments