diff --git a/.github/.nvmrc b/.github/.nvmrc index 48b14e6b..58a1f090 100644 --- a/.github/.nvmrc +++ b/.github/.nvmrc @@ -1 +1 @@ -20.14.0 +22.4.0 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ef3da96..6f71bb33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: with: tag: ${{ inputs.tag }} packageManager: pnpm - packageManagerVersion: 9.6.0 + packageManagerVersion: 9.10.0 stormBot: Stormie-Bot githubToken: ${{ github.token }} secrets: inherit diff --git a/lefthook.yml b/lefthook.yml index 3a2275d4..6b7d1461 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -40,17 +40,20 @@ pre-commit: # stage_fixed: true lint-toml: glob: "**/*.toml" - run: 'pnpm exec taplo format --check + run: + 'pnpm exec taplo format --check --config="./node_modules/@storm-software/linting-tools/taplo/.taplo.toml"' lint-filename: glob: "**/*.*" - run: 'pnpm exec ls-lint + run: + 'pnpm exec ls-lint --config="./node_modules/@storm-software/linting-tools/ls-lint/ls-lint.yml"' commit-msg: commands: validate: - run: 'pnpm exec commitlint + run: + 'pnpm exec commitlint --config="./node_modules/@storm-software/git-tools/commitlint/commitlint.config.cjs" --edit {1}' @@ -63,21 +66,24 @@ pre-push: stage_fixed: true format-prettier: glob: "!packages/workspace-tools/src/generators/*/files/**/*" - run: "pnpm exec prettier {staged_files} --write --ignore-unknown + run: + "pnpm exec prettier {staged_files} --write --ignore-unknown --no-error-on-unmatched-pattern --cache && git update-index" stage_fixed: true format-toml: glob: "**/*.toml" - run: 'pnpm exec taplo format - --config="./node_modules/@storm-software/linting-tools/taplo/.taplo.toml" && git - update-index' + run: + 'pnpm exec taplo format + --config="./node_modules/@storm-software/linting-tools/taplo/.taplo.toml" + && git update-index' format-readme: glob: "**/{README.md,package.json,executors.json,generators.json}" - run: 'pnpm exec storm-git readme-gen --templates="./tools/readme-templates"' + run: + 'pnpm exec storm-git readme-gen --templates="./tools/readme-templates"' stage_fixed: true build: glob: "**/*.*" - run: "pnpm build" + run: "pnpm build-all" stage_fixed: true validate: glob: "**/*.*" diff --git a/packages/errors/src/storm-error.ts b/packages/errors/src/storm-error.ts index d73a592c..09caa30a 100644 --- a/packages/errors/src/storm-error.ts +++ b/packages/errors/src/storm-error.ts @@ -19,6 +19,7 @@ import { Serializable } from "@storm-stack/serialization"; import { EMPTY_STRING, type Indexable, + MessageType, NEWLINE_STRING, isError, isFunction, @@ -169,6 +170,11 @@ export class StormError extends Error { */ public data?: any; + /** + * The type of error message + */ + public type: MessageType = MessageType.ERROR; + /** * Creates a new StormError instance * diff --git a/packages/unique-identifier/src/cuid.ts b/packages/unique-identifier/src/cuid.ts index e10a9059..86ad9289 100644 --- a/packages/unique-identifier/src/cuid.ts +++ b/packages/unique-identifier/src/cuid.ts @@ -1,3 +1,20 @@ +/*------------------------------------------------------------------- + + ⚡ Storm Software - Storm Stack + + This code was released as part of the Storm Stack project. Storm Stack + is maintained by Storm Software under the Apache-2.0 License, and is + free for commercial and private use. For more information, please visit + our licensing page. + + Website: https://stormsoftware.com + Repository: https://github.com/storm-software/storm-stack + Documentation: https://stormsoftware.com/projects/storm-stack/docs + Contact: https://stormsoftware.com/contact + License: https://stormsoftware.com/projects/storm-stack/license + + -------------------------------------------------------------------*/ + import { hash } from "@storm-stack/hashing"; import { randomLetter } from "./random"; @@ -33,9 +50,9 @@ function createEntropy(length = 4, random = Math.random) { let entropy = ""; while (entropy.length < length) { - entropy = - entropy + - Math.floor(random() * CUID_LARGE_LENGTH).toString(CUID_LARGE_LENGTH); + entropy += Math.floor(random() * CUID_LARGE_LENGTH).toString( + CUID_LARGE_LENGTH + ); } return entropy; } diff --git a/packages/unique-identifier/src/index.ts b/packages/unique-identifier/src/index.ts index 03ea34eb..924a7d0b 100644 --- a/packages/unique-identifier/src/index.ts +++ b/packages/unique-identifier/src/index.ts @@ -1,3 +1,20 @@ +/*------------------------------------------------------------------- + + ⚡ Storm Software - Storm Stack + + This code was released as part of the Storm Stack project. Storm Stack + is maintained by Storm Software under the Apache-2.0 License, and is + free for commercial and private use. For more information, please visit + our licensing page. + + Website: https://stormsoftware.com + Repository: https://github.com/storm-software/storm-stack + Documentation: https://stormsoftware.com/projects/storm-stack/docs + Contact: https://stormsoftware.com/contact + License: https://stormsoftware.com/projects/storm-stack/license + + -------------------------------------------------------------------*/ + export * from "./cuid"; export * from "./random"; export * from "./snowflake"; diff --git a/packages/unique-identifier/src/random.ts b/packages/unique-identifier/src/random.ts index 9c1bd1f7..76534582 100644 --- a/packages/unique-identifier/src/random.ts +++ b/packages/unique-identifier/src/random.ts @@ -1,3 +1,20 @@ +/*------------------------------------------------------------------- + + ⚡ Storm Software - Storm Stack + + This code was released as part of the Storm Stack project. Storm Stack + is maintained by Storm Software under the Apache-2.0 License, and is + free for commercial and private use. For more information, please visit + our licensing page. + + Website: https://stormsoftware.com + Repository: https://github.com/storm-software/storm-stack + Documentation: https://stormsoftware.com/projects/storm-stack/docs + Contact: https://stormsoftware.com/contact + License: https://stormsoftware.com/projects/storm-stack/license + + -------------------------------------------------------------------*/ + const alphabet = Array.from({ length: 26 }, (_x, i) => String.fromCodePoint(i + 97) ); diff --git a/packages/unique-identifier/src/snowflake.ts b/packages/unique-identifier/src/snowflake.ts index cee5f753..cf5d696e 100644 --- a/packages/unique-identifier/src/snowflake.ts +++ b/packages/unique-identifier/src/snowflake.ts @@ -1,3 +1,20 @@ +/*------------------------------------------------------------------- + + ⚡ Storm Software - Storm Stack + + This code was released as part of the Storm Stack project. Storm Stack + is maintained by Storm Software under the Apache-2.0 License, and is + free for commercial and private use. For more information, please visit + our licensing page. + + Website: https://stormsoftware.com + Repository: https://github.com/storm-software/storm-stack + Documentation: https://stormsoftware.com/projects/storm-stack/docs + Contact: https://stormsoftware.com/contact + License: https://stormsoftware.com/projects/storm-stack/license + + -------------------------------------------------------------------*/ + /** * Options passed to the `generate` function to create a snowflake identifier. */ @@ -145,8 +162,8 @@ export function snowflake({ : new Date(timestamp).valueOf(); let result = (BigInt(timestamp) - BigInt(epoch)) << BigInt(22); - result = result | (BigInt(shardId % 1024) << BigInt(12)); - result = result | BigInt(sequence++ % 4096); + result |= BigInt(shardId % 1024) << BigInt(12); + result |= BigInt(sequence++ % 4096); return result.toString(); } diff --git a/packages/unique-identifier/src/uuid.ts b/packages/unique-identifier/src/uuid.ts index af4cc58b..00f4dd30 100644 --- a/packages/unique-identifier/src/uuid.ts +++ b/packages/unique-identifier/src/uuid.ts @@ -1,3 +1,20 @@ +/*------------------------------------------------------------------- + + ⚡ Storm Software - Storm Stack + + This code was released as part of the Storm Stack project. Storm Stack + is maintained by Storm Software under the Apache-2.0 License, and is + free for commercial and private use. For more information, please visit + our licensing page. + + Website: https://stormsoftware.com + Repository: https://github.com/storm-software/storm-stack + Documentation: https://stormsoftware.com/projects/storm-stack/docs + Contact: https://stormsoftware.com/contact + License: https://stormsoftware.com/projects/storm-stack/license + + -------------------------------------------------------------------*/ + let index = 256; const hex = [] as string[]; let buffer!: number[];