Skip to content

Commit

Permalink
parcel build, and slight rfks (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
erhant authored Feb 2, 2024
1 parent ff7851a commit 8c9de09
Show file tree
Hide file tree
Showing 15 changed files with 1,745 additions and 121 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"multiline-ternary": "off",
"no-nested-ternary": "error",
"no-multiple-empty-lines": "off"
}
},
"ignorePatterns": ["lib", "node_modules", "lua"]
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ bundles/
cache

dump.rdb

# parcel
.parcel-cache
8 changes: 8 additions & 0 deletions .parcelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@parcel/config-default",
"transformers": {
"*.ts": [
"@parcel/transformer-typescript-tsc"
]
}
}
3 changes: 0 additions & 3 deletions .prettierrc

This file was deleted.

27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ Warp Contracts will `open` and `close` the client many times, and we have seen t

Some of the functionality is achieved via [Lua](https://www.lua.org/home.html) scripts (v5.1), which you can find under `src/lua` for _reference_; the actual scripts are written in `luaScripts.ts`. The `prefix` and `subLevelSeparator` must be provided as argument to Lua scripts, because multiple `RedisCache` instances may be created with different prefixes or sub-level separators but they may connect to the same client; and for that reason we can't simply hardcode them in the script.

> [!TIP]
>
> To learn more about SortKeyCache, see the links below:
>
> - [SortKeyCache](https://github.com/warp-contracts/warp/blob/main/src/cache/SortKeyCache.ts)
> - [Warp docs for SortKey](https://academy.warp.cc/docs/sdk/advanced/bundled-interaction#how-it-works)
> - [KV class of SmartWeave](https://github.com/warp-contracts/warp/blob/main/src/legacy/smartweave-global.ts#L260)
## Installation

You can install the NPM package as shown below:
Expand Down Expand Up @@ -71,10 +79,19 @@ pnpm test # test everything
pnpm test <path> # test a specific suite
```

## Resources
## Building

Build the package with:

```sh
pnpm build
```

## Styling

To learn more, see the links below:
Check styling with:

- [SortKeyCache](https://github.com/warp-contracts/warp/blob/main/src/cache/SortKeyCache.ts)
- [Warp docs for SortKey](https://academy.warp.cc/docs/sdk/advanced/bundled-interaction#how-it-works)
- [KV class of SmartWeave](https://github.com/warp-contracts/warp/blob/main/src/legacy/smartweave-global.ts#L260)
```sh
pnpm format
pnpm lint
```
2 changes: 1 addition & 1 deletion jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
transform: {
"^.+\\.(ts|js)$": "ts-jest",
},
resolver: "jest-ts-webcompat-resolver",
// resolver: "jest-ts-webcompat-resolver",
testTimeout: 100_000,
// do this to always show a summary of failed tests, even if there is only one
// reporters: [["default", { summaryThreshold: 1 }]],
Expand Down
87 changes: 55 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,54 @@
"name": "warp-contracts-redis",
"version": "0.4.1",
"description": "Redis implementation for Warp Contracts",
"types": "./lib/types/index.d.ts",
"main": "./lib/cjs/index.js",
"module": "./lib/mjs/index.js",
"type": "module",
"license": "MIT",
"author": "FirstBatch Team <[email protected]>",
"homepage": "https://github.com/firstbatchxyz/warp-contracts-redis#readme",
"contributors": [
"Faruk Can Özkan <[email protected]>",
"Erhan Tezcan <[email protected]>"
],
"type": "module",
"source": "src/index.ts",
"types": "lib/index.d.ts",
"cjs": "lib/index.cjs",
"mjs": "lib/index.mjs",
"exports": {
"types": "./lib/index.d.ts",
"import": "./lib/index.mjs",
"require": "./lib/index.cjs",
"default": "./lib/index.mjs"
},
"targets": {
"cjs": {
"outputFormat": "commonjs",
"isLibrary": true,
"context": "node"
},
"mjs": {
"outputFormat": "esmodule",
"isLibrary": true,
"context": "node"
}
},
"sideEffects": false,
"engines": {
"node": ">=16.5"
},
"keywords": [
"key-value store",
"storage",
"database",
"blockchain",
"arweave",
"smartweave",
"warp-contracts",
"redis",
"cache"
"files": [
"lib/",
"README.md",
"LICENSE"
],
"scripts": {
"build:mjs": "tsc -b tsconfig.mjs.json",
"build:cjs": "tsc -b tsconfig.cjs.json",
"build:types": "tsc -b tsconfig.types.json",
"build": "pnpm run clean && pnpm build:cjs && pnpm build:mjs && pnpm build:types",
"format": "prettier --write 'src/**/*.ts'",
"clean": "rimraf ./lib",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"prettier:format": "prettier --config .prettierrc 'src/**/*.ts' --write",
"build": "parcel build",
"clean": "rimraf ./lib && rimraf ./.parcel-cache",
"check": "tsc --noEmit && echo 'All good.'",
"lint": "eslint '**/*.ts' && echo 'All good.'",
"format": "prettier --check '**/*.ts'",
"prepublishOnly": "pnpm lint:fix",
"preversion": "pnpm lint && pnpm build",
"version": "pnpm format && git add -A src",
"postversion": "git push && git push --tags",
"yalc:publish": "pnpm build && yalc publish --push",
"test": "jest --detectOpenHandles"
},
"files": [
"lib/",
"README.md",
"LICENSE"
],
"dependencies": {
"safe-stable-stringify": "^2.4.3"
},
Expand All @@ -58,6 +58,10 @@
"warp-contracts": "^1.4.2"
},
"devDependencies": {
"@parcel/config-default": "^2.11.0",
"@parcel/packager-ts": "^2.11.0",
"@parcel/transformer-typescript-tsc": "^2.11.0",
"@parcel/transformer-typescript-types": "^2.11.0",
"@types/jest": "^28.1.6",
"@types/node": "^18.0.6",
"@typescript-eslint/eslint-plugin": "^5.30.7",
Expand All @@ -67,10 +71,29 @@
"eslint-plugin-prettier": "^3.4.1",
"jest": "^29.5.0",
"jest-ts-webcompat-resolver": "^1.0.0",
"parcel": "^2.11.0",
"prettier": "^2.3.2",
"rimraf": "^3.0.2",
"ts-jest": "^29.1.0",
"ts-node": "^10.2.1",
"typescript": "^4.7.4"
},
"contributors": [
"Faruk Can Özkan <[email protected]>",
"Erhan Tezcan <[email protected]>"
],
"keywords": [
"key-value store",
"storage",
"database",
"blockchain",
"arweave",
"smartweave",
"warp-contracts",
"redis",
"cache"
],
"prettier": {
"printWidth": 120
}
}
Loading

0 comments on commit 8c9de09

Please sign in to comment.