-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace typescript #60
Merged
Merged
Changes from 26 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
087e789
Add tsc
segayuu 8e8aa31
Replace js to ts
segayuu d739088
chore(deps): update devDependencies
yoshinorin b1a4c57
refactor: use import syntax
yoshinorin fc5ff42
chore: format `.tsconfig.json`
yoshinorin 9b82a79
chore: update `tsconfig.json`
yoshinorin d278763
Revert only under the `test` dir: "refactor: use import syntax"
yoshinorin 38e36cb
chore: built to dist
yoshinorin 7baec35
chore: update `.eslint.json` extends from `hexo/ts.js`
yoshinorin 3abf305
chore(deps): update dependencies
yoshinorin 232613a
fix; `rfdc` import
yoshinorin 1786e37
fix: exports of types
yoshinorin 989a7df
test: `js` to `ts`
yoshinorin 4c4037c
fix: allow empty argument for Database constructor and some methods
yoshinorin c2fbe63
refactor: `export` to `export default`
yoshinorin 24e23dd
refactor: util export
yoshinorin 8fd8cc2
fix: import `isPlainObject` instead of const
yoshinorin 22d2ba7
chore: once ignore eslint for test
yoshinorin 7a92cc1
chore: add .tsconfig.json for test
yoshinorin 18a2105
chore: .tsconfig.json to tsconfig.json
yoshinorin 57d207f
chore: delete tsconfig.json for test
yoshinorin 428c145
Merge branch 'master' into replace-typescript
yoshinorin 3ee2546
update each type functions number of argument
yoshinorin 935fa4d
test(eslint): fix and ignore eslint some rules
yoshinorin aa58e27
chore: specify node 18.4 in ci.yml
yoshinorin 418c334
chore: workaround for `Error [ERR_STREAM_PREMATURE_CLOSE]` in node 18.6
yoshinorin c8176d2
Merge branch 'master' into replace-typescript
yoshinorin 8a2e372
chore: delete require nodejs`<18.5`
yoshinorin 64e134d
migrate jsonstream from js to ts
yoshinorin fa1eb2a
fix lint
yoshinorin 984b4c5
Update src/database.ts
yoshinorin 76599f2
chore(deps): add `@types/through2`
yoshinorin e5f66c5
chore: add ts-ignore
yoshinorin 0e23108
chore: allow ts-ignore
yoshinorin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,14 @@ | ||
{ | ||
"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, | ||
"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
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,27 +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", | ||
"bluebird": "^3.7.2", | ||
"cuid": "^2.1.8", | ||
"graceful-fs": "^4.2.10", | ||
"hexo-log": "^3.0.0", | ||
"is-plain-object": "^5.0.0", | ||
"JSONStream": "^1.0.7", | ||
"rfdc": "^1.1.4" | ||
"JSONStream": "^1.3.5", | ||
"rfdc": "^1.3.0" | ||
}, | ||
"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" | ||
"node": ">=14 <18.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
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; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a workaround.
The
Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
error occurs with Node18.6
. I don't know this problem is a bug or a spec change.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO we should delete
<18.5
before release the new version (5.0.0
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted