-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
2,746 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Build files | ||
dist | ||
|
||
#prettier config | ||
prettier.config.cjs | ||
|
||
# lint-staged config | ||
lint-staged.config.cjs | ||
|
||
# commitlint config | ||
commitlint.config.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es6": true | ||
}, | ||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], | ||
// Specifying Parser | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module", | ||
"tsconfigRootDir": ".", | ||
"project": ["./tsconfig.json"] | ||
}, | ||
// Configuring third-party plugins | ||
"plugins": ["@typescript-eslint"], | ||
// Resolve imports | ||
"rules": { | ||
"linebreak-style": "off", | ||
// Disallow the `any` type. | ||
"@typescript-eslint/no-explicit-any": "warn", | ||
"@typescript-eslint/ban-types": [ | ||
"error", | ||
{ | ||
"extendDefaults": true, | ||
"types": { | ||
"{}": false | ||
} | ||
} | ||
], | ||
"react-hooks/exhaustive-deps": "off", | ||
// Enforce the use of the shorthand syntax. | ||
"object-shorthand": "error", | ||
"no-console": "warn" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!-- | ||
Thank you for contributing by opening an issue! Please take a moment to review our Code of Conduct (found in the CODE_OF_CONDUCT.md file) to keep the community approachable and respectful. | ||
For bug reports, please fill out the information below to help us understand the issue and address it in a timely manner. We value your feedback and contributions. | ||
--> | ||
|
||
# Brief Description | ||
<!-- A brief description of the issue.--> | ||
|
||
## Environment | ||
|
||
- `@smakss/uuid` version: | ||
- Framework version (`react`, `react-native`, `Next.js`, `Remix` etc.`): | ||
- `node.js` version: | ||
- `npm` (or `yarn`) version: | ||
|
||
## Code Snippet | ||
<!-- Please provide any relevant code snippets or examples here --> | ||
|
||
```javascript | ||
// Your code here | ||
``` | ||
|
||
## Steps to Reproduce | ||
<!-- What steps did we need to take to encounter the problem? --> | ||
|
||
## Expected Behavior | ||
<!-- What you expected to happen --> | ||
|
||
## Actual Behavior | ||
<!-- What actually happened. Include the full error message/screenshots/anything that might help understanding the issue --> | ||
|
||
## Reproduction Repository | ||
<!-- | ||
If possible, please provide a repository link where the issue can be reproduced. A minimal test case would be greatly appreciated and can significantly speed up the resolution process. | ||
--> | ||
|
||
## Problem Description | ||
<!-- A clear and concise description of what the problem is. Include any additional context that might help us understand the issue. --> | ||
|
||
## Suggested Solution | ||
<!-- If you have any suggestion on how to fix the issue please provide it here. If not, just leave this section blank. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
- package-ecosystem: npm | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
reviewers: | ||
- "SMAKSS" | ||
assignees: | ||
- "SMAKSS" | ||
labels: | ||
- "dependencies" | ||
open-pull-requests-limit: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: PR Checks | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Print head and base refs | ||
run: | | ||
echo "Head ref: ${{ github.head_ref }}" | ||
echo "Base ref: ${{ github.base_ref }}" | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18" | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
**/node_modules | ||
key: ${{ runner.os }}-node-18-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-18-yarn- | ||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Type check | ||
run: yarn typecheck | ||
|
||
- name: Check code quality | ||
run: | | ||
yarn lint | ||
yarn format:check | ||
yarn run --if-present generate | ||
- name: Security Audit | ||
run: yarn audit --level moderate || true | ||
continue-on-error: true | ||
|
||
- name: Security Audit Summary | ||
if: success() || failure() | ||
run: yarn audit --summary | ||
|
||
- name: Archive production artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build-artifacts | ||
path: ./build/ | ||
|
||
- name: Error handling | ||
if: failure() | ||
run: echo "CI failed. Please check the logs." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Logs | ||
logs | ||
*.log | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Dependency directories | ||
node_modules | ||
|
||
# Generate output | ||
dist | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package.json | ||
.cache | ||
.shadowenv.d | ||
.vscode | ||
build | ||
dist | ||
node_modules | ||
public | ||
.github | ||
tmp | ||
*.yml |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,55 @@ | ||
# UUID | ||
|
||
![npm](https://img.shields.io/npm/v/@smakss/uuid) ![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/@smakss/uuid) ![NPM](https://img.shields.io/npm/l/@smakss/uuid) ![npm](https://img.shields.io/npm/dt/@smakss/uuid) ![npm bundle size (scoped)](https://img.shields.io/bundlephobia/min/@smakss/uuid) | ||
![npm](https://img.shields.io/npm/v/@smakss/uuid) ![NPM](https://img.shields.io/npm/l/@smakss/uuid) ![npm](https://img.shields.io/npm/dt/@smakss/uuid) ![npm bundle size (scoped)](https://img.shields.io/bundlephobia/min/@smakss/uuid) | ||
|
||
In order to create a unique id, you need to generate a unique string so the best way for it as [RFC 4122](https://www.ietf.org/rfc/rfc4122.txt) said is to use UUID. This package will generate a unique id according to RFC 4122 schema in pure js. The main source of this project is based on the StackOverflow community wiki. | ||
In order to create a unique identifier, it's common to use a UUID (Universally Unique Identifier). This package generates a version 4 UUID compliant with [RFC 4122](https://www.ietf.org/rfc/rfc4122.txt) standards using pure JavaScript. The codebase for this project is inspired by the collective wisdom of the StackOverflow community. | ||
|
||
<sub>For the sake of compatibility it do not use [crypto](https://developer.mozilla.org/en-US/docs/Web/API/Window/crypto) anymore since the `v1.1.2`.</sub> | ||
<sub>Since version `v1.1.2`, the package does not utilize the [crypto](https://developer.mozilla.org/en-US/docs/Web/API/Window/crypto) API to maximize compatibility across different environments.</sub> | ||
|
||
## Demo | ||
|
||
You can check the [working demo](https://runkit.com/smakss/uuid) in runkit. | ||
You can check the [working demo](https://runkit.com/smakss/uuid) on RunKit. | ||
|
||
or | ||
|
||
[![View @smakss/uuid](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/smakss-uuid-x5cqpb?fontsize=14&hidenavigation=1&theme=dark) | ||
|
||
## How it works? | ||
|
||
To install it you can simply do the following command: | ||
To install the package, run the following command: | ||
|
||
```bash | ||
npm i @smakss/uuid | ||
or | ||
# or | ||
yarn add @smakss/uuid | ||
``` | ||
|
||
to include it with common js module you should do this: | ||
For CommonJS modules, include it like this: | ||
|
||
```js | ||
var uuid = require("@smakss/uuid"); | ||
```javascript | ||
const uuid = require('@smakss/uuid'); | ||
``` | ||
|
||
and to include it with ECMAscript module you can simply do this one: | ||
For ECMAScript modules, import it as follows: | ||
|
||
```js | ||
import uuid from "@smakss/uuid"; | ||
```javascript | ||
import uuid from '@smakss/uuid'; | ||
``` | ||
|
||
then to use it within your application you can do it just like this: | ||
|
||
```js | ||
uuid(); | ||
Then, you can use it within your application like this: | ||
|
||
// Result: '289c653f-6c89-416c-8d82-c03f7e47340c' | ||
```javascript | ||
// Generate a new UUID | ||
const uniqueID = uuid(); | ||
console.log(uniqueID); // Outputs: '123e4567-e89b-12d3-a456-426614174000' (example output) | ||
``` | ||
|
||
<sub>**NOTE:** Each call to `uuid()` generates a unique UUID, so the output will vary with each call.</sub> | ||
|
||
## Contributing | ||
|
||
Interested in making contributions to this project? Please see [CONTRIBUTING.md](https://github.com/SMAKSS/uuid/blob/master/.github/CONTRIBUTING.md) for guidelines and details. | ||
Interested in contributing to this project? Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines and details. | ||
|
||
## Code of Conduct | ||
|
||
We value and prioritize the well-being of all our contributors and users. To ensure that this project remains a welcoming space for everyone, please refer to our [Code of Conduct](https://github.com/SMAKSS/uuid/blob/master/.github/CODE_OF_CONDUCT.md). | ||
To ensure a welcoming and positive experience for all contributors and users, we adhere to a [Code of Conduct](./CODE_OF_CONDUCT.md). Your cooperation is appreciated. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: ["@commitlint/config-conventional"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
"*.+(js|ts)": ["yarn lint", () => "yarn typecheck"], | ||
"*.+(js|json|yml|yaml|ts|md)": ["yarn format"], | ||
}; |
Oops, something went wrong.