Skip to content

Commit 6aaaf91

Browse files
authored
base: use jsonc for deno.json. (#661)
1 parent f9788a7 commit 6aaaf91

File tree

6 files changed

+101
-19
lines changed

6 files changed

+101
-19
lines changed

.cursor/rules/deno-testing.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ alwaysApply: true
1313
- Use `@std/assert` for assertions
1414

1515
## Deno Task Usage
16-
- ALWAYS use the predefined Deno tasks from `deno.json` instead of running commands directly
16+
- ALWAYS use the predefined Deno tasks from `deno.jsonc` instead of running commands directly
1717
- Primary testing command: `deno task test:deno` for comprehensive testing
1818
- For specific package testing, use: `deno task test:deno:<package-name>`
1919

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
echo "$CHANGED_FILES"
4141
4242
# Run all tests if common, core, CI/CD files, or root files are changed
43-
if echo "$CHANGED_FILES" | grep -E '^(packages/(common|core)/|\.github/|deno\.json|\.gitignore|tsconfig\.json|npm/|utils/)'; then
43+
if echo "$CHANGED_FILES" | grep -E '^(packages/(common|core)/|\.github/|deno\.jsonc|\.gitignore|tsconfig\.json|npm/|utils/)'; then
4444
echo "run-all=true" >> $GITHUB_OUTPUT
4545
echo "packages=[]" >> $GITHUB_OUTPUT
4646
else

.github/workflows/ci_node.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
echo "$CHANGED_FILES"
3838
3939
# Run all tests if common, core, CI/CD files, or root files are changed
40-
if echo "$CHANGED_FILES" | grep -E '^(packages/(common|core)/|\.github/|deno\.json|\.gitignore|tsconfig\.json|npm/|utils/)'; then
40+
if echo "$CHANGED_FILES" | grep -E '^(packages/(common|core)/|\.github/|deno\.jsonc|\.gitignore|tsconfig\.json|npm/|utils/)'; then
4141
echo "run-all=true" >> $GITHUB_OUTPUT
4242
echo "packages=[]" >> $GITHUB_OUTPUT
4343
else

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"deno.enable": true,
33
"deno.lint": true,
4-
"deno.config": "../deno.json",
4+
"deno.config": "../deno.jsonc",
55
"[typescript]": {
66
"editor.defaultFormatter": "denoland.vscode-deno",
77
"editor.formatOnSave": true

deno.json renamed to deno.jsonc

Lines changed: 96 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
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
26
"workspace": [
37
"./packages/common",
48
"./packages/core",
@@ -19,6 +23,7 @@
1923
"./packages/ml-kem/samples/deno",
2024
"./utils"
2125
],
26+
// Import map for dependencies used across the project
2227
"imports": {
2328
"@dajiaji/mlkem": "jsr:@dajiaji/mlkem@^2.5.0",
2429
"@deno/dnt": "jsr:@deno/[email protected]",
@@ -29,7 +34,9 @@
2934
"@std/path": "jsr:@std/[email protected]",
3035
"@std/testing/bdd": "jsr:@std/[email protected]/bdd"
3136
},
37+
// Code formatting configuration
3238
"fmt": {
39+
// Exclude generated files and external dependencies
3340
"exclude": [
3441
"npm/",
3542
"packages/hybridkem-x25519-kyber768/",
@@ -39,7 +46,9 @@
3946
"coverage/"
4047
]
4148
},
49+
// Linting configuration
4250
"lint": {
51+
// Exclude same files as formatting
4352
"exclude": [
4453
"npm/",
4554
"packages/hybridkem-x25519-kyber768/",
@@ -49,7 +58,9 @@
4958
"coverage/"
5059
]
5160
},
61+
// Test configuration
5262
"test": {
63+
// Exclude non-test files and generated content
5364
"exclude": [
5465
"npm/",
5566
"packages/hybridkem-x25519-kyber768/",
@@ -60,8 +71,18 @@
6071
"coverage/"
6172
]
6273
},
74+
// Task definitions for development workflow
75+
// Main tasks use object format with descriptions, sub-tasks use string format for brevity
6376
"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
6586
"test:deno": "deno fmt && deno lint && deno task check && deno test --fail-fast --doc --coverage=coverage --parallel --allow-read",
6687
"test:deno:common": "cd packages/common && deno task test",
6788
"test:deno:core": "cd packages/core && deno task test",
@@ -72,6 +93,8 @@
7293
"test:deno:hybridkem-x-wing": "cd packages/hybridkem-x-wing && deno task test",
7394
"test:deno:hpke-js": "cd packages/hpke-js && deno task test",
7495
"test:deno:ml-kem": "cd packages/ml-kem && deno task test",
96+
97+
// Node.js environment testing (via DNT build)
7598
"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",
7699
"test:node:common": "cd packages/common && deno task dnt",
77100
"test:node:core": "cd packages/core && deno task dnt",
@@ -82,6 +105,8 @@
82105
"test:node:hybridkem-x-wing": "cd packages/hybridkem-x-wing && deno task dnt",
83106
"test:node:hpke-js": "cd packages/hpke-js && deno task dnt",
84107
"test:node:ml-kem": "cd packages/ml-kem && deno task dnt",
108+
109+
// Browser environment testing
85110
"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",
86111
"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",
87112
"test:browsers:prepare:npm": "cd npm && npx playwright install-deps && npx playwright install",
@@ -101,6 +126,8 @@
101126
"test:browsers:hybridkem-x-wing": "cd npm && npm run test -w test/hybridkem-x-wing/runtimes/browsers",
102127
"test:browsers:hpke-js": "cd npm && npm run test -w test/hpke-js/runtimes/browsers",
103128
"test:browsers:ml-kem": "cd npm && npm run test -w test/ml-kem/runtimes/browsers",
129+
130+
// Cloudflare Workers environment testing
104131
"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",
105132
"test:cloudflare:core": "cd npm && npm run test -w test/core/runtimes/cloudflare",
106133
"test:cloudflare:chacha20poly1305": "cd npm && npm run test -w test/chacha20poly1305/runtimes/cloudflare",
@@ -110,6 +137,8 @@
110137
"test:cloudflare:hybridkem-x-wing": "cd npm && npm run test -w test/hybridkem-x-wing/runtimes/cloudflare",
111138
"test:cloudflare:hpke-js": "cd npm && npm run test -w test/hpke-js/runtimes/cloudflare",
112139
"test:cloudflare:ml-kem": "cd npm && npm run test -w test/ml-kem/runtimes/cloudflare",
140+
141+
// Bun environment testing
113142
"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",
114143
"test:bun:core": "cd packages/core && deno task test:bun",
115144
"test:bun:chacha20poly1305": "cd packages/chacha20poly1305 && deno task test:bun",
@@ -119,8 +148,16 @@
119148
"test:bun:hybridkem-x-wing": "cd packages/hybridkem-x-wing && deno task test:bun",
120149
"test:bun:hpke-js": "cd packages/hpke-js && deno task test:bun",
121150
"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+
},
124161
"check:common": "cd packages/common && deno task check",
125162
"check:core": "cd packages/core && deno task check",
126163
"check:chacha20poly1305": "cd packages/chacha20poly1305 && deno task check",
@@ -130,9 +167,20 @@
130167
"check:hybridkem-x-wing": "cd packages/hybridkem-x-wing && deno task check",
131168
"check:hpke-js": "cd packages/hpke-js && deno task check",
132169
"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+
},
136184
"npm-build:common": "cd packages/common && deno task npm-build",
137185
"npm-build:core": "cd packages/core && deno task npm-build",
138186
"npm-build:chacha20poly1305": "cd packages/chacha20poly1305 && deno task npm-build",
@@ -142,7 +190,10 @@
142190
"npm-build:hybridkem-x-wing": "cd packages/hybridkem-x-wing && deno task npm-build",
143191
"npm-build:hpke-js": "cd packages/hpke-js && deno task npm-build",
144192
"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+
},
146197
"npm-link:common": "cd npm/packages/common && npm link",
147198
"npm-link:core": "cd npm/packages/core && npm link",
148199
"npm-link:chacha20poly1305": "cd npm/packages/chacha20poly1305 && npm link",
@@ -152,7 +203,10 @@
152203
"npm-link:hybridkem-x-wing": "cd npm/packages/hybridkem-x-wing && npm link",
153204
"npm-link:hpke-js": "cd npm/packages/hpke-js && npm link",
154205
"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+
},
156210
"npm-pack:common": "cd npm/packages/common && npm pack --dry-run",
157211
"npm-pack:core": "cd npm/packages/core && npm pack --dry-run",
158212
"npm-pack:chacha20poly1305": "cd npm/packages/chacha20poly1305 && npm pack --dry-run",
@@ -162,7 +216,12 @@
162216
"npm-pack:hybridkem-x-wing": "cd npm/packages/hybridkem-x-wing && npm pack --dry-run",
163217
"npm-pack:hpke-js": "cd npm/packages/hpke-js && npm pack --dry-run",
164218
"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+
},
166225
"bun-link:common": "cd npm/packages/common && bun link",
167226
"bun-link:core": "cd npm/packages/core && bun link",
168227
"bun-link:chacha20poly1305": "cd npm/packages/chacha20poly1305 && bun link",
@@ -172,7 +231,12 @@
172231
"bun-link:hybridkem-x-wing": "cd npm/packages/hybridkem-x-wing && bun link",
173232
"bun-link:hpke-js": "cd npm/packages/hpke-js && bun link",
174233
"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+
},
176240
"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",
177241
"sample:deno:core": "cd packages/core && deno task sample:deno",
178242
"sample:deno:chacha20poly1305": "cd packages/chacha20poly1305 && deno task sample:deno",
@@ -191,7 +255,12 @@
191255
"sample:node:hybridkem-x-wing": "cd npm && npm run test -w samples/hybridkem-x-wing",
192256
"sample:node:hpke-js": "cd npm && npm run test -w samples/hpke-js",
193257
"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+
},
195264
"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",
196265
"update:cloudflare:core": "cd packages/core/test/runtimes/cloudflare && npm update && npm audit fix --force && ncu && ncu -u && rm package-lock.json",
197266
"update:cloudflare:chacha20poly1305": "cd packages/chacha20poly1305/test/runtimes/cloudflare && npm update && npm audit fix --force && ncu && ncu -u && rm package-lock.json",
@@ -219,7 +288,12 @@
219288
"update:bun:hybridkem-x-wing": "cd packages/hybridkem-x-wing/test/runtimes/bun && bun update",
220289
"update:bun:hpke-js": "cd packages/hpke-js/test/runtimes/bun && bun update",
221290
"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+
},
223297
"minify:common": "cd packages/common && deno task minify > ../../npm/packages/common/hpke-common.min.js",
224298
"minify:core": "cd packages/core && deno task minify > ../../npm/packages/core/hpke-core.min.js",
225299
"minify:chacha20poly1305": "cd packages/chacha20poly1305 && deno task minify > ../../npm/packages/chacha20poly1305/hpke-chacha20poly1305.min.js",
@@ -229,7 +303,10 @@
229303
"minify:hybridkem-x-wing": "cd packages/hybridkem-x-wing && deno task minify > ../../npm/packages/hybridkem-x-wing/hpke-hybridkem-x-wing.min.js",
230304
"minify:hpke-js": "cd packages/hpke-js && deno task minify > ../../npm/packages/hpke-js/hpke-js.min.js",
231305
"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+
},
233310
"dry-publish:common": "cd npm/packages/common && npm pack --dry-run",
234311
"dry-publish:core": "cd npm/packages/core && npm pack --dry-run",
235312
"dry-publish:chacha20poly1305": "cd npm/packages/chacha20poly1305 && npm pack --dry-run",
@@ -239,6 +316,11 @@
239316
"dry-publish:hybridkem-x-wing": "cd npm/packages/hybridkem-x-wing && npm pack --dry-run",
240317
"dry-publish:hpke-js": "cd npm/packages/hpke-js && npm pack --dry-run",
241318
"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+
}
243325
}
244326
}

utils/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": "../deno.json"
2+
"extends": "../deno.jsonc"
33
}

0 commit comments

Comments
 (0)