diff --git a/README.md b/README.md index 02829eb..7fa4501 100644 --- a/README.md +++ b/README.md @@ -1 +1,116 @@ -# Persist + +
+
+ + + Logo + + + ### Persist + + + Typescript Library to Sync Variables with LocalStorage + + + [![Version](https://img.shields.io/badge/dynamic/json.svg?label=Version&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/persist/tags&query=$[0].name)](https://git.zakscode.com/ztimson/persist/tags) + [![Pull Requests](https://img.shields.io/badge/dynamic/json.svg?label=Pull%20Requests&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/persist&query=open_pr_counter)](https://git.zakscode.com/ztimson/persist/pulls) + [![Issues](https://img.shields.io/badge/dynamic/json.svg?label=Issues&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/persist&query=open_issues_count)](https://git.zakscode.com/ztimson/persist/issues) + + + + --- +
+ Documentation + • Release Notes + • Report a Bug + • Request a Feature +
+ + --- +
+ +## Table of Contents +- [Persist](#top) + - [About](#about) + - [Built With](#built-with) + - [Setup](#setup) + - [Production](#production) + - [Development](#development) + - [License](#license) + +## About + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + +### Demo + +Website: https://git.zakscode.com + +### Built With +[![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge&logo=typescript&logoColor=white)](https://typescriptlang.org/) + +## Setup + +
+ +

+ Production +

+
+ +#### Prerequisites +- [Node.js](https://nodejs.org/en/download) + +#### Instructions +1. Install persist: `npm i ztimson/persist` +2. Enable decorators inside `tsconfig.json`: +```json +{ + "compilerOptions": { + "experimentalDecorators": true, + ... + }, + ... +} +``` +3. Use persist: +```ts +import {Persist, persist} from 'ztimson/persist'; + +let theme = new Persist('theme', {default: 'os'}); +theme.value = 'light'; // Any changes will be synced to localStorage['theme']; +// You have to access/modify your data through the `value` property while using the Persist object + +// Or via decorator +class Theme { + // We are overriding the default key to use the same localStorage as above + @persist({key: 'theme', default: 'os'}) current!: string; +} +theme = new Theme(); +console.log(theme.current); // Output: light +theme.current = 'dark'; // You can ommit `.value` when using the decorator +``` +
+ +
+ +

+ Development +

+
+ +#### Prerequisites +- [Node.js](https://nodejs.org/en/download) + +#### Instructions +1. Install the dependencies: `npm i` +2. Build library & docs: `npm build` +3. Run unit tests: `npm test` + +
+ +## License + +Copyright © 2023 Zakary Timson | Available under MIT Licensing + +See the [license](./LICENSE) for more information. diff --git a/package.json b/package.json index 0570974..f960935 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Sync variables with the local/session storage using proxy objects & decorators", "repository": "https://git.zakscode.com/ztimson/persistance", "author": "Zak Timson", - "license": "Apache 2.0", + "license": "MIT", "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": {