Skip to content

Commit 50a6c59

Browse files
committed
Add tsc
1 parent de8657b commit 50a6c59

File tree

4 files changed

+45
-8
lines changed

4 files changed

+45
-8
lines changed

.eslintrc.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
{
22
"root": true,
3-
"extends": "hexo"
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": ["node", "@typescript-eslint"],
5+
"extends": ["hexo", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended"],
6+
"ignorePatterns": ["built"],
7+
"parserOptions": {
8+
"ecmaVersion": 2018,
9+
"sourceType": "module",
10+
"ecmaFeatures": {
11+
"modules": true
12+
}
13+
},
14+
"rules": {
15+
"node/no-unsupported-features/es-syntax": 0
16+
}
417
}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ node_modules/
44
.nyc_output/
55
*.log
66
docs/
7-
coverage/
7+
coverage/
8+
built

.tsconfig.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"compilerOptions": {
3+
"outDir": "./built",
4+
"allowJs": true,
5+
"target": "ES2018",
6+
"lib": ["ES2018"],
7+
"module": "commonjs",
8+
"esModuleInterop": true
9+
},
10+
"include": [
11+
"./src/**/*"
12+
]
13+
}

package.json

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@
22
"name": "warehouse",
33
"version": "4.0.0",
44
"description": "Simple JSON-based database",
5-
"main": "lib/database",
5+
"main": "built/database",
66
"directories": {
7-
"lib": "./lib"
7+
"lib": "./built"
88
},
99
"files": [
10-
"lib/"
10+
"built/"
1111
],
1212
"scripts": {
13-
"eslint": "eslint lib test",
13+
"pretest": "npm run typescript",
14+
"typescript": "tsc --build .tsconfig.json",
15+
"eslint": "eslint src test",
1416
"test": "mocha \"test/scripts/**/*.js\"",
1517
"test-cov": "nyc --reporter=lcov --reporter=text-summary npm test",
16-
"jsdoc": "jsdoc --configure .jsdoc.json"
18+
"jsdoc": "jsdoc --configure .jsdoc.json",
19+
"prepublish": "npm run typescript"
1720
},
1821
"repository": "hexojs/warehouse",
1922
"keywords": [
@@ -32,6 +35,12 @@
3235
"rfdc": "^1.1.4"
3336
},
3437
"devDependencies": {
38+
"@types/bluebird": "^3.5.32",
39+
"@types/graceful-fs": "^4.1.3",
40+
"@types/jsonstream": "^0.8.30",
41+
"@types/node": "^14.0.5",
42+
"@typescript-eslint/eslint-plugin": "^3.0.0",
43+
"@typescript-eslint/parser": "^3.0.0",
3544
"chai": "^4.2.0",
3645
"chai-as-promised": "^7.1.1",
3746
"eslint": "^7.0.0",
@@ -41,7 +50,8 @@
4150
"minami": "^1.1.1",
4251
"mocha": "^7.0.0",
4352
"nyc": "^15.0.0",
44-
"sinon": "^9.0.2"
53+
"sinon": "^9.0.2",
54+
"typescript": "^3.9.3"
4555
},
4656
"engines": {
4757
"node": ">=10.13.0"

0 commit comments

Comments
 (0)