Skip to content

Commit 5d56ad3

Browse files
committed
chore: improve tsconfig and generate flow definitions
1 parent c362ab7 commit 5d56ad3

File tree

7 files changed

+87
-18
lines changed

7 files changed

+87
-18
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
"no-else-return": 0,
3434
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
3535
"@typescript-eslint/explicit-member-accessibility": 0,
36-
"@typescript-eslint/no-explicit-any": 0
36+
"@typescript-eslint/no-explicit-any": 0,
37+
"@typescript-eslint/no-inferrable-types": 0
3738
},
3839
"env": {
3940
"jasmine": true,

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"eslint": "^5.15.0",
4444
"eslint-config-prettier": "^4.1.0",
4545
"eslint-plugin-prettier": "^3.0.1",
46+
"flowgen": "^1.6.0",
4647
"jest": "^24.1.0",
4748
"mongodb": "^3.1.13",
4849
"npm-run-all": "^4.1.5",
@@ -71,7 +72,8 @@
7172
},
7273
"scripts": {
7374
"build": "npm-run-all build:*",
74-
"build:ts": "rimraf build && tsc -p .",
75+
"build:ts": "rimraf ./lib && tsc -p ./tsconfig.build.json",
76+
"build:flow": "find ./lib -name \"*.d.ts\" -exec bash -c './node_modules/.bin/flowgen \"$1\" -o \"${1%.d.ts}\".js.flow' - '{}' \\;",
7577
"watch": "cross-env MONGOMS_DOWNLOAD_DIR=./tmp jest --watch",
7678
"coverage": "cross-env MONGOMS_DOWNLOAD_DIR=./tmp jest --coverage",
7779
"lint": "eslint 'src/**/*.{js,ts}'",

src/util/MongoBinary.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { DebugFn } from '../types';
1313
// TODO: return back `latest` version when it will be fixed in MongoDB distro (for now use 4.0.3 😂)
1414
// More details in https://github.com/nodkz/mongodb-memory-server/issues/131
1515
// export const LATEST_VERSION = 'latest';
16-
export const LATEST_VERSION = '4.0.3';
16+
export const LATEST_VERSION: string = '4.0.3';
1717

1818
export interface MongoBinaryCache {
1919
[version: string]: string;

src/util/mongo_killer.d.ts

Whitespace-only changes.

tsconfig.build.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"rootDir": "./src",
5+
"outDir": "./lib",
6+
"noEmit": false,
7+
"target": "es5",
8+
"module": "commonjs",
9+
"sourceMap": true,
10+
"declaration": true,
11+
"declarationMap": true,
12+
"skipLibCheck": false
13+
},
14+
"include": ["src/**/*"],
15+
"exclude": ["**/__tests__"]
16+
}

tsconfig.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
{
22
"compilerOptions": {
3-
"target": "es2018",
3+
"noEmit": true,
4+
"target": "es5",
45
"module": "commonjs",
5-
"outDir": "./lib",
66
"strict": true,
77
"rootDir": "./src",
8-
"declaration": true,
9-
"lib": ["es2018"],
8+
"outDir": "./lib",
9+
"lib": ["es2017"],
10+
"moduleResolution": "node",
1011
"esModuleInterop": true,
11-
"skipLibCheck": true
12+
"forceConsistentCasingInFileNames": true,
13+
"types": ["node", "jest"]
1214
},
13-
14-
"include": [ "src/**/*" ]
15+
"include": ["src/**/*"]
1516
}

yarn.lock

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,11 @@ [email protected], combined-stream@~1.0.5, combined-stream@~1.0.6:
12801280
dependencies:
12811281
delayed-stream "~1.0.0"
12821282

1283+
commander@^2.11.0:
1284+
version "2.19.0"
1285+
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
1286+
integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==
1287+
12831288
commander@~2.17.1:
12841289
version "2.17.1"
12851290
resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
@@ -2212,6 +2217,19 @@ flatted@^2.0.0:
22122217
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.0.tgz#55122b6536ea496b4b44893ee2608141d10d9916"
22132218
integrity sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg==
22142219

2220+
flowgen@^1.6.0:
2221+
version "1.6.0"
2222+
resolved "https://registry.yarnpkg.com/flowgen/-/flowgen-1.6.0.tgz#524338acd87db375c072e90d5347bef47375a539"
2223+
integrity sha512-rN4CkNbJPVOdxHlLCSaIPPB9CaUQYx4ysD+UgBQCApVFCI0PfGqtuXC7XCJrCdoJv3ftA7NceqkgKR/2/O1zGw==
2224+
dependencies:
2225+
commander "^2.11.0"
2226+
lodash "^4.17.4"
2227+
paralleljs "^0.2.1"
2228+
prettier "^1.16.4"
2229+
shelljs "^0.8.3"
2230+
typescript "^3.3.3"
2231+
typescript-compiler "^1.4.1-2"
2232+
22152233
flush-write-stream@^1.0.0:
22162234
version "1.0.3"
22172235
resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.0.3.tgz#c5d586ef38af6097650b49bc41b55fabb19f35bd"
@@ -2421,9 +2439,9 @@ glob-to-regexp@^0.3.0:
24212439
version "0.3.0"
24222440
resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab"
24232441

2424-
glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2:
2425-
version "7.1.2"
2426-
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
2442+
glob@^7.0.0, glob@^7.1.3, glob@~7.1.2:
2443+
version "7.1.3"
2444+
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1"
24272445
dependencies:
24282446
fs.realpath "^1.0.0"
24292447
inflight "^1.0.4"
@@ -2432,9 +2450,9 @@ glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2:
24322450
once "^1.3.0"
24332451
path-is-absolute "^1.0.0"
24342452

2435-
glob@^7.1.3, glob@~7.1.2:
2436-
version "7.1.3"
2437-
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1"
2453+
glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2:
2454+
version "7.1.2"
2455+
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
24382456
dependencies:
24392457
fs.realpath "^1.0.0"
24402458
inflight "^1.0.4"
@@ -2756,6 +2774,11 @@ inquirer@^6.2.2:
27562774
strip-ansi "^5.0.0"
27572775
through "^2.3.6"
27582776

2777+
interpret@^1.0.0:
2778+
version "1.2.0"
2779+
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296"
2780+
integrity sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==
2781+
27592782
into-stream@^4.0.0:
27602783
version "4.0.0"
27612784
resolved "https://registry.yarnpkg.com/into-stream/-/into-stream-4.0.0.tgz#ef10ee2ffb6f78af34c93194bbdc36c35f7d8a9d"
@@ -4760,6 +4783,11 @@ parallel-transform@^1.1.0:
47604783
inherits "^2.0.3"
47614784
readable-stream "^2.1.5"
47624785

4786+
paralleljs@^0.2.1:
4787+
version "0.2.1"
4788+
resolved "https://registry.yarnpkg.com/paralleljs/-/paralleljs-0.2.1.tgz#ebca745d3e09c01e2bebcc14858891ff4510e926"
4789+
integrity sha1-68p0XT4JwB4r68wUhYiR/0UQ6SY=
4790+
47634791
parent-module@^1.0.0:
47644792
version "1.0.0"
47654793
resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.0.tgz#df250bdc5391f4a085fb589dad761f5ad6b865b5"
@@ -5146,6 +5174,13 @@ realpath-native@^1.0.2:
51465174
dependencies:
51475175
util.promisify "^1.0.0"
51485176

5177+
rechoir@^0.6.2:
5178+
version "0.6.2"
5179+
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
5180+
integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=
5181+
dependencies:
5182+
resolve "^1.1.6"
5183+
51495184
redent@^2.0.0:
51505185
version "2.0.0"
51515186
resolved "https://registry.yarnpkg.com/redent/-/redent-2.0.0.tgz#c1b2007b42d57eb1389079b3c8333639d5e1ccaa"
@@ -5306,7 +5341,7 @@ [email protected]:
53065341
version "1.1.7"
53075342
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
53085343

5309-
5344+
[email protected], resolve@^1.1.6:
53105345
version "1.10.0"
53115346
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.0.tgz#3bdaaeaf45cc07f375656dfd2e54ed0810b101ba"
53125347
integrity sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==
@@ -5536,6 +5571,15 @@ shell-quote@^1.6.1:
55365571
array-reduce "~0.0.0"
55375572
jsonify "~0.0.0"
55385573

5574+
shelljs@^0.8.3:
5575+
version "0.8.3"
5576+
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.3.tgz#a7f3319520ebf09ee81275b2368adb286659b097"
5577+
integrity sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A==
5578+
dependencies:
5579+
glob "^7.0.0"
5580+
interpret "^1.0.0"
5581+
rechoir "^0.6.2"
5582+
55395583
shellwords@^0.1.1:
55405584
version "0.1.1"
55415585
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
@@ -6160,7 +6204,12 @@ typedarray@^0.0.6:
61606204
version "0.0.6"
61616205
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
61626206

6163-
typescript@^3.3.3333:
6207+
typescript-compiler@^1.4.1-2:
6208+
version "1.4.1-2"
6209+
resolved "https://registry.yarnpkg.com/typescript-compiler/-/typescript-compiler-1.4.1-2.tgz#ba4f7db22d91534a1929d90009dce161eb72fd3f"
6210+
integrity sha1-uk99si2RU0oZKdkACdzhYety/T8=
6211+
6212+
typescript@^3.3.3, typescript@^3.3.3333:
61646213
version "3.3.3333"
61656214
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3333.tgz#171b2c5af66c59e9431199117a3bcadc66fdcfd6"
61666215
integrity sha512-JjSKsAfuHBE/fB2oZ8NxtRTk5iGcg6hkYXMnZ3Wc+b2RSqejEqTaem11mHASMnFilHrax3sLK0GDzcJrekZYLw==

0 commit comments

Comments
 (0)