From a815b12bb26a2a6a9ff3f395aafd0f45fb0c3104 Mon Sep 17 00:00:00 2001 From: Alberto Ricart Date: Fri, 6 Dec 2024 14:55:23 -0600 Subject: [PATCH] Update package structure and configurations Consolidated code files and updated module types to align more closely with modern JavaScript standards. Changed file imports, adjusted TypeScript configurations, and updated the package versioning to maintain consistency across all modules. Additionally, revised the build and test scripts, enhancing cleaning processes and incorporating coverage testing functionalities. Signed-off-by: Alberto Ricart --- .github/workflows/deno.yml | 51 +++ .github/workflows/{natsjs.yml => node.yml} | 31 +- .github/workflows/npm.yml | 6 +- .gitignore | 4 +- README.md | 41 +- deno.json | 28 ++ esm/package.json | 3 - jsr.json | 14 - lib/nuid.js.map | 1 - lib/package.json | 3 - package-lock.json | 449 ++++++++------------- package.json | 41 +- test/basics_test.ts | 10 +- tsconfig.json | 8 +- typedoc.json | 2 +- 15 files changed, 310 insertions(+), 382 deletions(-) create mode 100644 .github/workflows/deno.yml rename .github/workflows/{natsjs.yml => node.yml} (56%) create mode 100644 deno.json delete mode 100644 esm/package.json delete mode 100644 jsr.json delete mode 100644 lib/nuid.js.map delete mode 100644 lib/package.json diff --git a/.github/workflows/deno.yml b/.github/workflows/deno.yml new file mode 100644 index 0000000..dc3a13c --- /dev/null +++ b/.github/workflows/deno.yml @@ -0,0 +1,51 @@ +name: test esm + +on: + push: + tags: + - "*" + branches: + - "*" + pull_request: + branches: [main] + +jobs: + test: + strategy: + matrix: + deno-version: [2.1.x] + + runs-on: ubuntu-latest + + permissions: + contents: read + id-token: write + + steps: + - name: Checkout nuid + uses: actions/checkout@v3 + with: + fetch-depth: 1 + - name: Use Deno Version ${{ matrix.deno-version }} + uses: denoland/setup-deno@v1 + with: + deno-version: ${{ matrix.deno-version }} + - name: lint + run: | + deno fmt --check src/ test/ + deno lint + + - name: test + env: + TMPDIR: ${{ runner.temp }} + CI: true + run: | + deno task clean + deno task test + deno task cover + + - name: Upload coverage + uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + file: ./coverage/out.lcov diff --git a/.github/workflows/natsjs.yml b/.github/workflows/node.yml similarity index 56% rename from .github/workflows/natsjs.yml rename to .github/workflows/node.yml index 8f7c57b..f09d97c 100644 --- a/.github/workflows/natsjs.yml +++ b/.github/workflows/node.yml @@ -1,11 +1,11 @@ -name: NUID CI +name: test cjs on: push: tags: - - '*' + - "*" branches: - - '*' + - "*" pull_request: branches: [main] @@ -14,7 +14,7 @@ jobs: strategy: matrix: node-version: [22.x] - deno-version: [1.43.5] + deno-version: [2.1.x] runs-on: ubuntu-latest @@ -31,17 +31,16 @@ jobs: uses: denoland/setup-deno@v1 with: deno-version: ${{ matrix.deno-version }} - - run: npm ci - - run: npm run prepack - - run: npm test + - name: lint + run: | + deno fmt --check src/ test/ + deno lint + + - name: test env: + TMPDIR: ${{ runner.temp }} CI: true -# - name: Gather coverage -# if: matrix.node-version == '21.x' -# run: npm run coveralls -# - name: Upload coverage -# uses: coverallsapp/github-action@v1.2.5 -# if: matrix.node-version == '21.x' -# with: -# github-token: ${{ secrets.github_token }} -# path-to-lcov: ./coverage/lcov.info + run: | + npm ci + npm run prepack + npm test diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml index 5ee235d..e95b332 100644 --- a/.github/workflows/npm.yml +++ b/.github/workflows/npm.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: node-version: [22.x] - deno-version: [1.43.5] + deno-version: [2.1.x] runs-on: ubuntu-latest permissions: @@ -43,7 +43,3 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npx jsr publish - - - - diff --git a/.gitignore b/.gitignore index 6a78061..c6f5429 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ esm/index.mjs -lib/nuid.d.ts -lib/nuid.js +lib/ +coverage/ # Dependency directories node_modules diff --git a/README.md b/README.md index 45aa5e6..dee9ac9 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,44 @@ # Nuid.js -[![license](https://img.shields.io/github/license/nats-io/node-nuid.svg)](https://www.apache.org/licenses/LICENSE-2.0) -[![npm](https://img.shields.io/npm/v/nuid.svg)](https://www.npmjs.com/package/nuid) -[![npm](https://img.shields.io/npm/dt/nuid.svg)](https://www.npmjs.com/package/nuid) -[![npm](https://img.shields.io/npm/dm/nuid.svg)](https://www.npmjs.com/package/nuid) +[![License](https://img.shields.io/badge/Licence-Apache%202.0-blue.svg)](./LICENSE) +![node](https://github.com/nats-io/nuid.js/actions/workflows/node.yml/badge.svg) +![deno](https://github.com/nats-io/nuid.js/actions/workflows/deno.yml/badge.svg) +[![coverage](https://coveralls.io/repos/github/nats-io/nuid.js/badge.svg?branch=main)](https://coveralls.io/github/nats-io/nuid.js?branch=main) +[![JSDoc](https://img.shields.io/badge/JSDoc-reference-blue)](https://nats-io.github.io/nuid.js/index.html) + +[![JSR](https://jsr.io/badges/@nats-io/nuid)](https://jsr.io/@nats-io/nuid.js) +[![JSR](https://jsr.io/badges/@nats-io/nuid/score)](https://jsr.io/@nats-io/nuid.js) + +[![npm](https://img.shields.io/npm/v/%40nats-io%2Fnuid)](https://www.npmjs.com/package/@nats-io/nuid.js) +[![npm](https://img.shields.io/npm/dt/%40nats-io%2Fnuid)](https://www.npmjs.com/package/@nats-io/nuid.js) +[![npm](https://img.shields.io/npm/dm/%40nats-io%2Fnuid)](https://www.npmjs.com/package/@nats-io/nuid.js) A highly performant unique identifier generator for JavaScript. ## Installation -Import the library for node/bun: +For web and deno you can use the JSR bundle: ```bash -npm install nuid +npx jsr add @nats-io/nuid +// or +deno add @nats-io/nuid ``` -For web and deno you can also: - -```bash -npx jsr add @nats-io/nuid +```typescript +import { next, Nuid } from "jsr:@nats-io/nuid"; ``` -## Basic Usage +import { next -Reference the library in your code. If using you can `import` or `require` the -npm nuid library supports both Common JS and ESM: +In node/bun: + +```bash +npm install nuid +``` ```javascript -const { nuid, Nuid } = require("nuid"); +const { next, Nuid } = require("nuid"); // or import { next, Nuid } from "nuid"; @@ -36,6 +47,8 @@ import { next, Nuid } from "nuid"; // `new Nuid()`. ``` +## Basic Usage + ```javascript // To generate a bunch of nuids: let id = nuid.next(); diff --git a/deno.json b/deno.json new file mode 100644 index 0000000..84667e1 --- /dev/null +++ b/deno.json @@ -0,0 +1,28 @@ +{ + "name": "@nats-io/nuid", + "version": "2.0.1", + "exports": { + ".": "./src/nuid.ts" + }, + "include": [ + "src/nuid.ts", + "LICENSE", + "README.md", + "MAINTAINERS.md", + "CODE-OF-CONDUCT.md" + ], + + "tasks": { + "clean": "rm -rf ./lib ./coverage", + "test-cover": "deno task clean && deno task test && deno task cover && deno task view-cover", + "test": "deno test -A --parallel --reload --coverage=coverage test/", + "cover": "deno coverage ./coverage --lcov > ./coverage/out.lcov", + "view-cover": "genhtml -o ./coverage/html ./coverage/out.lcov && open ./coverage/html/index.html" + }, + "fmt": { + "exclude": ["lib/", "docs/"] + }, + "lint": { + "exclude": ["lib/", "docs/"] + } +} diff --git a/esm/package.json b/esm/package.json deleted file mode 100644 index 3dbc1ca..0000000 --- a/esm/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "module" -} diff --git a/jsr.json b/jsr.json deleted file mode 100644 index b17e6f7..0000000 --- a/jsr.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "@nats-io/nuid", - "version": "2.0.1-1", - "exports": { - ".": "./src/nuid.ts" - }, - "include": [ - "src/nuid.ts", - "LICENSE", - "MAINTAINERS.md", - "README.md", - "CODE-OF-CONDUCT.md" - ] -} diff --git a/lib/nuid.js.map b/lib/nuid.js.map deleted file mode 100644 index 799ca54..0000000 --- a/lib/nuid.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"nuid.js","sourceRoot":"","sources":["../src/nuid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,YAAY,CAAC;;;AAEb,MAAM,MAAM,GAAG,sCAAsC,CAAC;AACtD,MAAM,IAAI,GAAG,EAAE,CAAC;AAChB,MAAM,MAAM,GA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,CAAC,OAAO,EAAE,CAAC;QACf,8CAA8C;QAC9C,OAAO,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACH,KAAK;QACH,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;CACF;AAnGD,oBAmGC;AAED;;GAEG;AACU,QAAA,IAAI,GAAS,IAAI,IAAI,EAAE,CAAC"} \ No newline at end of file diff --git a/lib/package.json b/lib/package.json deleted file mode 100644 index 5bbefff..0000000 --- a/lib/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "commonjs" -} diff --git a/package-lock.json b/package-lock.json index e552625..9853da7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,27 +1,86 @@ { - "name": "nuid", - "version": "2.0.0", - "lockfileVersion": 2, + "name": "@nats-io/nuid", + "version": "2.0.1-2", + "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "nuid", - "version": "2.0.0", + "name": "@nats-io/nuid", + "version": "2.0.1-2", "license": "Apache-2.0", "devDependencies": { "shx": "^0.3.4", - "typedoc": "^0.25.13", - "typescript": "^5.4.5" + "typedoc": "^0.27.3", + "typescript": "^5.7.2" }, "engines": { "node": ">= 18.x" } }, - "node_modules/ansi-sequence-parser": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz", - "integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==", - "dev": true + "node_modules/@gerrit0/mini-shiki": { + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-1.24.1.tgz", + "integrity": "sha512-PNP/Gjv3VqU7z7DjRgO3F9Ok5frTKqtpV+LJW1RzMcr2zpRk0ulhEWnbcNGXzPC7BZyWMIHrkfQX2GZRfxrn6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/engine-oniguruma": "^1.24.0", + "@shikijs/types": "^1.24.0", + "@shikijs/vscode-textmate": "^9.3.0" + } + }, + "node_modules/@shikijs/engine-oniguruma": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.24.0.tgz", + "integrity": "sha512-Eua0qNOL73Y82lGA4GF5P+G2+VXX9XnuUxkiUuwcxQPH4wom+tE39kZpBFXfUuwNYxHSkrSxpB1p4kyRW0moSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "1.24.0", + "@shikijs/vscode-textmate": "^9.3.0" + } + }, + "node_modules/@shikijs/types": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.24.0.tgz", + "integrity": "sha512-aptbEuq1Pk88DMlCe+FzXNnBZ17LCiLIGWAeCWhoFDzia5Q5Krx3DgnULLiouSdd6+LUM39XwXGppqYE0Ghtug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/vscode-textmate": "^9.3.0", + "@types/hast": "^3.0.4" + } + }, + "node_modules/@shikijs/vscode-textmate": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-9.3.0.tgz", + "integrity": "sha512-jn7/7ky30idSkd/O5yDBfAnVt+JJpepofP/POZ1iMOxK59cOfqIgg/Dj0eFsjOTMw+4ycJN0uhZH/Eb0bs/EUA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" }, "node_modules/balanced-match": { "version": "1.0.0", @@ -45,6 +104,19 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -96,11 +168,15 @@ "node": ">= 0.10" } }, - "node_modules/jsonc-parser": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", - "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", - "dev": true + "node_modules/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "uc.micro": "^2.0.0" + } }, "node_modules/lunr": { "version": "2.3.9", @@ -108,18 +184,31 @@ "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", "dev": true }, - "node_modules/marked": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", - "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "node_modules/markdown-it": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", "dev": true, - "bin": { - "marked": "bin/marked.js" + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" }, - "engines": { - "node": ">= 12" + "bin": { + "markdown-it": "bin/markdown-it.mjs" } }, + "node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "dev": true, + "license": "MIT" + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -165,6 +254,16 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -203,18 +302,6 @@ "node": ">=4" } }, - "node_modules/shiki": { - "version": "0.14.7", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.7.tgz", - "integrity": "sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==", - "dev": true, - "dependencies": { - "ansi-sequence-parser": "^1.1.0", - "jsonc-parser": "^3.2.0", - "vscode-oniguruma": "^1.7.0", - "vscode-textmate": "^8.0.0" - } - }, "node_modules/shx": { "version": "0.3.4", "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.4.tgz", @@ -232,24 +319,26 @@ } }, "node_modules/typedoc": { - "version": "0.25.13", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.13.tgz", - "integrity": "sha512-pQqiwiJ+Z4pigfOnnysObszLiU3mVLWAExSPf+Mu06G/qsc3wzbuM56SZQvONhHLncLUhYzOVkjFFpFfL5AzhQ==", + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.27.3.tgz", + "integrity": "sha512-oWT7zDS5oIaxYL5yOikBX4cL99CpNAZn6mI24JZQxsYuIHbtguSSwJ7zThuzNNwSE0wqhlfTSd99HgqKu2aQXQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { + "@gerrit0/mini-shiki": "^1.24.0", "lunr": "^2.3.9", - "marked": "^4.3.0", - "minimatch": "^9.0.3", - "shiki": "^0.14.7" + "markdown-it": "^14.1.0", + "minimatch": "^9.0.5", + "yaml": "^2.6.1" }, "bin": { "typedoc": "bin/typedoc" }, "engines": { - "node": ">= 16" + "node": ">= 18" }, "peerDependencies": { - "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x" + "typescript": "5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x" } }, "node_modules/typedoc/node_modules/brace-expansion": { @@ -257,15 +346,17 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } }, "node_modules/typedoc/node_modules/minimatch": { - "version": "9.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", - "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" }, @@ -277,10 +368,11 @@ } }, "node_modules/typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -289,256 +381,31 @@ "node": ">=14.17" } }, - "node_modules/vscode-oniguruma": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", - "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", - "dev": true - }, - "node_modules/vscode-textmate": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", - "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", - "dev": true + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "dev": true, + "license": "MIT" }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true - } - }, - "dependencies": { - "ansi-sequence-parser": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz", - "integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==", - "dev": true - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "interpret": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", - "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", - "dev": true - }, - "jsonc-parser": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", - "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", - "dev": true - }, - "lunr": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", - "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", - "dev": true - }, - "marked": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", - "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", - "dev": true - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", - "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", - "dev": true }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "node_modules/yaml": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.1.tgz", + "integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==", "dev": true, - "requires": { - "wrappy": "1" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", - "dev": true, - "requires": { - "resolve": "^1.1.6" - } - }, - "resolve": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz", - "integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - }, - "shelljs": { - "version": "0.8.5", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", - "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", - "dev": true, - "requires": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - } - }, - "shiki": { - "version": "0.14.7", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.7.tgz", - "integrity": "sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==", - "dev": true, - "requires": { - "ansi-sequence-parser": "^1.1.0", - "jsonc-parser": "^3.2.0", - "vscode-oniguruma": "^1.7.0", - "vscode-textmate": "^8.0.0" - } - }, - "shx": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.4.tgz", - "integrity": "sha512-N6A9MLVqjxZYcVn8hLmtneQWIJtp8IKzMP4eMnx+nqkvXoqinUPCbUFLp2UcWTEIUONhlk0ewxr/jaVGlc+J+g==", - "dev": true, - "requires": { - "minimist": "^1.2.3", - "shelljs": "^0.8.5" - } - }, - "typedoc": { - "version": "0.25.13", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.13.tgz", - "integrity": "sha512-pQqiwiJ+Z4pigfOnnysObszLiU3mVLWAExSPf+Mu06G/qsc3wzbuM56SZQvONhHLncLUhYzOVkjFFpFfL5AzhQ==", - "dev": true, - "requires": { - "lunr": "^2.3.9", - "marked": "^4.3.0", - "minimatch": "^9.0.3", - "shiki": "^0.14.7" + "license": "ISC", + "bin": { + "yaml": "bin.mjs" }, - "dependencies": { - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - }, - "minimatch": { - "version": "9.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", - "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - } + "engines": { + "node": ">= 14" } - }, - "typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", - "dev": true - }, - "vscode-oniguruma": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", - "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", - "dev": true - }, - "vscode-textmate": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", - "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", - "dev": true - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true } } } diff --git a/package.json b/package.json index 2751eee..02f17b6 100644 --- a/package.json +++ b/package.json @@ -1,24 +1,16 @@ { - "name": "nuid", - "version": "2.0.1-1", + "name": "@nats-io/nuid", + "version": "2.0.1", "description": "NUID - A highly performant unique identifier generator.", - "keywords": [ - "unique", - "identifier", - "generator" - ], + "main": "./lib/nuid.js", + "types": "./lib/nuid.d.ts", "files": [ "lib/", - "esm/", - "CODE-OF-CONDUCT.md", "LICENSE", - "MAINTAINERS.md" + "README.md", + "MAINTAINERS.md", + "CODE-OF-CONDUCT.md" ], - "types": "./lib/nuid.d.ts", - "exports": { - "require": "./lib/nuid.js", - "import": "./esm/index.mjs" - }, "homepage": "https://nats.io/nuid.js", "repository": { "type": "git", @@ -28,27 +20,28 @@ "url": "https://github.com/nats-io/nuid.js/issues" }, "license": "Apache-2.0", - "private": false, "author": { "name": "The NATS Authors" }, "contributors": [], - "main": "./index.js", "scripts": { - "clean": "shx rm -f esm/index.mjs lib/nuid.d.ts lib/nuid.js lib/nuid.js.map", - "build": "npm run clean && deno bundle src/nuid.ts esm/index.mjs && tsc", + "clean": "shx rm -Rf ./lib ./coverage", + "build": "npm run clean && tsc", "test": "npm run build && node --test test/basics.js && deno test", "doc": "rm -Rf ./docs && node_modules/.bin/typedoc --out ./docs/ && touch ./docs/.nojekyll", - "prepack": "npm run build", - "lint": "deno lint --ignore=docs/,debug/,lib/", - "fmt": "deno fmt src/ README.md MAINTAINERS.md CODE-OF-CONDUCT.md" + "prepack": "npm run build" }, "engines": { "node": ">= 18.x" }, + "keywords": [ + "unique", + "identifier", + "generator" + ], "devDependencies": { "shx": "^0.3.4", - "typescript": "^5.4.5", - "typedoc": "^0.25.13" + "typescript": "^5.7.2", + "typedoc": "^0.27.3" } } diff --git a/test/basics_test.ts b/test/basics_test.ts index 2d58699..cfe79e4 100644 --- a/test/basics_test.ts +++ b/test/basics_test.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import { Nuid, nuid } from "../esm/index.mjs"; +import { Nuid, nuid } from "../src/nuid.ts"; import { assert, assertEquals, @@ -68,8 +68,10 @@ Deno.test("constructor is exported", () => { }); Deno.test("versions", async () => { - const pkg = await import("../package.json", {with: {type: "json"}}); - const jsr = await import("../jsr.json", {with: {type: "json"}}); + const pkg = await import("../package.json", { with: { type: "json" } }); + const jsr = await import("../deno.json", { with: { type: "json" } }); assertEquals(pkg.default.version, jsr.default.version); +}); -}) +Deno.test("rand", () => { +}); diff --git a/tsconfig.json b/tsconfig.json index 4e42312..149ad2e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,9 +1,9 @@ { "compilerOptions": { - "target": "ES6", - "module": "CommonJS", - "outDir": "lib/", - "moduleResolution": "node", + "target": "esnext", + "module": "nodenext", + "outDir": "lib", + "moduleResolution": "nodenext", "sourceMap": true, "declaration": true, "allowJs": true, diff --git a/typedoc.json b/typedoc.json index 84e253e..aba9721 100644 --- a/typedoc.json +++ b/typedoc.json @@ -1,5 +1,5 @@ { - "readme": "none", + "readme": "README.md", "theme": "default", "out": "docs/", "entryPoints": ["src/nuid.ts"]