diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..13294e1 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,38 @@ +name: "Build & Test" + +on: + push: + branches: [main] + pull_request: + branches: ['*'] + workflow_dispatch: + +jobs: + start: + name: Build & Test (Node.JS v${{ matrix.node }}) + runs-on: ubuntu-latest + + strategy: + matrix: + node: [ 22, 21, 20, 19, 18, 17, 16 ] + + steps: + - name: Basic (1/1) - Checkout Project + uses: actions/checkout@v4 + + - name: Node.JS (1/2) - Installing + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + + - name: Node.JS (2/2) - NPM Modules Installing + run: | + npm install + + - name: Build (1/2) - TypeScript Compilation + run: npm run build + + - name: Build (2/2) - Launch Test + run: | + npm run test + \ No newline at end of file diff --git a/README.md b/README.md index c43177a..630da3e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ # Nester +![Build & Test](https://github.com/bsnext/nester/actions/workflows/main.yml/badge.svg) +![Node.JS Supported](https://badgen.net/static/Node.JS/%3E=16.0.0/green) +![Install Size](https://badgen.net/packagephobia/install/@bsnext/nester) +![Dependencies](https://badgen.net/bundlephobia/dependency-count/@bsnext/nester) +![License](https://badgen.net/static/license/MIT/blue) + Short library for transform objects with "raw-string" keys. ``` diff --git a/dist/test/index.js b/dist/test/index.js index 5c31d61..2843fd5 100644 --- a/dist/test/index.js +++ b/dist/test/index.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const uvu_1 = require("uvu"); const assert = require("uvu/assert"); const __1 = require(".."); -const nester = new __1.default(true); +const nester = new __1.default(); (0, uvu_1.test)('Simple Test #1 (String)', () => { const result = nester.transform({ "varname": "varvalue" diff --git a/dist/test/index.js.map b/dist/test/index.js.map index cd30c7e..7c68805 100644 --- a/dist/test/index.js.map +++ b/dist/test/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":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J;QACD,WAAW,EAAE,IAAI;QACjB,MAAM,EAAE,IAAI;QACZ,eAAe,EAAE,IAAI;QACrB,eAAe,EAAE,IAAI;QACrB,eAAe,EAAE,KAAK;QACtB,eAAe,EAAE;YACb,QAAQ,EAAE,UAAU;SACvB;KACJ,CAAC,CAAC;IAEH,MAAM,CAAC,KAAK,CAAC,MAAM,EACf;QACI,KAAK,EAAE;YACH,QAAQ,EAAE;gBACN,OAAO,EAAE;oBACL,MAAM,EAAE,GAAG;oBACX,OAAO,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI;wBAChC;4BACI,UAAU,EAAE;gCACR,IAAI,EAAE;oCACF,OAAO,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;iCACtD;6BACJ;yBACJ;qBACJ;iBACJ;aACJ;SACJ;QACD,MAAM,EAAE;YACJ,MAAM,EAAE,IAAI;SACf;QACD,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE;YACJ,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS;gBAC7C;oBACI,UAAU,EAAE,UAAU;iBACzB;aACJ;SACJ;KACJ,CACJ,CAAC;AACN,CAAC,CAAC,CAAC;AAIH,UAAI,CAAC,GAAG,EAAE,CAAC"} \ No newline at end of file diff --git a/package.json b/package.json index 1899bf0..1692b3b 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,10 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { - "example": "npm run build && node dist/example/index.js", - "start": "npm run build && node dist/index.js", - "test": "npm run build && node dist/test/index.js", - "bench": "npm run build && node dist/benchmark/index.js", + "example": "node dist/example/index.js", + "start": "node dist/index.js", + "test": "node dist/test/index.js", + "bench": "node dist/benchmark/index.js", "build": "tsc --project tsconfig.json", "watch": "tsc --watch" }, diff --git a/src/test/index.ts b/src/test/index.ts index 2f2f5d8..58e75f7 100644 --- a/src/test/index.ts +++ b/src/test/index.ts @@ -4,7 +4,7 @@ import * as assert from 'uvu/assert'; //////////////////////////////// import Nester from '..'; -const nester = new Nester(true); +const nester = new Nester(); ////////////////////////////////