Skip to content

Commit

Permalink
Refine deno task sample:node.
Browse files Browse the repository at this point in the history
  • Loading branch information
dajiaji committed Oct 18, 2024
1 parent 9d67bd5 commit f42bf39
Show file tree
Hide file tree
Showing 18 changed files with 120 additions and 80 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/**/*"
]
}
3 changes: 3 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,5 @@ 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
3 changes: 3 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,5 @@ 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
3 changes: 3 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,5 @@ 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
3 changes: 3 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,5 @@ 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
3 changes: 3 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,5 @@ 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
3 changes: 3 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,5 @@ 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
3 changes: 3 additions & 0 deletions packages/hybridkem-x25519-kyber768/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/hybridkem-x25519-kyber768");
await emptyDir("../../npm/samples/hybridkem-x25519-kyber768");
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 @@ -73,3 +74,5 @@ Deno.copyFileSync(
"README.md",
"../../npm/packages/hybridkem-x25519-kyber768/README.md",
);
Deno.copyFileSync("samples/node/app.js", "../../npm/samples/hybridkem-x25519-kyber768/app.js");
Deno.copyFileSync("samples/node/package.json", "../../npm/samples/hybridkem-x25519-kyber768/package.json");
3 changes: 3 additions & 0 deletions packages/hybridkem-x25519-kyber768/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/hybridkem-x25519-kyber768": "^1.5.0"
Expand Down

0 comments on commit f42bf39

Please sign in to comment.