-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add tsc * Replace js to ts * chore(deps): update devDependencies * refactor: use import syntax * chore: format `.tsconfig.json` * chore: update `tsconfig.json` * Revert only under the `test` dir: "refactor: use import syntax" This reverts commit b1a4c57. * chore: built to dist * chore: update `.eslint.json` extends from `hexo/ts.js` * chore(deps): update dependencies * fix; `rfdc` import * fix: exports of types * test: `js` to `ts` * fix: allow empty argument for Database constructor and some methods * refactor: `export` to `export default` * refactor: util export * fix: import `isPlainObject` instead of const * chore: once ignore eslint for test * chore: add .tsconfig.json for test * chore: .tsconfig.json to tsconfig.json * chore: delete tsconfig.json for test * update each type functions number of argument * test(eslint): fix and ignore eslint some rules * chore: specify node 18.4 in ci.yml * chore: workaround for `Error [ERR_STREAM_PREMATURE_CLOSE]` in node 18.6 * chore: delete require nodejs`<18.5` * migrate jsonstream from js to ts * fix lint * Update src/database.ts Co-authored-by: Sukka <[email protected]> * chore(deps): add `@types/through2` * chore: add ts-ignore * chore: allow ts-ignore Co-authored-by: yoshinorin <[email protected]> Co-authored-by: Sukka <[email protected]>
- Loading branch information
1 parent
e0d4503
commit 44394e2
Showing
50 changed files
with
629 additions
and
567 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 |
---|---|---|
@@ -1,4 +1,15 @@ | ||
{ | ||
"root": true, | ||
"extends": "hexo" | ||
} | ||
"extends": "hexo/ts.js", | ||
"parserOptions": { | ||
"sourceType": "module", | ||
"ecmaVersion": 2020 | ||
}, | ||
"rules": { | ||
"@typescript-eslint/no-unused-vars": 0, | ||
"@typescript-eslint/no-explicit-any": 0, | ||
"@typescript-eslint/no-var-requires": 0, | ||
"@typescript-eslint/ban-ts-comment": 0, | ||
"no-use-before-define": 0 | ||
} | ||
} |
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 |
---|---|---|
|
@@ -4,4 +4,5 @@ node_modules/ | |
.nyc_output/ | ||
*.log | ||
docs/ | ||
coverage/ | ||
coverage/ | ||
dist |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -2,18 +2,21 @@ | |
"name": "warehouse", | ||
"version": "4.0.1", | ||
"description": "Simple JSON-based database", | ||
"main": "lib/database", | ||
"main": "dist/database", | ||
"directories": { | ||
"lib": "./lib" | ||
"lib": "./dist" | ||
}, | ||
"files": [ | ||
"lib/" | ||
"dist/" | ||
], | ||
"scripts": { | ||
"eslint": "eslint lib test", | ||
"test": "mocha \"test/scripts/**/*.js\"", | ||
"pretest": "npm run typescript", | ||
"typescript": "tsc --build tsconfig.json", | ||
"eslint": "eslint src test", | ||
"test": "mocha -r ts-node/register 'test/scripts/**/*.ts'", | ||
"test-cov": "nyc --reporter=lcovonly --reporter=text-summary npm test", | ||
"jsdoc": "jsdoc --configure .jsdoc.json" | ||
"jsdoc": "jsdoc --configure .jsdoc.json", | ||
"prepublish": "npm run typescript" | ||
}, | ||
"repository": "hexojs/warehouse", | ||
"keywords": [ | ||
|
@@ -24,26 +27,38 @@ | |
"author": "Tommy Chen <[email protected]> (http://zespia.tw)", | ||
"license": "MIT", | ||
"dependencies": { | ||
"bluebird": "^3.2.2", | ||
"cuid": "^2.1.4", | ||
"graceful-fs": "^4.1.3", | ||
"@types/through2": "^2.0.36", | ||
"bluebird": "^3.7.2", | ||
"cuid": "^2.1.8", | ||
"graceful-fs": "^4.2.10", | ||
"hexo-log": "^3.0.0", | ||
"is-plain-object": "^5.0.0", | ||
"jsonparse": "^1.3.1", | ||
"rfdc": "^1.1.4", | ||
"rfdc": "^1.3.0", | ||
"through2": "^4.0.2" | ||
}, | ||
"devDependencies": { | ||
"chai": "^4.2.0", | ||
"@types/bluebird": "^3.5.36", | ||
"@types/chai": "^4.3.1", | ||
"@types/graceful-fs": "^4.1.5", | ||
"@types/jsonstream": "^0.8.30", | ||
"@types/mocha": "^9.1.1", | ||
"@types/node": "^18.0.0", | ||
"@types/sinon": "^10.0.11", | ||
"@typescript-eslint/eslint-plugin": "^5.29.0", | ||
"@typescript-eslint/parser": "^5.29.0", | ||
"chai": "^4.3.6", | ||
"chai-as-promised": "^7.1.1", | ||
"eslint": "^8.1.0", | ||
"eslint": "^8.18.0", | ||
"eslint-config-hexo": "^5.0.0", | ||
"jsdoc": "^3.4.0", | ||
"lodash": "^4.17.15", | ||
"minami": "^1.1.1", | ||
"jsdoc": "^3.6.10", | ||
"lodash": "^4.17.21", | ||
"minami": "^1.2.3", | ||
"mocha": "^10.0.0", | ||
"nyc": "^15.0.0", | ||
"sinon": "^14.0.0" | ||
"sinon": "^14.0.0", | ||
"ts-node": "^10.8.1", | ||
"typescript": "^4.7.4" | ||
}, | ||
"engines": { | ||
"node": ">=14" | ||
|
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
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,25 +1,24 @@ | ||
'use strict'; | ||
|
||
class WarehouseError extends Error { | ||
code?: string; | ||
|
||
/** | ||
* WarehouseError constructor | ||
* | ||
* @param {string} msg | ||
* @param {string} code | ||
*/ | ||
constructor(msg, code) { | ||
constructor(msg: string, code?: string) { | ||
super(msg); | ||
|
||
Error.captureStackTrace(this); | ||
|
||
this.code = code; | ||
} | ||
static ID_EXIST = 'ID_EXIST'; | ||
static ID_NOT_EXIST = 'ID_NOT_EXIST'; | ||
static ID_UNDEFINED = 'ID_UNDEFINED'; | ||
} | ||
|
||
WarehouseError.prototype.name = 'WarehouseError'; | ||
WarehouseError.ID_EXIST = 'ID_EXIST'; | ||
WarehouseError.ID_NOT_EXIST = 'ID_NOT_EXIST'; | ||
WarehouseError.ID_UNDEFINED = 'ID_UNDEFINED'; | ||
|
||
module.exports = WarehouseError; | ||
export default WarehouseError; |
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,9 +1,7 @@ | ||
'use strict'; | ||
|
||
const WarehouseError = require('../error'); | ||
import WarehouseError from '../error'; | ||
|
||
class PopulationError extends WarehouseError {} | ||
|
||
PopulationError.prototype.name = 'PopulationError'; | ||
|
||
module.exports = PopulationError; | ||
export default PopulationError; |
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,9 +1,7 @@ | ||
'use strict'; | ||
|
||
const WarehouseError = require('../error'); | ||
import WarehouseError from '../error'; | ||
|
||
class ValidationError extends WarehouseError {} | ||
|
||
ValidationError.prototype.name = 'ValidationError'; | ||
|
||
module.exports = ValidationError; | ||
export default ValidationError; |
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
Oops, something went wrong.