From 582428faf1d8ec30a4a9817f6f7659c1ceaa97ea Mon Sep 17 00:00:00 2001 From: hugoalh <32359235+hugoalh@users.noreply.github.com> Date: Wed, 8 May 2024 12:45:57 +0800 Subject: [PATCH] Update resources --- .dnt.ts | 10 +- .github/CONTRIBUTING.md | 7 - .../CODE_OF_CONDUCT.md => CODE_OF_CONDUCT.md | 0 CONTRIBUTING.md | 7 + README.md | 142 ++++-------------- SECURITY.md | 14 +- deno.jsonc | 11 +- jsr.jsonc | 5 +- mod.test.ts | 2 +- mod.ts | 4 +- npm/package.json | 2 +- 11 files changed, 62 insertions(+), 142 deletions(-) delete mode 100644 .github/CONTRIBUTING.md rename .github/CODE_OF_CONDUCT.md => CODE_OF_CONDUCT.md (100%) create mode 100644 CONTRIBUTING.md diff --git a/.dnt.ts b/.dnt.ts index 2a1e4be..50beb6b 100644 --- a/.dnt.ts +++ b/.dnt.ts @@ -1,9 +1,9 @@ -import { dirname as pathDirname } from "node:path"; import { transform, type TransformOutput } from "DNT/transform"; -import { copy as fsCopy } from "STD/fs/copy.ts"; -import { emptyDir } from "STD/fs/empty_dir.ts"; -import { ensureDir } from "STD/fs/ensure_dir.ts"; -import { walk as readDir, type WalkEntry } from "STD/fs/walk.ts"; +import { copy as fsCopy } from "STD/fs/copy"; +import { emptyDir } from "STD/fs/empty-dir"; +import { ensureDir } from "STD/fs/ensure-dir"; +import { walk as readDir, type WalkEntry } from "STD/fs/walk"; +import { dirname as pathDirname } from "node:path"; const pathsMain: WalkEntry[] = await Array.fromAsync(readDir(".")); const transformResult: TransformOutput = await transform({ entryPoints: ["mod.ts"], diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index 8cd119c..0000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,7 +0,0 @@ -# Contributing Guide - -This Contributing Guide is depend on ["hxhS (hugoalh & hugoalh Studio) Universal Contributing Guide"](https://github.com/hugoalh/hugoalh/blob/main/universal-guide/contributing.md), along with revise and take precedence over it. - -## Revise - -*N/A* diff --git a/.github/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md similarity index 100% rename from .github/CODE_OF_CONDUCT.md rename to CODE_OF_CONDUCT.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..759ca52 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,7 @@ +# Contributing Guide + +This Contributing Guide is depend on the "[hxhS (hugoalh & hugoalh Studio) Universal Contributing Guide](https://github.com/hugoalh/hugoalh/blob/main/universal-guide/contributing.md)", along with revises and take precedence over it. + +## Revises + +*This project does not have any revise.* diff --git a/README.md b/README.md index 81f2067..76d724e 100644 --- a/README.md +++ b/README.md @@ -8,127 +8,43 @@ An ES (JavaScript & TypeScript) module to dissect the string; Safe with the emojis, URLs, and words. -## ๐ŸŽฏ Target +## ๐Ÿ”ฐ Begin -- Bun ^ v1.0.0 -- Cloudflare Workers -- Deno >= v1.34.0 / >= v1.41.1 (For JSR Only) - > **๐Ÿ›ก๏ธ Require Permission** - > - > *N/A* -- NodeJS >= v20.9.0 +### ๐ŸŽฏ Targets -## ๐Ÿ”ฐ Usage - -### Via JSR With `node_modules` - -> **๐ŸŽฏ Supported Target** -> -> - Bun -> - Cloudflare Workers -> - NodeJS - -1. Install via: - - Bun - ```sh - bunx jsr add @hugoalh/string-dissect[@${Tag}] - ``` - - NPM - ```sh - npx jsr add @hugoalh/string-dissect[@${Tag}] - ``` - - PNPM - ```sh - pnpm dlx jsr add @hugoalh/string-dissect[@${Tag}] - ``` - - Yarn - ```sh - yarn dlx jsr add @hugoalh/string-dissect[@${Tag}] - ``` -2. Import at the script: - ```ts - import ... from "@hugoalh/string-dissect"; - ``` +| | **Registry - JSR** | **Registry - NPM** | **Remote Import** | +|:--|:--|:--|:--| +| **[Bun](https://bun.sh/)** >= v1.1.0 | [โœ”๏ธ `node_modules`](https://jsr.io/docs/npm-compatibility) | [โœ”๏ธ Specifier `npm:`](https://bun.sh/docs/runtime/autoimport) | โŒ | +| **[Cloudflare Workers](https://workers.cloudflare.com/)** | [โœ”๏ธ `node_modules`](https://jsr.io/docs/with/cloudflare-workers) | [โœ”๏ธ `node_modules`](https://docs.npmjs.com/using-npm-packages-in-your-projects) | โŒ | +| **[Deno](https://deno.land/)** >= v1.42.0 | [โœ”๏ธ Specifier `jsr:`](https://jsr.io/docs/with/deno) | [โœ”๏ธ Specifier `npm:`](https://docs.deno.com/runtime/manual/node/npm_specifiers) | [โœ”๏ธ](https://docs.deno.com/runtime/manual/basics/modules/#remote-import) | +| **[NodeJS](https://nodejs.org/)** >= v20.9.0 | [โœ”๏ธ `node_modules`](https://jsr.io/docs/with/node) | [โœ”๏ธ `node_modules`](https://docs.npmjs.com/using-npm-packages-in-your-projects) | โŒ | > **โ„น๏ธ Note** > -> - Although it is recommended to import the entire module, it is also able to import part of the module with sub path if available, please visit [file `jsr.jsonc`](./jsr.jsonc) property `exports` for available sub paths. -> - It is recommended to import the module with tag for immutability. +> It is possible to use this module in other methods/ways which not listed in here, however it is not officially supported. -### Via JSR With Specifier +### #๏ธโƒฃ Registries Identifier -> **๐ŸŽฏ Supported Target** -> -> - Deno - -1. Import at the script: - ```ts - import ... from "jsr:@hugoalh/string-dissect[@${Tag}]"; - ``` - -> **โ„น๏ธ Note** -> -> - Although it is recommended to import the entire module, it is also able to import part of the module with sub path if available, please visit [file `jsr.jsonc`](./jsr.jsonc) property `exports` for available sub paths. -> - It is recommended to import the module with tag for immutability. - -### Via NPM With `node_modules` - -> **๐ŸŽฏ Supported Target** -> -> - Cloudflare Workers -> - NodeJS - -1. Install via: - - NPM - ```sh - npm install @hugoalh/string-dissect[@${Tag}] - ``` - - PNPM - ```sh - pnpm add @hugoalh/string-dissect[@${Tag}] - ``` - - Yarn - ```sh - yarn add @hugoalh/string-dissect[@${Tag}] - ``` -2. Import at the script: - ```ts - import ... from "@hugoalh/string-dissect"; - ``` - -> **โ„น๏ธ Note** -> -> - Although it is recommended to import the entire module, it is also able to import part of the module with sub path if available, please visit [file `jsr.jsonc`](./jsr.jsonc) property `exports` for available sub paths. -> - It is recommended to import the module with tag for immutability. - -### Via NPM With Specifier - -> **๐ŸŽฏ Supported Target** -> -> - Bun -> - Deno - -1. Import at the script: - ```ts - import ... from "npm:@hugoalh/string-dissect[@${Tag}]"; - ``` +- **JSR:** + ``` + @hugoalh/string-dissect + ``` +- **NPM:** + ``` + @hugoalh/string-dissect + ``` > **โ„น๏ธ Note** > > - Although it is recommended to import the entire module, it is also able to import part of the module with sub path if available, please visit [file `jsr.jsonc`](./jsr.jsonc) property `exports` for available sub paths. -> - It is recommended to import the module with tag for immutability. +> - It is recommended to use this module with tag for immutability. -### Via Remote Import - -> **๐ŸŽฏ Supported Target** -> -> - Deno +### #๏ธโƒฃ Remote Import Paths -1. Import at the script: - ```ts - /* Via GitHub Raw (Require Tag) */ - import ... from "https://raw.githubusercontent.com/hugoalh-studio/string-dissect-es/${Tag}/mod.ts"; - ``` +- **GitHub Raw:** (Require Tag) + ``` + https://raw.githubusercontent.com/hugoalh-studio/string-dissect-es/${Tag}/mod.ts + ``` > **โ„น๏ธ Note** > @@ -141,7 +57,11 @@ An ES (JavaScript & TypeScript) module to dissect the string; Safe with the emoj > These elements are not considered part of the public API, thus no stability is guaranteed for them. > - Although there have 3rd party services which provide enhanced, equal, or similar methods/ways to remote import the module, beware these services maybe inject unrelated elements and thus affect the security. -## ๐Ÿงฉ API +### ๐Ÿ›ก๏ธ Permissions + +*This module does not require any permission.* + +## ๐Ÿงฉ APIs - ```ts class StringDissector { @@ -199,7 +119,7 @@ An ES (JavaScript & TypeScript) module to dissect the string; Safe with the emoj ``` - ```ts interface StringSegmentDescriptor { - type: StringSegmentType; + type: `${StringSegmentType}`; value: string; } ``` @@ -220,7 +140,7 @@ An ES (JavaScript & TypeScript) module to dissect the string; Safe with the emoj > - [Deno CLI `deno doc`](https://deno.land/manual/tools/documentation_generator) > - [JSR](https://jsr.io/@hugoalh/string-dissect) -## โœ๏ธ Example +## โœ๏ธ Examples - ```ts const sample1 = "Vel ex sit est sit est tempor enim et voluptua consetetur gubergren gubergren ut."; diff --git a/SECURITY.md b/SECURITY.md index e02cd73..8a0396c 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -13,12 +13,10 @@ > LTS("Long Term Support") > Maintenance("Maintenance") > EOL("End Of Life") -> Unstable --> Pre -> Pre --> Release -> subgraph Support +> Unstable --> Pre --> Release +> subgraph Supported > Release -- Major = 0 --> Maintenance -> Release -- Major > 0 --> LTS -> LTS --> Maintenance +> Release -- Major > 0 --> LTS --> Maintenance > end > Maintenance --> EOL > ``` @@ -32,10 +30,10 @@ > **โ„น๏ธ Note** > -> - The date format is according to ISO 8601 standard. +> - The date format is according to the specification ISO 8601. > - Values in italic format are subject to change. > - Versions which not in the list are also end of life. -## Report A Vulnerability +## Report Vulnerabilities -You can report a security vulnerability by [create a security vulnerability report](https://github.com/hugoalh/hugoalh/blob/main/universal-guide/contributing.md#create-a-security-vulnerability-report). +You can report security vulnerabilities by [create security vulnerability report](https://github.com/hugoalh/hugoalh/blob/main/universal-guide/contributing.md#create-a-security-vulnerability-report). diff --git a/deno.jsonc b/deno.jsonc index 8b41690..d124ff3 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -8,10 +8,10 @@ "singleQuote": false, "useTabs": true }, - "imports": { - // Only remap development dependencies! For more information, please visit https://docs.deno.com/runtime/manual/basics/import_maps. + "imports": { // IMPORTANT: Remap development dependencies only! "DNT": "jsr:@deno/dnt@0.41.1", - "STD/": "https://deno.land/std@0.222.1/" + "STD/assert": "jsr:@std/assert@0.224.0", + "STD/fs": "jsr:@std/fs@0.224.0" }, "lint": { "rules": { @@ -36,9 +36,10 @@ }, "lock": false, "tasks": { - // Check JSR package metadata. `deno publish` have weird behaviours, always check before release! For more information, please visit https://github.com/denoland/deno/issues/22648. + // Check JSR package metadata. `deno publish` maybe have different behaviours between different versions, always check before release! "jsr-check": "deno publish --allow-dirty --config jsr.jsonc --dry-run --no-provenance", // Build NPM package. "npm-build": "deno run --allow-all --deny-hrtime --no-prompt --quiet .dnt.ts" - } + }, + "unstable": [ ] } diff --git a/jsr.jsonc b/jsr.jsonc index fb66452..9f02100 100644 --- a/jsr.jsonc +++ b/jsr.jsonc @@ -1,7 +1,7 @@ -// This file is only for JSR related, non-JSR related must set in the file `deno.jsonc`! { + "$schema": "https://deno.land/x/deno/cli/schemas/config-file.v1.json", "name": "@hugoalh/string-dissect", - "version": "3.0.0", + "version": "3.0.1", "exports": { ".": "./mod.ts" }, @@ -27,6 +27,7 @@ "npm/**" ], "include": [ + "**/*.json", "**/*.ts", "**/*.tsx", "jsr.jsonc", diff --git a/mod.test.ts b/mod.test.ts index 15c08b2..9f113c4 100644 --- a/mod.test.ts +++ b/mod.test.ts @@ -1,4 +1,4 @@ -import { assertEquals } from "STD/assert/assert_equals.ts"; +import { assertEquals } from "STD/assert/assert-equals"; import { StringDissector } from "./mod.ts"; const sample1 = "Vel ex sit est sit est tempor enim et voluptua consetetur gubergren gubergren ut."; const sample2 = "๐Ÿค๐Ÿ’‘๐Ÿ’๐Ÿ‘ช๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ๐Ÿ‘ฉโ€๐Ÿ‘ฆ๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘"; diff --git a/mod.ts b/mod.ts index 5fe3164..887edde 100644 --- a/mod.ts +++ b/mod.ts @@ -46,7 +46,7 @@ export enum StringSegmentType { * String segment descriptor. */ export interface StringSegmentDescriptor { - type: StringSegmentType; + type: `${StringSegmentType}`; value: string; } /** @@ -62,7 +62,7 @@ export interface StringSegmentDescriptorExtend extends StringSegmentDescriptor { interface StringDissectSegmentByRegExpParameters { matcher: RegExp; segment: string; - type: StringSegmentType; + type: `${StringSegmentType}`; } /** * @access private diff --git a/npm/package.json b/npm/package.json index cb3b5a1..f0487d1 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "@hugoalh/string-dissect", - "version": "3.0.0", + "version": "3.0.1", "description": "A module to dissect the string; Safe with the emojis, URLs, and words.", "keywords": [ "dissect",