diff --git a/.changeset/perky-dragons-scream.md b/.changeset/perky-dragons-scream.md new file mode 100644 index 0000000..bc1635e --- /dev/null +++ b/.changeset/perky-dragons-scream.md @@ -0,0 +1,5 @@ +--- +"@oviirup/utils": minor +--- + +๐Ÿšš rename `assertions` to `guards` diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 74f6f34..ea9dbc1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,19 +9,22 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - - uses: oviirup/actions/bun@v1 + - uses: oven-sh/setup-bun@v2 + - run: bun install --frozen-lockfile - run: bun run typecheck lint: name: ๐Ÿงช lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - - uses: oviirup/actions/bun@v1 + - uses: oven-sh/setup-bun@v2 + - run: bun install --frozen-lockfile - run: bun run lint test: name: ๐Ÿงช test runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - - uses: oviirup/actions/bun@v1 + - uses: oven-sh/setup-bun@v2 + - run: bun install --frozen-lockfile - run: bun run test diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 0063366..dc97b4f 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -19,7 +19,9 @@ jobs: - name: ๐Ÿ”ท Checkout uses: actions/checkout@v7 - name: ๐ŸŸข Setup bun - uses: oviirup/actions/bun@v1 + uses: oven-sh/setup-bun@v2 + - name: ๐Ÿ“ฆ Install dependencies + run: bun install --frozen-lockfile - name: ๐Ÿ”ง Select changesets mode id: changesets-mode uses: changesets/action/select-mode@v2 @@ -35,7 +37,9 @@ jobs: - name: ๐Ÿ”ท Checkout uses: actions/checkout@v7 - name: ๐ŸŸข Setup bun - uses: oviirup/actions/bun@v1 + uses: oven-sh/setup-bun@v2 + - name: ๐Ÿ“ฆ Install dependencies + run: bun install --frozen-lockfile - name: ๐Ÿท๏ธ Update version id: version uses: changesets/action/version@v2 @@ -58,9 +62,16 @@ jobs: - name: ๐Ÿ”ท Checkout uses: actions/checkout@v7 - name: ๐ŸŸข Setup bun - uses: oviirup/actions/bun@v1 - - name: ๐Ÿ“ฆ Build - run: bun run build + uses: oven-sh/setup-bun@v2 + - name: ๐ŸŸก Setup node + uses: actions/setup-node@v5 + with: + node-version: 24 + package-manager-cache: false + - name: ๐Ÿ“ฆ Install dependencies & build + run: | + bun install --frozen-lockfile + bun run build - name: ๐Ÿ“ฆ Pack artifacts id: pack uses: changesets/action/pack@v2 @@ -76,12 +87,17 @@ jobs: - name: ๐Ÿ”ท Checkout uses: actions/checkout@v7 - name: ๐ŸŸข Setup bun - uses: oviirup/actions/bun@v1 + uses: oven-sh/setup-bun@v2 + - name: ๐ŸŸก Setup node + uses: actions/setup-node@v5 with: node-version: 24 registry-url: https://registry.npmjs.org/ - - name: ๐Ÿ“ฆ Build - run: bun run build + package-manager-cache: false + - name: ๐Ÿ“ฆ Install dependencies & build + run: | + bun install --frozen-lockfile + bun run build - name: โš™๏ธ Publish packages id: publish uses: changesets/action/publish@v2 diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..18c92ea --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v24 \ No newline at end of file diff --git a/README.md b/README.md index 3b9cf41..1922d63 100644 --- a/README.md +++ b/README.md @@ -50,9 +50,9 @@ string.toKebabCase("Hello World"); ## API -### Assertions +### Guards -Runtime type checks and a predicate helper. Available from `@oviirup/utils` and `@oviirup/utils/assertions`. +Runtime type checks and a predicate helper. Available from `@oviirup/utils` and `@oviirup/utils/guards`. - **`isDefined`** - Non-null and non-undefined - **`isString`**, **`isNumber`**, **`isInteger`**, **`isFloat`** - Primitive number and string checks diff --git a/src/array.ts b/src/array.ts index a56513f..302fd25 100644 --- a/src/array.ts +++ b/src/array.ts @@ -1,4 +1,4 @@ -import { isEmptyArray, isInteger, isTruthy } from "./assertions"; +import { isEmptyArray, isInteger, isTruthy } from "./guards"; import { Truthy } from "./types"; /** diff --git a/src/assertions.ts b/src/guards.ts similarity index 100% rename from src/assertions.ts rename to src/guards.ts diff --git a/src/index.ts b/src/index.ts index 8f576dd..82b1742 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ export * as array from "./array"; -export * from "./assertions"; +export * from "./guards"; export * from "./nanoid"; export * as number from "./number"; export * as object from "./object"; diff --git a/src/number.ts b/src/number.ts index ad95eee..cbfbb29 100644 --- a/src/number.ts +++ b/src/number.ts @@ -1,5 +1,5 @@ -import { isNumber, isObject } from "@/assertions"; -import { AbbreviateOptions, AbbreviationSymbols, Dictionary } from "@/types"; +import { isNumber, isObject } from "./guards"; +import { AbbreviateOptions, AbbreviationSymbols, Dictionary } from "./types"; /** * Checks if a number is within a range diff --git a/src/object.ts b/src/object.ts index f7173b7..c83012d 100644 --- a/src/object.ts +++ b/src/object.ts @@ -1,5 +1,5 @@ import { toArray } from "./array"; -import { isObject } from "./assertions"; +import { isObject } from "./guards"; import { Dictionary } from "./types"; /** diff --git a/src/promise.ts b/src/promise.ts index 610282b..a0601da 100644 --- a/src/promise.ts +++ b/src/promise.ts @@ -1,5 +1,5 @@ -import { Awaitable } from "@/types"; -import { isNumber } from "./assertions"; +import { isNumber } from "./guards"; +import { Awaitable } from "./types"; /** * Delays execution for a specified number of milliseconds diff --git a/src/string.ts b/src/string.ts index ec3f0a7..570d379 100644 --- a/src/string.ts +++ b/src/string.ts @@ -1,4 +1,4 @@ -import { isEmpty } from "@/assertions"; +import { isEmpty } from "./guards"; /** * Replace backslash to slash diff --git a/tests/array.test.ts b/tests/array.test.ts index 94aac8b..eb7b59b 100644 --- a/tests/array.test.ts +++ b/tests/array.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, test } from "bun:test"; -import * as array from "@/array"; +import * as array from "../src/array"; describe("array", () => { // biome-ignore format: off diff --git a/tests/assertions.test.ts b/tests/assertions.test.ts index 4eb8eb2..b977904 100644 --- a/tests/assertions.test.ts +++ b/tests/assertions.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, test } from "bun:test"; -import * as ast from "@/assertions"; +import * as ast from "../src/guards"; describe("assertions", () => { describe("isNumber", () => { diff --git a/tests/nanoid.test.ts b/tests/nanoid.test.ts index 1d0abcb..45d2005 100644 --- a/tests/nanoid.test.ts +++ b/tests/nanoid.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { charset, nanoid } from "@/nanoid"; +import { charset, nanoid } from "../src/nanoid"; describe("nanoid", () => { it("should be ready for 0 size", () => { diff --git a/tests/number.test.ts b/tests/number.test.ts index 450e5fa..0fc0b26 100644 --- a/tests/number.test.ts +++ b/tests/number.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { AbbreviationSymbols, abbreviate } from "@/number"; +import { AbbreviationSymbols, abbreviate } from "../src/number"; describe("abbreviate", () => { it.each([ diff --git a/tests/promise.test.ts b/tests/promise.test.ts index 25c39a5..4ff1b4e 100644 --- a/tests/promise.test.ts +++ b/tests/promise.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { retry, sleep, tryCatch } from "@/promise"; +import { retry, sleep, tryCatch } from "../src/promise"; describe("promise", () => { describe("sleep", () => { diff --git a/tests/string.test.ts b/tests/string.test.ts index 534293d..d7af370 100644 --- a/tests/string.test.ts +++ b/tests/string.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import * as string from "@/string"; +import * as string from "../src/string"; describe("string", () => { describe("truncate", () => { diff --git a/tsconfig.json b/tsconfig.json index e69d7dc..51c9819 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,6 @@ "moduleDetection": "force", "moduleResolution": "bundler", "noEmit": true, - "paths": { "@/*": ["./src/*"] }, "resolveJsonModule": true, "skipLibCheck": true, "strict": true,