Skip to content

Commit 4964fd0

Browse files
author
chengyu.chengyulia
committed
feat: optional check type and circular dependency
1 parent 20fc447 commit 4964fd0

File tree

5 files changed

+137
-7
lines changed

5 files changed

+137
-7
lines changed

.prettierrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
"useTabs": false,
77
"trailingComma": "all",
88
"arrowParens": "avoid"
9-
}
9+
}

declare/npm.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,4 @@ declare module '@babel/plugin-transform-react-display-name';
7575
declare module 'babel-plugin-react-wrapped-display-name';
7676
declare module 'enzyme-adapter-react-16';
7777
declare module 'isomorphic-fetch';
78+
declare module 'fork-ts-checker-webpack-plugin';

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
"eslint-plugin-react": "7.19.0",
9797
"eslint-plugin-react-hooks": "3.0.0",
9898
"file-loader": "5.0.2",
99+
"fork-ts-checker-webpack-plugin": "5.2.0",
99100
"fs-extra": "8.1.0",
100101
"gulp": "^4.0.2",
101102
"gulp-babel": "^8.0.0",

src/utils/webpack-dev-server.ts

+20-6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import * as CircularDependencyPlugin from 'circular-dependency-plugin';
1111
import * as _ from 'lodash';
1212
import * as WebpackDevServer from 'webpack-dev-server';
1313
import * as SpeedMeasurePlugin from 'speed-measure-webpack-plugin';
14+
import * as ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
1415
import { globalState } from './global-state';
1516
import { tempPath } from './structor-config';
1617
import { logInfo } from './log';
@@ -31,6 +32,7 @@ interface IExtraOptions {
3132

3233
const stats = {
3334
warnings: true,
35+
assets: false,
3436
version: false,
3537
modules: false,
3638
entrypoints: false,
@@ -50,12 +52,24 @@ export const runWebpackDevServer = async (opts: IOptions<IExtraOptions>) => {
5052

5153
webpackConfig.plugins.push(new WebpackBar());
5254

53-
webpackConfig.plugins.push(
54-
new CircularDependencyPlugin({
55-
exclude: /node_modules/,
56-
cwd: process.cwd(),
57-
}),
58-
);
55+
if (yargs.argv.checkCircular) {
56+
webpackConfig.plugins.push(
57+
new CircularDependencyPlugin({
58+
exclude: /node_modules/,
59+
cwd: process.cwd(),
60+
}),
61+
);
62+
}
63+
64+
if (!yargs.argv.skipTypeCheck) {
65+
webpackConfig.plugins.push(
66+
new ForkTsCheckerWebpackPlugin({
67+
typescript: {
68+
mode: 'write-references',
69+
},
70+
}),
71+
);
72+
}
5973

6074
const webpackDevServerConfig: WebpackDevServer.Configuration = {
6175
host: 'localhost',

yarn.lock

+114
Original file line numberDiff line numberDiff line change
@@ -1830,6 +1830,11 @@
18301830
resolved "https://registry.npm.alibaba-inc.com/@types/json-schema/download/@types/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339"
18311831
integrity sha1-OP1z3f2bVaux4bLtV4y1W9e30zk=
18321832

1833+
"@types/json-schema@^7.0.4", "@types/json-schema@^7.0.5":
1834+
version "7.0.7"
1835+
resolved "https://registry.npm.alibaba-inc.com/@types/json-schema/download/@types/json-schema-7.0.7.tgz#98a993516c859eb0d5c4c8f098317a9ea68db9ad"
1836+
integrity sha1-mKmTUWyFnrDVxMjwmDF6nqaNua0=
1837+
18331838
"@types/keygrip@*":
18341839
version "1.0.2"
18351840
resolved "https://registry.npm.alibaba-inc.com/@types/keygrip/download/@types/keygrip-1.0.2.tgz#513abfd256d7ad0bf1ee1873606317b33b1b2a72"
@@ -2458,6 +2463,16 @@ ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.3, ajv@^6.5.5:
24582463
json-schema-traverse "^0.4.1"
24592464
uri-js "^4.2.2"
24602465

2466+
ajv@^6.12.2:
2467+
version "6.12.6"
2468+
resolved "https://registry.npm.alibaba-inc.com/ajv/download/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4"
2469+
integrity sha1-uvWmLoArB9l3A0WG+MO69a3ybfQ=
2470+
dependencies:
2471+
fast-deep-equal "^3.1.1"
2472+
fast-json-stable-stringify "^2.0.0"
2473+
json-schema-traverse "^0.4.1"
2474+
uri-js "^4.2.2"
2475+
24612476
align-text@^0.1.1, align-text@^0.1.3:
24622477
version "0.1.4"
24632478
resolved "https://registry.npm.alibaba-inc.com/align-text/download/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117"
@@ -2913,6 +2928,11 @@ asynckit@^0.4.0:
29132928
resolved "https://registry.npm.alibaba-inc.com/asynckit/download/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
29142929
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
29152930

2931+
at-least-node@^1.0.0:
2932+
version "1.0.0"
2933+
resolved "https://registry.npm.alibaba-inc.com/at-least-node/download/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
2934+
integrity sha1-YCzUtG6EStTv/JKoARo8RuAjjcI=
2935+
29162936
atob@^2.1.2:
29172937
version "2.1.2"
29182938
resolved "https://registry.npm.alibaba-inc.com/atob/download/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
@@ -3608,6 +3628,14 @@ chalk@^3.0.0:
36083628
ansi-styles "^4.1.0"
36093629
supports-color "^7.1.0"
36103630

3631+
chalk@^4.1.0:
3632+
version "4.1.0"
3633+
resolved "https://registry.npm.alibaba-inc.com/chalk/download/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a"
3634+
integrity sha1-ThSHCmGNni7dl92DRf2dncMVZGo=
3635+
dependencies:
3636+
ansi-styles "^4.1.0"
3637+
supports-color "^7.1.0"
3638+
36113639
character-entities-legacy@^1.0.0:
36123640
version "1.1.4"
36133641
resolved "https://registry.npm.alibaba-inc.com/character-entities-legacy/download/character-entities-legacy-1.1.4.tgz#94bc1845dce70a5bb9d2ecc748725661293d8fc1"
@@ -4842,6 +4870,11 @@ deep-is@~0.1.3:
48424870
resolved "https://registry.npm.alibaba-inc.com/deep-is/download/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
48434871
integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=
48444872

4873+
deepmerge@^4.2.2:
4874+
version "4.2.2"
4875+
resolved "https://registry.npm.alibaba-inc.com/deepmerge/download/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955"
4876+
integrity sha1-RNLqNnm49NT/ujPwPYZfwee/SVU=
4877+
48454878
default-compare@^1.0.0:
48464879
version "1.0.0"
48474880
resolved "https://registry.npm.alibaba-inc.com/default-compare/download/default-compare-1.0.0.tgz#cb61131844ad84d84788fb68fd01681ca7781a2f"
@@ -6278,6 +6311,23 @@ fork-stream@^0.0.4:
62786311
resolved "https://registry.npm.alibaba-inc.com/fork-stream/download/fork-stream-0.0.4.tgz#db849fce77f6708a5f8f386ae533a0907b54ae70"
62796312
integrity sha1-24Sfznf2cIpfjzhq5TOgkHtUrnA=
62806313

6314+
6315+
version "5.2.0"
6316+
resolved "https://registry.npm.alibaba-inc.com/fork-ts-checker-webpack-plugin/download/fork-ts-checker-webpack-plugin-5.2.0.tgz#780a14fb0da02a892baedd7aa0d089a1eda7b3e5"
6317+
integrity sha1-eAoU+w2gKokrrt16oNCJoe2ns+U=
6318+
dependencies:
6319+
"@babel/code-frame" "^7.8.3"
6320+
"@types/json-schema" "^7.0.5"
6321+
chalk "^4.1.0"
6322+
cosmiconfig "^6.0.0"
6323+
deepmerge "^4.2.2"
6324+
fs-extra "^9.0.0"
6325+
memfs "^3.1.2"
6326+
minimatch "^3.0.4"
6327+
schema-utils "2.7.0"
6328+
semver "^7.3.2"
6329+
tapable "^1.0.0"
6330+
62816331
form-data@~2.3.2:
62826332
version "2.3.3"
62836333
resolved "https://registry.npm.alibaba-inc.com/form-data/download/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6"
@@ -6321,6 +6371,16 @@ [email protected]:
63216371
jsonfile "^4.0.0"
63226372
universalify "^0.1.0"
63236373

6374+
fs-extra@^9.0.0:
6375+
version "9.1.0"
6376+
resolved "https://registry.npm.alibaba-inc.com/fs-extra/download/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
6377+
integrity sha1-WVRGDHZKjaIJS6NVS/g55rmnyG0=
6378+
dependencies:
6379+
at-least-node "^1.0.0"
6380+
graceful-fs "^4.2.0"
6381+
jsonfile "^6.0.1"
6382+
universalify "^2.0.0"
6383+
63246384
fs-mkdirp-stream@^1.0.0:
63256385
version "1.0.0"
63266386
resolved "https://registry.npm.alibaba-inc.com/fs-mkdirp-stream/download/fs-mkdirp-stream-1.0.0.tgz#0b7815fc3201c6a69e14db98ce098c16935259eb"
@@ -6329,6 +6389,11 @@ fs-mkdirp-stream@^1.0.0:
63296389
graceful-fs "^4.1.11"
63306390
through2 "^2.0.3"
63316391

6392+
6393+
version "1.0.1"
6394+
resolved "https://registry.npm.alibaba-inc.com/fs-monkey/download/fs-monkey-1.0.1.tgz#4a82f36944365e619f4454d9fff106553067b781"
6395+
integrity sha1-SoLzaUQ2XmGfRFTZ//EGVTBnt4E=
6396+
63326397
fs-write-stream-atomic@^1.0.8:
63336398
version "1.0.10"
63346399
resolved "https://registry.npm.alibaba-inc.com/fs-write-stream-atomic/download/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9"
@@ -8717,6 +8782,15 @@ jsonfile@^4.0.0:
87178782
optionalDependencies:
87188783
graceful-fs "^4.1.6"
87198784

8785+
jsonfile@^6.0.1:
8786+
version "6.1.0"
8787+
resolved "https://registry.npm.alibaba-inc.com/jsonfile/download/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
8788+
integrity sha1-vFWyY0eTxnnsZAMJTrE2mKbsCq4=
8789+
dependencies:
8790+
universalify "^2.0.0"
8791+
optionalDependencies:
8792+
graceful-fs "^4.1.6"
8793+
87208794
jsonparse@^1.2.0:
87218795
version "1.3.1"
87228796
resolved "https://registry.npm.alibaba-inc.com/jsonparse/download/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280"
@@ -9443,6 +9517,13 @@ lru-cache@^5.1.1:
94439517
dependencies:
94449518
yallist "^3.0.2"
94459519

9520+
lru-cache@^6.0.0:
9521+
version "6.0.0"
9522+
resolved "https://registry.npm.alibaba-inc.com/lru-cache/download/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
9523+
integrity sha1-bW/mVw69lqr5D8rR2vo7JWbbOpQ=
9524+
dependencies:
9525+
yallist "^4.0.0"
9526+
94469527
94479528
version "0.1.0"
94489529
resolved "https://registry.npm.alibaba-inc.com/lru-queue/download/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3"
@@ -9602,6 +9683,13 @@ mem@^4.0.0:
96029683
mimic-fn "^2.0.0"
96039684
p-is-promise "^2.0.0"
96049685

9686+
memfs@^3.1.2:
9687+
version "3.2.0"
9688+
resolved "https://registry.npm.alibaba-inc.com/memfs/download/memfs-3.2.0.tgz#f9438e622b5acd1daa8a4ae160c496fdd1325b26"
9689+
integrity sha1-+UOOYitazR2qikrhYMSW/dEyWyY=
9690+
dependencies:
9691+
fs-monkey "1.0.1"
9692+
96059693
96069694
version "0.4.14"
96079695
resolved "https://registry.npm.alibaba-inc.com/memoizee/download/memoizee-0.4.14.tgz#07a00f204699f9a95c2d9e77218271c7cd610d57"
@@ -12621,6 +12709,15 @@ scheduler@^0.19.0, scheduler@^0.19.1:
1262112709
loose-envify "^1.1.0"
1262212710
object-assign "^4.1.1"
1262312711

12712+
12713+
version "2.7.0"
12714+
resolved "https://registry.npm.alibaba-inc.com/schema-utils/download/schema-utils-2.7.0.tgz#17151f76d8eae67fbbf77960c33c676ad9f4efc7"
12715+
integrity sha1-FxUfdtjq5n+793lgwzxnatn078c=
12716+
dependencies:
12717+
"@types/json-schema" "^7.0.4"
12718+
ajv "^6.12.2"
12719+
ajv-keywords "^3.4.1"
12720+
1262412721
schema-utils@^0.4.0:
1262512722
version "0.4.7"
1262612723
resolved "https://registry.npm.alibaba-inc.com/schema-utils/download/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187"
@@ -12710,6 +12807,13 @@ semver@^7.1.1:
1271012807
resolved "https://registry.npm.alibaba-inc.com/semver/download/semver-7.1.3.tgz#e4345ce73071c53f336445cfc19efb1c311df2a6"
1271112808
integrity sha1-5DRc5zBxxT8zZEXPwZ77HDEd8qY=
1271212809

12810+
semver@^7.3.2:
12811+
version "7.3.4"
12812+
resolved "https://registry.npm.alibaba-inc.com/semver/download/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97"
12813+
integrity sha1-J6qn0uTKdkUvmNOt0JOnLJQ+3Jc=
12814+
dependencies:
12815+
lru-cache "^6.0.0"
12816+
1271312817
semver@~5.3.0:
1271412818
version "5.3.0"
1271512819
resolved "https://registry.npm.alibaba-inc.com/semver/download/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
@@ -14271,6 +14375,11 @@ universalify@^0.1.0:
1427114375
resolved "https://registry.npm.alibaba-inc.com/universalify/download/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
1427214376
integrity sha1-tkb2m+OULavOzJ1mOcgNwQXvqmY=
1427314377

14378+
universalify@^2.0.0:
14379+
version "2.0.0"
14380+
resolved "https://registry.npm.alibaba-inc.com/universalify/download/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
14381+
integrity sha1-daSYTv7cSwiXXFrrc/Uw0C3yVxc=
14382+
1427414383
[email protected], unpipe@~1.0.0:
1427514384
version "1.0.0"
1427614385
resolved "https://registry.npm.alibaba-inc.com/unpipe/download/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
@@ -15036,6 +15145,11 @@ yallist@^3.0.2:
1503615145
resolved "https://registry.npm.alibaba-inc.com/yallist/download/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"
1503715146
integrity sha1-27fa+b/YusmrRev2ArjLrQ1dCP0=
1503815147

15148+
yallist@^4.0.0:
15149+
version "4.0.0"
15150+
resolved "https://registry.npm.alibaba-inc.com/yallist/download/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
15151+
integrity sha1-m7knkNnA7/7GO+c1GeEaNQGaOnI=
15152+
1503915153
yaml@^1.7.2:
1504015154
version "1.8.0"
1504115155
resolved "https://registry.npm.alibaba-inc.com/yaml/download/yaml-1.8.0.tgz#169fbcfa2081302dc9441d02b0b6fe667e4f74c9"

0 commit comments

Comments
 (0)