Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

☕ Support JSR #64

Merged
merged 4 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/jsr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: jsr

env:
DENO_VERSION: 1.x

on:
push:
tags:
- "v*"

permissions:
contents: read
id-token: write

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: denoland/setup-deno@v1
with:
deno-version: ${{ env.DENO_VERSION }}
- name: Publish
run: |
deno run -A jsr:@david/[email protected]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider pinning the version of the jsr:@david/publish-on-tag action to ensure consistent behavior across runs.

-          deno run -A jsr:@david/[email protected]
+          deno run -A jsr:@david/[email protected]  # Pinning the version for consistency

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
deno run -A jsr:@david/[email protected]
deno run -A jsr:@david/[email protected] # Pinning the version for consistency

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# unknownutil

[![npm](http://img.shields.io/badge/available%20on-npm-lightgrey.svg?logo=npm&logoColor=white)](https://www.npmjs.com/package/unknownutil)
[![deno land](http://img.shields.io/badge/available%20on-deno.land/x-lightgrey.svg?logo=deno)](https://deno.land/x/unknownutil)
[![jsr](https://img.shields.io/jsr/v/%40core/unknownutil?logo=javascript&logoColor=white)](https://jsr.io/@core/unknownutil)
[![npm](https://img.shields.io/npm/v/unknownutil?logo=npm&logoColor=white)](https://www.npmjs.com/package/unknownutil)
[![denoland](https://img.shields.io/github/v/release/lambdalisue/deno-unknownutil?logo=deno&label=denoland)](https://github.com/lambdalisue/deno-unknownutil/releases)
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/unknownutil/mod.ts)
[![Test](https://github.com/lambdalisue/deno-unknownutil/workflows/Test/badge.svg)](https://github.com/lambdalisue/deno-unknownutil/actions?query=workflow%3ATest)
[![npm version](https://badge.fury.io/js/unknownutil.svg)](https://badge.fury.io/js/unknownutil)
[![test](https://github.com/lambdalisue/deno-unknownutil/workflows/Test/badge.svg)](https://github.com/lambdalisue/deno-unknownutil/actions?query=workflow%3ATest)
[![codecov](https://codecov.io/github/lambdalisue/deno-unknownutil/graph/badge.svg?token=pfbLRGU5AM)](https://codecov.io/github/lambdalisue/deno-unknownutil)

A utility pack for handling `unknown` type.
Expand Down
3 changes: 3 additions & 0 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"name": "@core/unknownutil",
"version": "0.0.0",
"exports": "./mod.ts",
Comment on lines +2 to +4
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package version specified as "0.0.0" seems incorrect based on the PR objectives, which mention integrating @lambdalisue/unknownutil version 3.16.3. Ensure the version number is updated accordingly.

-  "version": "0.0.0",
+  "version": "3.16.3",

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
"name": "@core/unknownutil",
"version": "0.0.0",
"exports": "./mod.ts",
"name": "@core/unknownutil",
"version": "3.16.3",
"exports": "./mod.ts",

"lock": false,
"imports": {
"https://deno.land/x/unknownutil@$MODULE_VERSION/": "./"
Expand Down
4 changes: 2 additions & 2 deletions is/_deprecated.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { UnionToIntersection } from "../_typeutil.ts";
import type { Predicate } from "./type.ts";
import { type isObjectOf } from "./factory.ts";
import { type GetMetadata, type WithMetadata } from "../metadata.ts";
import type { isObjectOf } from "./factory.ts";
import type { GetMetadata, WithMetadata } from "../metadata.ts";
import { isIntersectionOf, isUnionOf } from "./utility.ts";

type IsObjectOfMetadata = GetMetadata<ReturnType<typeof isObjectOf>>;
Expand Down
2 changes: 1 addition & 1 deletion is/_deprecated_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "https://deno.land/[email protected]/testing/snapshot.ts";
import { assertType } from "https://deno.land/[email protected]/testing/types.ts";
import { type Equal, stringify } from "./_testutil.ts";
import { type Predicate, type PredicateType } from "./type.ts";
import type { Predicate, PredicateType } from "./type.ts";
import { isBoolean, isNumber, isString } from "./core.ts";
import { isObjectOf } from "./factory.ts";
import is, { isAllOf, isOneOf } from "./_deprecated.ts";
Expand Down
2 changes: 1 addition & 1 deletion is/annotation_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "https://deno.land/[email protected]/testing/snapshot.ts";
import { assertType } from "https://deno.land/[email protected]/testing/types.ts";
import { type Equal, stringify } from "./_testutil.ts";
import { type Predicate } from "./type.ts";
import type { Predicate } from "./type.ts";
import {
isArray,
isAsyncFunction,
Expand Down
2 changes: 1 addition & 1 deletion is/core_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
assertStrictEquals,
} from "https://deno.land/[email protected]/assert/mod.ts";
import { stringify } from "./_testutil.ts";
import { type Predicate } from "./type.ts";
import type { Predicate } from "./type.ts";
import is, {
isAny,
isArray,
Expand Down
2 changes: 1 addition & 1 deletion is/factory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { FlatType } from "../_typeutil.ts";
import type { Predicate, PredicateType } from "./type.ts";
import { isOptionalOf, isReadonlyOf } from "./annotation.ts";
import { type isOptionalOf, isReadonlyOf } from "./annotation.ts";
import {
isAny,
isArray,
Expand Down
2 changes: 1 addition & 1 deletion is/factory_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "https://deno.land/[email protected]/testing/snapshot.ts";
import { assertType } from "https://deno.land/[email protected]/testing/types.ts";
import { type Equal, stringify } from "./_testutil.ts";
import { type Predicate } from "./type.ts";
import type { Predicate } from "./type.ts";
import { isOptionalOf } from "./annotation.ts";
import {
isArray,
Expand Down
2 changes: 1 addition & 1 deletion is/utility_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "https://deno.land/[email protected]/testing/snapshot.ts";
import { assertType } from "https://deno.land/[email protected]/testing/types.ts";
import { type Equal, stringify } from "./_testutil.ts";
import { type Predicate, type PredicateType } from "./type.ts";
import type { Predicate, PredicateType } from "./type.ts";
import { isOptionalOf } from "./annotation.ts";
import { isBoolean, isNumber, isString, isUndefined } from "./core.ts";
import { isObjectOf } from "./factory.ts";
Expand Down
8 changes: 3 additions & 5 deletions metadata.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import type { Predicate } from "./is/type.ts";
import { inspect } from "./inspect.ts";

const metadataKey = "__unknownutil_metadata";

/**
* A type that has metadata.
*/
export type WithMetadata<T> = {
[metadataKey]: T;
__unknownutil_metadata: T;
};

/**
Expand All @@ -21,7 +19,7 @@ export type GetMetadata<T> = T extends WithMetadata<infer M> ? M : never;
export function getMetadata<T>(v: unknown): T | undefined {
if (v == null) return undefined;
// deno-lint-ignore no-explicit-any
return (v as any)[metadataKey];
return (v as any).__unknownutil_metadata;
}

/**
Expand All @@ -44,7 +42,7 @@ export function setPredicateFactoryMetadata<
): P & WithMetadata<M> {
let cachedName: string | undefined;
return Object.defineProperties(pred, {
[metadataKey]: {
__unknownutil_metadata: {
value: metadata,
configurable: true,
},
Expand Down
Loading