update tsconfig

This commit is contained in:
Philipp Kunz 2024-04-14 18:29:18 +02:00
parent 77e6faef4d
commit c8fe270e08
4 changed files with 142 additions and 46 deletions

View File

@ -9,12 +9,22 @@
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartunique",
"description": "make things unique",
"description": "A library to generate unique identifiers using methods like UUID and nanoid.",
"npmPackagename": "@push.rocks/smartunique",
"license": "MIT"
"license": "MIT",
"keywords": [
"unique identifier",
"UUID",
"nanoid",
"shortid",
"TypeScript",
"security",
"randomness",
"uniqueness"
]
}
},
"tsdocs": {
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
}
}

View File

@ -2,7 +2,7 @@
"name": "@push.rocks/smartunique",
"version": "3.0.8",
"private": false,
"description": "make things unique",
"description": "A library to generate unique identifiers using methods like UUID and nanoid.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"author": "Lossless GmbH",
@ -17,13 +17,14 @@
"url": "https://gitlab.com/pushrocks/smartunique.git"
},
"keywords": [
"unique",
"key",
"uuid",
"unique identifier",
"UUID",
"nanoid",
"shortid",
"lossless",
"pushrocks",
"TypeScript"
"TypeScript",
"security",
"randomness",
"uniqueness"
],
"devDependencies": {
"@gitzone/tsbuild": "^2.1.66",
@ -53,4 +54,4 @@
"browserslist": [
"last 1 chrome versions"
]
}
}

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

154
readme.md
View File

@ -1,53 +1,137 @@
# @push.rocks/smartunique
make things unique
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartunique)
* [gitlab.com (source)](https://gitlab.com/push.rocks/smartunique)
* [github.com (source mirror)](https://github.com/push.rocks/smartunique)
* [docs (typedoc)](https://push.rocks.gitlab.io/smartunique/)
## Install
## Status for master
To install `@push.rocks/smartunique`, use the following npm command:
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smartunique/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smartunique/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartunique)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smartunique)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@push.rocks/smartunique)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartunique)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartunique)](https://lossless.cloud)
```sh
npm install @push.rocks/smartunique --save
```
This will add it to your project's dependencies. Make sure you have Node.js and npm installed in your development environment.
## Usage
Use TypeScript for best in class instellisense.
`@push.rocks/smartunique` is a TypeScript-powered module designed to help you generate unique identifiers such as short IDs, UUIDs, or custom unique strings. Its primary use is in scenarios where you need to ensure the uniqueness of elements or entities within your application, such as database keys, user identifiers, or session tokens.
```javascript
// We are using TypeScript syntax here to have types in place
import * as smartunique from 'smartunique';
### Setting Up Your Project
// creates a short mathematically highly unique short string
let myShortid = smartunique.shortid();
Before diving into the examples, ensure your project is set up for TypeScript:
// creates a string that is possibly unique world wide
let myUuid4 = smartunique.uuid4();
1. Initialize a new npm project if you haven't already:
// creates a oneway repeatable unique id within a certain namespace
let myUuid5 = smartunique.uuid('myobscureduser@somedomain.com', smartunique.uuid4());
```sh
npm init -y
```
Learn more about UUIDs: knowledgebase.gitzone.com/uuid.html
2. Install TypeScript:
## Contribution
```sh
npm install typescript --save-dev
```
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
3. Initialize TypeScript in your project:
For further information read the linked docs at the top of this readme.
```sh
npx tsc --init
```
## Legal
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
4. Ensure your `tsconfig.json` is configured to support ES Modules, as `@push.rocks/smartunique` is an ES Module package.
```json
{
"compilerOptions": {
"target": "es6",
"module": "ESNext",
"strict": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true
}
}
```
### Generating Unique Identifiers
Let's explore how to generate different types of unique identifiers using `@push.rocks/smartunique`.
#### Short Unique Identifiers
Short Ids are handy when you need a concise, highly unique identifier.
```typescript
import { shortId } from '@push.rocks/smartunique';
const myShortId = shortId();
console.log(`Generated shortId: ${myShortId}`);
// Specify a custom length for the shortId
const customLengthShortId = shortId(10);
console.log(`Generated shortId with custom length: ${customLengthShortId}`);
```
#### UUID Version 4 (Random)
UUIDs are universally unique identifiers that are widely used for ensuring uniqueness across distributed systems.
```typescript
import { uuid4 } from '@push.rocks/smartunique';
const myUuid4 = uuid4();
console.log(`Generated UUID v4: ${myUuid4}`);
```
#### UUID Version 5 (Name-Based)
UUID v5 generates a unique identifier based on a namespace identifier and a name.
```typescript
import { uuid5, uuid4 } from '@push.rocks/smartunique';
const namespaceUuid = uuid4(); // For example purposes, a random UUID serves as the namespace
const myUuid5 = uuid5('myUniqueName', namespaceUuid);
console.log(`Generated UUID v5: ${myUuid5}`);
```
#### Custom Unique Identifiers
For cases where you need a custom format for your unique identifiers, `@push.rocks/smartunique` offers `uni` and `uniSimple` functions.
```typescript
import { uni, uniSimple } from '@push.rocks/smartunique';
const customUni = uni('prefix', 16);
console.log(`Generated custom unique identifier: ${customUni}`);
const simpleUni = uniSimple('simple', 4);
console.log(`Generated simple unique identifier: ${simpleUni}`);
```
### Conclusion
Through these examples, you've seen how to generate various types of unique identifiers using `@push.rocks/smartunique`. Whether you need short IDs for concise references, UUIDs for global uniqueness, or custom unique identifiers for specific use cases, this package provides the tools necessary for your project's unique identifier needs.
Make sure to explore the package further to fully leverage its capabilities in your applications.
---
For any further assistance or contribution to the project, please refer to the repository on [GitLab](https://gitlab.com/pushrocks/smartunique) or its mirror on [GitHub](https://github.com/push.rocks/smartunique). Contributions, whether in the form of feature requests, bug reports, or pull requests, are always welcome.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.