Skip to content

Commit

Permalink
Merge pull request #439 from dajiaji/refine-deno-task-sample-node
Browse files Browse the repository at this point in the history
Refine deno task sample:node.
  • Loading branch information
dajiaji authored Oct 18, 2024
2 parents 9d67bd5 + a982d7f commit 8a320ef
Show file tree
Hide file tree
Showing 19 changed files with 153 additions and 81 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ docs/

# npm files generated by dnt
npm/packages
npm/samples

# Gatsby files
.cache/
Expand Down
14 changes: 7 additions & 7 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@
"sample:deno:hybridkem-x25519-kyber768": "cd packages/hybridkem-x25519-kyber768 && deno task sample:deno",
"sample:deno:hpke-js": "cd packages/hpke-js && deno task sample:deno",
"sample:node": "deno task sample:node:core && deno task sample:node:chacha20poly1305 && deno task sample:node:dhkem-x25519 && deno task sample:node:dhkem-x448 && deno task sample:node:dhkem-secp256k1 && deno task sample:node:hybridkem-x25519-kyber768 && deno task sample:node:hpke-js",
"sample:node:core": "cd packages/core && deno task sample:node",
"sample:node:chacha20poly1305": "cd packages/chacha20poly1305 && deno task sample:node",
"sample:node:dhkem-x25519": "cd packages/dhkem-x25519 && deno task sample:node",
"sample:node:dhkem-x448": "cd packages/dhkem-x448 && deno task sample:node",
"sample:node:dhkem-secp256k1": "cd packages/dhkem-secp256k1 && deno task sample:node",
"sample:node:hybridkem-x25519-kyber768": "cd packages/hybridkem-x25519-kyber768 && deno task sample:node",
"sample:node:hpke-js": "cd packages/hpke-js && deno task sample:node",
"sample:node:core": "cd npm && npm run test -w samples/core",
"sample:node:chacha20poly1305": "cd npm && npm run test -w samples/chacha20poly1305",
"sample:node:dhkem-x25519": "cd npm && npm run test -w samples/dhkem-x25519",
"sample:node:dhkem-x448": "cd npm && npm run test -w samples/dhkem-x448",
"sample:node:dhkem-secp256k1": "cd npm && npm run test -w samples/dhkem-secp256k1",
"sample:node:hybridkem-x25519-kyber768": "cd npm && npm run test -w samples/hybridkem-x25519-kyber768",
"sample:node:hpke-js": "cd npm && npm run test -w samples/hpke-js",
"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-x25519-kyber768 || deno task update:cloudflare:hpke-js",
"update:cloudflare:core": "cd packages/core/test/runtimes/cloudflare && npm audit fix",
"update:cloudflare:chacha20poly1305": "cd packages/chacha20poly1305/test/runtimes/cloudflare && npm audit fix",
Expand Down
141 changes: 69 additions & 72 deletions npm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"packages/dhkem-secp256k1",
"packages/hybridkem-x25519-kyber768",
"packages/hpke-js",
"../**/*/samples/node"
"samples/**/*"
]
}
1 change: 0 additions & 1 deletion packages/chacha20poly1305/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"cov": "deno coverage ./coverage --lcov --exclude='test'",
"dnt": "deno run --import-map=../../npm/import_map.json -A dnt.ts",
"sample:deno": "cd samples/deno && deno run main.ts",
"sample:node": "cd samples/node && npm install && node app.js",
"minify": "esbuild ../../npm/packages/chacha20poly1305/esm/mod.js --bundle --format=esm --minify"
}
}
9 changes: 9 additions & 0 deletions packages/chacha20poly1305/dnt.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { build, emptyDir } from "@deno/dnt";

await emptyDir("../../npm/packages/chacha20poly1305");
await emptyDir("../../npm/samples/chacha20poly1305");
await emptyDir("test/runtimes/browsers/node_modules");
await emptyDir("test/runtimes/bun/node_modules");
await emptyDir("test/runtimes/cloudflare/node_modules");
Expand Down Expand Up @@ -70,3 +71,11 @@ Deno.copyFileSync(
"README.md",
"../../npm/packages/chacha20poly1305/README.md",
);
Deno.copyFileSync(
"samples/node/app.js",
"../../npm/samples/chacha20poly1305/app.js",
);
Deno.copyFileSync(
"samples/node/package.json",
"../../npm/samples/chacha20poly1305/package.json",
);
3 changes: 3 additions & 0 deletions packages/chacha20poly1305/samples/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"main": "app.js",
"author": "Ajitomi Daisuke <[email protected]> (https://github.com/dajiaji)",
"license": "MIT",
"scripts": {
"test": "node app.js"
},
"dependencies": {
"@hpke/chacha20poly1305": "^1.4.3",
"@hpke/core": "^1.4.3"
Expand Down
6 changes: 6 additions & 0 deletions packages/core/dnt.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { build, emptyDir } from "@deno/dnt";

await emptyDir("../../npm/packages/core");
await emptyDir("../../npm/samples/core");
await emptyDir("test/runtimes/browsers/node_modules");
await emptyDir("test/runtimes/bun/node_modules");
await emptyDir("test/runtimes/cloudflare/node_modules");
Expand Down Expand Up @@ -65,3 +66,8 @@ await build({
// post build steps
Deno.copyFileSync("LICENSE", "../../npm/packages/core/LICENSE");
Deno.copyFileSync("README.md", "../../npm/packages/core/README.md");
Deno.copyFileSync("samples/node/app.js", "../../npm/samples/core/app.js");
Deno.copyFileSync(
"samples/node/package.json",
"../../npm/samples/core/package.json",
);
3 changes: 3 additions & 0 deletions packages/core/samples/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"main": "app.js",
"author": "Ajitomi Daisuke <[email protected]> (https://github.com/dajiaji)",
"license": "MIT",
"scripts": {
"test": "node app.js"
},
"dependencies": {
"@hpke/core": "^1.5.0"
}
Expand Down
9 changes: 9 additions & 0 deletions packages/dhkem-secp256k1/dnt.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { build, emptyDir } from "@deno/dnt";

await emptyDir("../../npm/packages/dhkem-secp256k1");
await emptyDir("../../npm/samples/dhkem-secp256k1");
await emptyDir("test/runtimes/browsers/node_modules");
await emptyDir("test/runtimes/bun/node_modules");
await emptyDir("test/runtimes/cloudflare/node_modules");
Expand Down Expand Up @@ -70,3 +71,11 @@ Deno.copyFileSync(
"README.md",
"../../npm/packages/dhkem-secp256k1/README.md",
);
Deno.copyFileSync(
"samples/node/app.js",
"../../npm/samples/dhkem-secp256k1/app.js",
);
Deno.copyFileSync(
"samples/node/package.json",
"../../npm/samples/dhkem-secp256k1/package.json",
);
3 changes: 3 additions & 0 deletions packages/dhkem-secp256k1/samples/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"main": "app.js",
"author": "Ajitomi Daisuke <[email protected]> (https://github.com/dajiaji)",
"license": "MIT",
"scripts": {
"test": "node app.js"
},
"dependencies": {
"@hpke/core": "^1.5.0",
"@hpke/dhkem-secp256k1": "^1.5.0"
Expand Down
9 changes: 9 additions & 0 deletions packages/dhkem-x25519/dnt.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { build, emptyDir } from "jsr:@deno/dnt";

await emptyDir("../../npm/packages/dhkem-x25519");
await emptyDir("../../npm/samples/dhkem-x25519");
await emptyDir("test/runtimes/browsers/node_modules");
await emptyDir("test/runtimes/bun/node_modules");
await emptyDir("test/runtimes/cloudflare/node_modules");
Expand Down Expand Up @@ -67,3 +68,11 @@ await build({
// post build steps
Deno.copyFileSync("LICENSE", "../../npm/packages/dhkem-x25519/LICENSE");
Deno.copyFileSync("README.md", "../../npm/packages/dhkem-x25519/README.md");
Deno.copyFileSync(
"samples/node/app.js",
"../../npm/samples/dhkem-x25519/app.js",
);
Deno.copyFileSync(
"samples/node/package.json",
"../../npm/samples/dhkem-x25519/package.json",
);
3 changes: 3 additions & 0 deletions packages/dhkem-x25519/samples/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"main": "app.js",
"author": "Ajitomi Daisuke <[email protected]> (https://github.com/dajiaji)",
"license": "MIT",
"scripts": {
"test": "node app.js"
},
"dependencies": {
"@hpke/core": "^1.5.0",
"@hpke/dhkem-x25519": "^1.5.0"
Expand Down
6 changes: 6 additions & 0 deletions packages/dhkem-x448/dnt.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { build, emptyDir } from "@deno/dnt";

await emptyDir("../../npm/packages/dhkem-x448");
await emptyDir("../../npm/samples/dhkem-x448");
await emptyDir("test/runtimes/browsers/node_modules");
await emptyDir("test/runtimes/bun/node_modules");
await emptyDir("test/runtimes/cloudflare/node_modules");
Expand Down Expand Up @@ -67,3 +68,8 @@ await build({
// post build steps
Deno.copyFileSync("LICENSE", "../../npm/packages/dhkem-x448/LICENSE");
Deno.copyFileSync("README.md", "../../npm/packages/dhkem-x448/README.md");
Deno.copyFileSync("samples/node/app.js", "../../npm/samples/dhkem-x448/app.js");
Deno.copyFileSync(
"samples/node/package.json",
"../../npm/samples/dhkem-x448/package.json",
);
3 changes: 3 additions & 0 deletions packages/dhkem-x448/samples/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"main": "app.js",
"author": "Ajitomi Daisuke <[email protected]> (https://github.com/dajiaji)",
"license": "MIT",
"scripts": {
"test": "node app.js"
},
"dependencies": {
"@hpke/core": "^1.4.3",
"@hpke/dhkem-x448": "^1.4.3"
Expand Down
6 changes: 6 additions & 0 deletions packages/hpke-js/dnt.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { build, emptyDir } from "@deno/dnt";

await emptyDir("../../npm/packages/hpke-js");
await emptyDir("../../npm/samples/hpke-js");
await emptyDir("test/runtimes/browsers/node_modules");
await emptyDir("test/runtimes/bun/node_modules");
await emptyDir("test/runtimes/cloudflare/node_modules");
Expand Down Expand Up @@ -71,3 +72,8 @@ await build({
// post build steps
Deno.copyFileSync("LICENSE", "../../npm/packages/hpke-js/LICENSE");
Deno.copyFileSync("README.md", "../../npm/packages/hpke-js/README.md");
Deno.copyFileSync("samples/node/app.js", "../../npm/samples/hpke-js/app.js");
Deno.copyFileSync(
"samples/node/package.json",
"../../npm/samples/hpke-js/package.json",
);
3 changes: 3 additions & 0 deletions packages/hpke-js/samples/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"main": "app.js",
"author": "Ajitomi Daisuke <[email protected]> (https://github.com/dajiaji)",
"license": "MIT",
"scripts": {
"test": "node app.js"
},
"dependencies": {
"hpke-js": "^1.5.0"
}
Expand Down
Loading

0 comments on commit 8a320ef

Please sign in to comment.