Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"root": true,
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"prettier",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "prettier"],
"rules": {
"promise/param-names": "off",
"no-use-before-define": "off",
"camelcase": "off",
"no-undef": "off",
"no-undefined": "off",
"no-void": ["off"],
"@typescript-eslint/no-unnecessary-type-constraint": "off",
"@typescript-eslint/no-explicit-any": [
"warn",
{
"ignoreRestArgs": true
}
],
"no-extra-semi": "off",
"@typescript-eslint/no-extra-semi": ["warn"],
"@typescript-eslint/no-empty-interface": [
"error",
{
"allowSingleExtends": true
}
]
}
}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
node_modules
dist
cjs/
esm/
typings/
coverage/
html/
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
lib/
libs/
tests/
vitest.config.ts
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"printWidth": 90,
"singleQuote": true,
"trailingComma": "all",
"jsxBracketSameLine": true,
"endOfLine": "auto",
"singleAttributePerLine": true,
"useTabs": true
}
19 changes: 14 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
language : node_js
node_js :
- "10"
language: node_js
node_js:
- '18' # 指定Node.js的版本为16

# 启用corepack以使用pnpm
before_install:
- corepack enable
- corepack prepare pnpm@latest --activate

# 安装项目依赖
install:
- npm i
- pnpm install

# 构建项目
script:
- npm run build
- pnpm run build
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 swcbo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,33 @@
<a href="https://npmjs.com/package/ts-indexdb"><img src="https://img.shields.io/npm/v/ts-indexdb.svg?logo=npm" alt="npm package"></a>
<a href="https://bundlephobia.com/package/ts-indexdb@latest"><img src="https://img.shields.io/bundlephobia/min/ts-indexdb.svg?logo=typescript" alt="size"></a>
</p>

## TODOs

- [ ] 在库中重新定义ts提供的不够完善的indexDB相关Event的类型
- [ ] IDBOpenDBRequest 的 onerror 中的 Event
- [ ] IDBOpenDBRequest 的 onsuccess 中的 Event
- [ ] IDBOpenDBRequest 的 onupgradeneeded 中的 IDBVersionChangeEvent
- [ ] 为class IndexDB 增加 泛型 或者 readonly 化 db options 实现使用的智能提示
- [ ] 重构代码,完全去除 IndexDB 中的 any 类型,让代码更安全
- [x] 替换 karma 为 vitest
- [x] 使用 pnpm 作为 包管理工具
- [ ] 增加 example 文件,为后续使用在线编辑器演示做准备
- [x] 增加 changelog
- [ ] 补充测试用例
- [ ] 达成95%的代码覆盖率测试
- [x] 增加格式化工具
- [ ] 增加 commit lint 工具
- [x] 更新 travis yaml 文件
- [ ] 标准化版本更新方式
- [x] 更新开源协议

## Install

```sh
npm install ts-indexdb
yarn add ts-indexdb
pnpm add ts-indexdb
```
## Usage
### Typescript
Expand Down
8 changes: 8 additions & 0 deletions cjs.tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "./cjs"
},
"include": ["libs"]
}
9 changes: 9 additions & 0 deletions declare.tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"declarationDir": "./typings"
},
"include": ["libs"]
}
171 changes: 0 additions & 171 deletions dist/TsIndexDb.d.ts

This file was deleted.

Loading