From c1ee62b7a438420c51a449d0812f034ae263cde2 Mon Sep 17 00:00:00 2001 From: Alberto Ricart Date: Fri, 5 Jul 2024 15:32:55 -0500 Subject: [PATCH] [CHORE] generate npm bundles and docs --- .gitignore | 33 ++++++--------------------------- bin/cjs-fix-imports.ts | 2 +- core/package.json | 16 ++++++++-------- core/tsconfig.json | 4 ++-- core/typedoc.json | 2 +- deno.json | 2 +- jetstream/package.json | 15 ++++++++++----- jetstream/tsconfig.json | 4 ++-- jetstream/typedoc.json | 6 ++++++ kv/package.json | 15 ++++++++++----- kv/tsconfig.json | 15 +++++++++++++++ kv/typedoc.json | 6 ++++++ obj/package.json | 15 ++++++++++----- obj/tsconfig.json | 15 +++++++++++++++ obj/typedoc.json | 6 ++++++ services/package.json | 15 ++++++++++----- services/src/internal_mod.ts | 1 + services/src/mod.ts | 1 + services/tsconfig.json | 15 +++++++++++++++ services/typedoc.json | 6 ++++++ 20 files changed, 132 insertions(+), 62 deletions(-) create mode 100644 jetstream/typedoc.json create mode 100644 kv/tsconfig.json create mode 100644 kv/typedoc.json create mode 100644 obj/tsconfig.json create mode 100644 obj/typedoc.json create mode 100644 services/tsconfig.json create mode 100644 services/typedoc.json diff --git a/.gitignore b/.gitignore index 98fece37..9209362d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,41 +1,20 @@ -# Logs -npm-debug.log* - -# generated files .DS_Store -nats.js -jetstream.js -kv.js -os.js -svc.js +deno.lock +package-lock.json + +**/build/ +**/lib/ +**/node_modules/ -*.d.ts -nats.js.map -src/version.json -old_tests/ -examples/certs/ -.tsconfig debug/ .idea/ .vscode/ -# deno project file -settings.json -deno.lock # nyc test coverage -.nyc_output coverage/ -# Dependency directories -**/node_modules/ - -# Optional npm cache directory -.npm - # ide crud vcs.xml -# we copy package.json to read the version so ts, webpack, etc are happy -src/package.json diff --git a/bin/cjs-fix-imports.ts b/bin/cjs-fix-imports.ts index d8547a60..864c691a 100644 --- a/bin/cjs-fix-imports.ts +++ b/bin/cjs-fix-imports.ts @@ -57,7 +57,7 @@ if (!dirs.length || argv.h || argv.help) { // create out if not exist await Deno.lstat(out) .catch(async () => { - await Deno.mkdir(out); + await Deno.mkdir(out, { recursive: true }); }); // process each file - remove extensions from requires/import diff --git a/core/package.json b/core/package.json index 0a3f0097..c5441e0b 100644 --- a/core/package.json +++ b/core/package.json @@ -3,7 +3,7 @@ "version": "3.0.0-17", "files": [ "lib/", - "esm/" + "build/src/" ], "types": "./lib/mod.d.js", "exports": { @@ -13,11 +13,11 @@ "license": "Apache-2.0", "private": false, "scripts": { - "clean": "shx rm -Rf ./lib ./cjs ./esm ./docs && shx mkdir esm", - "pre-process": "npm run clean && deno run -A ../bin/cjs-fix-imports.ts -o ./cjs ./src", + "clean": "shx rm -Rf ./build ./lib ./docs", + "pre-process": "npm run clean && deno run -A ../bin/cjs-fix-imports.ts -o ./build/src ./src", "build-cjs": "npm run pre-process && tsc", "build": "npm run build-cjs", - "doc": "npm run clean && npm run build && node_modules/.bin/typedoc --out ./docs/ && touch ./docs/.nojekyll", + "doc": "npm run build && node_modules/.bin/typedoc --out ./docs/ && touch ./docs/.nojekyll", "prepack": "npm run build" }, "keywords": [], @@ -27,12 +27,12 @@ "description": "nats-core library - this library implements all the base functionality for NATS javascript clients", "dependencies": { "@nats-io/nkeys": "1.2.0-4", - "@nats-io/nuid": "2.0.1-2", - "shx": "^0.3.4", - "typescript": "^5.4.5" + "@nats-io/nuid": "2.0.1-2" }, "devDependencies": { "@types/node": "^20.11.30", - "typedoc": "^0.25.12" + "typedoc": "^0.25.12", + "shx": "^0.3.4", + "typescript": "^5.4.5" } } diff --git a/core/tsconfig.json b/core/tsconfig.json index 662a7648..8aa51b51 100644 --- a/core/tsconfig.json +++ b/core/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "target": "esnext", "module": "nodenext", - "outDir": "lib/", + "outDir": "./lib/", "moduleResolution": "nodenext", "sourceMap": true, "declaration": true, @@ -10,6 +10,6 @@ "removeComments": false }, "include": [ - "cjs/**/*" + "./build/src/**/*" ] } diff --git a/core/typedoc.json b/core/typedoc.json index 164c83bd..0aed8987 100644 --- a/core/typedoc.json +++ b/core/typedoc.json @@ -2,5 +2,5 @@ "readme": "./README.md", "theme": "default", "out": "./docs/", - "entryPoints": ["cjs/mod.ts"] + "entryPoints": ["build/src/mod.ts"] } diff --git a/deno.json b/deno.json index cc30292e..2f644d70 100644 --- a/deno.json +++ b/deno.json @@ -6,7 +6,7 @@ "test_helpers": "./test_helpers/mod.ts" }, "tasks": { - "clean": "rm -rf ./coverage/", + "clean": "rm -Rf ./coverage", "test": "deno task clean && deno task lint && deno task test-all", "test-all": "deno task test-core && deno task test-jetstream && deno task test-kv && deno task test-obj && deno task test-services && deno task test-unsafe", "test-unsafe": "deno test -A --parallel --reload --quiet --unsafely-ignore-certificate-errors --coverage=coverage core/unsafe_tests", diff --git a/jetstream/package.json b/jetstream/package.json index fa7fb933..4936611d 100644 --- a/jetstream/package.json +++ b/jetstream/package.json @@ -2,7 +2,8 @@ "name": "@nats-io/jetstream", "version": "3.0.0-3", "files": [ - "lib/" + "lib/", + "build/src/" ], "types": "./lib/mod.d.js", "exports": { @@ -12,11 +13,11 @@ "license": "Apache-2.0", "private": false, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "clean": "shx rm -Rf ./lib ./cjs ./esm && shx mkdir esm", - "pre-process": "npm run clean && deno run -A ../bin/cjs-fix-imports.ts -o ./cjs ./src", + "clean": "shx rm -Rf ./build ./lib ./docs", + "pre-process": "npm run clean && deno run -A ../bin/cjs-fix-imports.ts -o ./build/src ./src", "build-cjs": "npm run pre-process && tsc", "build": "npm run build-cjs", + "doc": "npm run build && node_modules/.bin/typedoc --out ./docs/ && touch ./docs/.nojekyll", "prepack": "npm run build" }, "keywords": [], @@ -25,7 +26,11 @@ }, "description": "jetstream library - this library implements all the base functionality for NATS JetStream for javascript clients", "dependencies": { - "@nats-io/nats-core": "3.0.0-17", + "@nats-io/nats-core": "3.0.0-17" + }, + "devDependencies": { + "@types/node": "^20.11.30", + "typedoc": "^0.25.12", "shx": "^0.3.4", "typescript": "^5.4.5" } diff --git a/jetstream/tsconfig.json b/jetstream/tsconfig.json index 662a7648..8aa51b51 100644 --- a/jetstream/tsconfig.json +++ b/jetstream/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "target": "esnext", "module": "nodenext", - "outDir": "lib/", + "outDir": "./lib/", "moduleResolution": "nodenext", "sourceMap": true, "declaration": true, @@ -10,6 +10,6 @@ "removeComments": false }, "include": [ - "cjs/**/*" + "./build/src/**/*" ] } diff --git a/jetstream/typedoc.json b/jetstream/typedoc.json new file mode 100644 index 00000000..0aed8987 --- /dev/null +++ b/jetstream/typedoc.json @@ -0,0 +1,6 @@ +{ + "readme": "./README.md", + "theme": "default", + "out": "./docs/", + "entryPoints": ["build/src/mod.ts"] +} diff --git a/kv/package.json b/kv/package.json index 133dce7d..b4b2f4b0 100644 --- a/kv/package.json +++ b/kv/package.json @@ -2,7 +2,8 @@ "name": "@nats-io/kv", "version": "3.0.0-2", "files": [ - "lib/" + "lib/", + "build/src/" ], "types": "./lib/mod.d.js", "exports": { @@ -12,11 +13,11 @@ "license": "Apache-2.0", "private": false, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "clean": "shx rm -Rf ./lib ./cjs ./esm && shx mkdir esm", - "pre-process": "npm run clean && deno run -A ../bin/cjs-fix-imports.ts -o ./cjs ./src", + "clean": "shx rm -Rf ./build ./lib ./docs", + "pre-process": "npm run clean && deno run -A ../bin/cjs-fix-imports.ts -o ./build/src ./src", "build-cjs": "npm run pre-process && tsc", "build": "npm run build-cjs", + "doc": "npm run build && node_modules/.bin/typedoc --out ./docs/ && touch ./docs/.nojekyll", "prepack": "npm run build" }, "keywords": [], @@ -26,7 +27,11 @@ "description": "kv library - this library implements all the base functionality for NATS KV javascript clients", "dependencies": { "@nats-io/nats-core": "3.0.0-17", - "@nats-io/jetstream": "3.0.0-3", + "@nats-io/jetstream": "3.0.0-3" + }, + "devDependencies": { + "@types/node": "^20.11.30", + "typedoc": "^0.25.12", "shx": "^0.3.4", "typescript": "^5.4.5" } diff --git a/kv/tsconfig.json b/kv/tsconfig.json new file mode 100644 index 00000000..8aa51b51 --- /dev/null +++ b/kv/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "nodenext", + "outDir": "./lib/", + "moduleResolution": "nodenext", + "sourceMap": true, + "declaration": true, + "allowJs": true, + "removeComments": false + }, + "include": [ + "./build/src/**/*" + ] +} diff --git a/kv/typedoc.json b/kv/typedoc.json new file mode 100644 index 00000000..0aed8987 --- /dev/null +++ b/kv/typedoc.json @@ -0,0 +1,6 @@ +{ + "readme": "./README.md", + "theme": "default", + "out": "./docs/", + "entryPoints": ["build/src/mod.ts"] +} diff --git a/obj/package.json b/obj/package.json index 39029277..bfd38cbe 100644 --- a/obj/package.json +++ b/obj/package.json @@ -2,7 +2,8 @@ "name": "@nats-io/obj", "version": "3.0.0-1", "files": [ - "lib/" + "lib/", + "build/src/" ], "types": "./lib/mod.d.js", "exports": { @@ -12,11 +13,11 @@ "license": "Apache-2.0", "private": false, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "clean": "shx rm -Rf ./lib ./cjs ./esm && shx mkdir esm", - "pre-process": "npm run clean && deno run -A ../bin/cjs-fix-imports.ts -o ./cjs ./src", + "clean": "shx rm -Rf ./build ./lib ./docs", + "pre-process": "npm run clean && deno run -A ../bin/cjs-fix-imports.ts -o ./build/src ./src", "build-cjs": "npm run pre-process && tsc", "build": "npm run build-cjs", + "doc": "npm run build && node_modules/.bin/typedoc --out ./docs/ && touch ./docs/.nojekyll", "prepack": "npm run build" }, "keywords": [], @@ -26,7 +27,11 @@ "description": "obj library - this library implements all the base functionality for NATS objectstore for javascript clients", "dependencies": { "@nats-io/nats-core": "3.0.0-17", - "@nats-io/jetstream": "3.0.0-3", + "@nats-io/jetstream": "3.0.0-3" + }, + "devDependencies": { + "@types/node": "^20.11.30", + "typedoc": "^0.25.12", "shx": "^0.3.4", "typescript": "^5.4.5" } diff --git a/obj/tsconfig.json b/obj/tsconfig.json new file mode 100644 index 00000000..8aa51b51 --- /dev/null +++ b/obj/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "nodenext", + "outDir": "./lib/", + "moduleResolution": "nodenext", + "sourceMap": true, + "declaration": true, + "allowJs": true, + "removeComments": false + }, + "include": [ + "./build/src/**/*" + ] +} diff --git a/obj/typedoc.json b/obj/typedoc.json new file mode 100644 index 00000000..0aed8987 --- /dev/null +++ b/obj/typedoc.json @@ -0,0 +1,6 @@ +{ + "readme": "./README.md", + "theme": "default", + "out": "./docs/", + "entryPoints": ["build/src/mod.ts"] +} diff --git a/services/package.json b/services/package.json index 54949222..49579528 100644 --- a/services/package.json +++ b/services/package.json @@ -2,7 +2,8 @@ "name": "@nats-io/services", "version": "3.0.0-1", "files": [ - "lib/" + "lib/", + "build/src/" ], "types": "./lib/mod.d.js", "exports": { @@ -12,11 +13,11 @@ "license": "Apache-2.0", "private": false, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "clean": "shx rm -Rf ./lib ./cjs ./esm && shx mkdir esm", - "pre-process": "npm run clean && deno run -A ../bin/cjs-fix-imports.ts -o ./cjs ./src", + "clean": "shx rm -Rf ./build ./lib ./docs", + "pre-process": "npm run clean && deno run -A ../bin/cjs-fix-imports.ts -o ./build/src ./src", "build-cjs": "npm run pre-process && tsc", "build": "npm run build-cjs", + "doc": "npm run build && node_modules/.bin/typedoc --out ./docs/ && touch ./docs/.nojekyll", "prepack": "npm run build" }, "keywords": [], @@ -25,7 +26,11 @@ }, "description": "services library - this library implements all the base functionality for NATS services for javascript clients", "dependencies": { - "@nats-io/nats-core": "3.0.0-17", + "@nats-io/nats-core": "3.0.0-17" + }, + "devDependencies": { + "@types/node": "^20.11.30", + "typedoc": "^0.25.12", "shx": "^0.3.4", "typescript": "^5.4.5" } diff --git a/services/src/internal_mod.ts b/services/src/internal_mod.ts index ae70d072..4b61e120 100644 --- a/services/src/internal_mod.ts +++ b/services/src/internal_mod.ts @@ -10,6 +10,7 @@ export type { EndpointStats, NamedEndpointStats, Service, + ServiceClient, ServiceConfig, ServiceGroup, ServiceHandler, diff --git a/services/src/mod.ts b/services/src/mod.ts index 3b858835..6e231d44 100644 --- a/services/src/mod.ts +++ b/services/src/mod.ts @@ -5,6 +5,7 @@ export type { EndpointStats, NamedEndpointStats, Service, + ServiceClient, ServiceConfig, ServiceGroup, ServiceHandler, diff --git a/services/tsconfig.json b/services/tsconfig.json new file mode 100644 index 00000000..8aa51b51 --- /dev/null +++ b/services/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "nodenext", + "outDir": "./lib/", + "moduleResolution": "nodenext", + "sourceMap": true, + "declaration": true, + "allowJs": true, + "removeComments": false + }, + "include": [ + "./build/src/**/*" + ] +} diff --git a/services/typedoc.json b/services/typedoc.json new file mode 100644 index 00000000..0aed8987 --- /dev/null +++ b/services/typedoc.json @@ -0,0 +1,6 @@ +{ + "readme": "./README.md", + "theme": "default", + "out": "./docs/", + "entryPoints": ["build/src/mod.ts"] +}