Skip to content

Commit 75f5501

Browse files
author
chenbin92
authored
Merge pull request #3308 from alibaba/release-next
2 parents b987b09 + c8f23b7 commit 75f5501

File tree

34 files changed

+151
-55
lines changed

34 files changed

+151
-55
lines changed

docs/guide/basic/build.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,13 +424,13 @@ icejs 中一般不允许修改该配置。
424424
### eslint
425425

426426
- 类型:`boolean` | `object`
427-
- 默认值:`true`
427+
- 默认值:`false`
428428

429-
默认开启 eslint 代码检测,如需关闭配置为 `false` 即可。
429+
默认关闭 eslint 代码检测,如需开启配置为 `true` 即可。
430430

431431
```json
432432
{
433-
"eslint": false
433+
"eslint": true
434434
}
435435
```
436436

@@ -457,6 +457,19 @@ icejs 中一般不允许修改该配置。
457457
}
458458
```
459459

460+
### tsChecker
461+
462+
- 类型:`boolean`
463+
- 默认值:`false`
464+
465+
默认关闭 TypeScript 类型检测,如需开启配置为 `true` 即可。
466+
467+
```json
468+
{
469+
"tsChecker": true
470+
}
471+
```
472+
460473
## 根据环境区分工程配置
461474

462475
参考 [区分不同环境](/docs/guide/basic/config.md)

examples/basic-store/build.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"plugins": [],
33
"router": {
44
"lazy": false
5-
}
5+
},
6+
"tsChecker": true
67
}

examples/basic-store/src/typings.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
declare module '*.module.scss' {
2+
const classes: { [key: string]: string };
3+
export default classes;
4+
}
5+

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.6.1",
2+
"version": "1.6.2",
33
"npmClient": "yarn",
44
"useWorkspaces": true,
55
"packages": [

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ice.js",
33
"private": true,
4-
"version": "1.6.0",
4+
"version": "1.6.1",
55
"workspaces": [
66
"packages/*"
77
],

packages/create-ice/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-ice",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "npm init ice",
55
"author": "[email protected]",
66
"homepage": "",

packages/icejs/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ice.js",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "command line interface and builtin plugin for icejs",
55
"author": "[email protected]",
66
"homepage": "",
@@ -25,16 +25,16 @@
2525
},
2626
"dependencies": {
2727
"@alib/build-scripts": "^0.1.13",
28-
"build-plugin-ice-config": "1.6.1",
29-
"build-plugin-ice-core": "1.6.1",
30-
"build-plugin-ice-helpers": "1.6.1",
31-
"build-plugin-ice-logger": "1.6.1",
32-
"build-plugin-ice-mpa": "1.6.1",
33-
"build-plugin-ice-request": "1.6.1",
34-
"build-plugin-ice-router": "1.6.1",
35-
"build-plugin-ice-ssr": "1.6.1",
36-
"build-plugin-ice-store": "1.6.1",
37-
"build-plugin-react-app": "1.6.1",
28+
"build-plugin-ice-config": "1.6.2",
29+
"build-plugin-ice-core": "1.6.2",
30+
"build-plugin-ice-helpers": "1.6.2",
31+
"build-plugin-ice-logger": "1.6.2",
32+
"build-plugin-ice-mpa": "1.6.2",
33+
"build-plugin-ice-request": "1.6.2",
34+
"build-plugin-ice-router": "1.6.2",
35+
"build-plugin-ice-ssr": "1.6.2",
36+
"build-plugin-ice-store": "1.6.2",
37+
"build-plugin-react-app": "1.6.2",
3838
"chokidar": "^3.3.1",
3939
"commander": "^5.0.0",
4040
"detect-port": "^1.3.0",

packages/plugin-auth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "build-plugin-ice-auth",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "",
55
"author": "[email protected]",
66
"homepage": "https://github.com/alibaba/ice#readme",

packages/plugin-config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "build-plugin-ice-config",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "Define application config in icejs",
55
"author": "[email protected]",
66
"homepage": "",

packages/plugin-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "build-plugin-ice-core",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "the core plugin for icejs.",
55
"author": "[email protected]",
66
"homepage": "",

packages/plugin-core/src/generator/templates/app/components/ErrorBoundary.tsx.ejs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface IErrorInfo {
1414
};
1515

1616
interface IState {
17-
error?: Error;
17+
error?: Error | null;
1818
info?: IErrorInfo;
1919
};
2020

@@ -25,16 +25,18 @@ class ErrorBoundary extends React.Component<IProps, IState> {
2525

2626
state = {
2727
error: null,
28-
info: null
28+
info: {
29+
componentStack: ''
30+
}
2931
};
3032

3133
componentDidCatch(error: Error, info: IErrorInfo): void {
3234
const { onError } = this.props;
3335

3436
if (typeof onError === 'function') {
3537
try {
36-
// istanbul ignore next: Ignoring ternary; can’t reproduce missing info in test environment.
37-
onError.call(this, error, info ? info.componentStack : '');
38+
// can’t reproduce missing info in development environment.
39+
onError.call(this, error, info.componentStack);
3840
} catch (ignoredError) {
3941
// ignored error
4042
}
@@ -49,13 +51,10 @@ class ErrorBoundary extends React.Component<IProps, IState> {
4951
const { error, info } = this.state;
5052

5153
// render fallback UI if there is error
52-
if (error !== null) {
54+
if (error !== null && typeof Fallback === 'function') {
5355
return (
5456
<Fallback
55-
componentStack={
56-
// istanbul ignore next: Ignoring ternary; can’t reproduce missing info in test environment.
57-
info ? info.componentStack : ''
58-
}
57+
componentStack={info.componentStack}
5958
error={error}
6059
/>
6160
);

packages/plugin-core/src/generator/templates/app/createApp.tsx.ejs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import { IAppConfig } from './types';
1010
<% if (globalStyle) {%>import '../<%= globalStyle %>'<% } %>
1111
1212
export interface IContext {
13-
initialData: any;
14-
pageInitialProps: any;
15-
pathname: string;
13+
initialData?: any;
14+
pageInitialProps?: any;
15+
pathname?: string;
1616
}
1717
1818
const defaultAppConfig = {
@@ -42,7 +42,7 @@ function createApp(customConfig: IAppConfig) {
4242
4343
// client side rendering
4444
// get history instance
45-
const { type, basename, history: customHistory } = appConfig.router;
45+
const { type, basename = '', history: customHistory } = appConfig.router;
4646
const history = customHistory || createHistory(type, basename);
4747
appConfig.router.history = history;
4848
@@ -61,6 +61,7 @@ function createApp(customConfig: IAppConfig) {
6161
// ssr not enabled, or SSR is enabled but the server does not return data
6262
if (appConfig.app.getInitialData) {
6363
(async() => {
64+
// @ts-ignore
6465
initialData = await appConfig.app.getInitialData();
6566
renderApp(appConfig, { initialData, pageInitialProps });
6667
})();
@@ -70,7 +71,7 @@ function createApp(customConfig: IAppConfig) {
7071
}
7172
}
7273
73-
function renderApp(config: IAppConfig, context: IContext) {
74+
function renderApp(config: IAppConfig, context?: IContext) {
7475
const runtime = new RuntimeModule(config, <%- buildConfig %>, context)
7576
loadModlues(runtime);
7677
const { appConfig, modifyDOMRender } = runtime

packages/plugin-core/src/generator/templates/app/history.ts.ejs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { createBrowserHistory, createHashHistory, createMemoryHistory, History } from '$ice/history';
1+
import {
2+
createBrowserHistory,
3+
createHashHistory,
4+
createMemoryHistory,
5+
History
6+
// @ts-ignore
7+
} from '$ice/history';
28

39
// provide history instance
410
// can be used in the application through history.push()

packages/plugin-core/src/generator/templates/app/types.ts.ejs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,11 @@ app?: IApp
2222
<%- iceIAppConfigTypesExports %>
2323
}
2424
<% } %>
25+
26+
declare global {
27+
interface Window {
28+
__ICE_SSR_ENABLED__: any;
29+
__ICE_APP_DATA__: any;
30+
__ICE_PAGE_PROPS__: any;
31+
}
32+
}

packages/plugin-core/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export default (api) => {
2424
const plugins = getAllPlugin();
2525
// get runtime module
2626
const runtimeModules = plugins.map(({ pluginPath }) => {
27+
// compatible with function plugin
28+
if (!pluginPath) return false;
2729
const modulePath = path.join(path.dirname(pluginPath), 'module.js');
2830
return fse.existsSync(modulePath) ? formatPath(modulePath) : false;
2931
})

packages/plugin-fast-refresh/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "build-plugin-fast-refresh",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "A Webpack plugin to enable Fast Refresh (also previously known as Hot Reloading) for React",
55
"author": "思忠 <[email protected]>",
66
"homepage": "https://github.com/alibaba/ice#readme",

packages/plugin-helpers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "build-plugin-ice-helpers",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "builtin helpers in icejs",
55
"author": "[email protected]",
66
"homepage": "",

packages/plugin-icestark/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "build-plugin-icestark",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "Easy use `icestark` in icejs.",
55
"author": "[email protected]",
66
"homepage": "",

packages/plugin-logger/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "build-plugin-ice-logger",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "builtin logger in icejs",
55
"author": "[email protected]",
66
"homepage": "",

packages/plugin-mpa/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "build-plugin-ice-mpa",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "enable mpa project for icejs framework",
55
"author": "[email protected]",
66
"homepage": "",

packages/plugin-prerender/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "build-plugin-prerender",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "Prerender Plugin",
55
"main": "lib/index.js",
66
"scripts": {

packages/plugin-react-app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "build-plugin-react-app",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "The basic webpack configuration for ice project",
55
"author": "[email protected]",
66
"main": "src/index.js",
@@ -20,6 +20,7 @@
2020
"copy-webpack-plugin": "^5.0.4",
2121
"core-js": "^3.3.1",
2222
"eslint-loader": "^4.0.0",
23+
"fork-ts-checker-webpack-plugin": "^5.0.5",
2324
"friendly-errors-webpack-plugin": "^1.7.0",
2425
"fs-extra": "^8.1.0",
2526
"html-webpack-plugin": "^3.2.0",

packages/plugin-react-app/src/config/default.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ module.exports = {
5757
compileDependencies: [],
5858
babelPlugins: [],
5959
babelPresets: [],
60-
eslint: false
60+
eslint: false,
61+
tsChecker: false
6162
};

packages/plugin-react-app/src/config/validation.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,6 @@ module.exports = {
6565
babelPresets: 'array',
6666
eslint: (val) => {
6767
return validation('eslint', val, 'boolean|object');
68-
}
68+
},
69+
tsChecker: 'boolean'
6970
};

packages/plugin-react-app/src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ module.exports = ({
130130
libraryName: /@ali\/ice-.*/,
131131
stylePath: 'style.js',
132132
},
133-
]]);
133+
]])
134+
.end();
134135
if (mode === 'development') {
135136
// disable build-scripts stats output
136137
process.env.DISABLE_STATS = true;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
2+
3+
module.exports = (config, tsChecker) => {
4+
if (tsChecker) {
5+
config.plugin('fork-ts-checker-webpack-plugin')
6+
.use(ForkTsCheckerWebpackPlugin);
7+
}
8+
};

packages/plugin-rematch/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "build-plugin-ice-rematch",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "Easy use `rematch` in icejs",
55
"author": "[email protected]",
66
"homepage": "",

packages/plugin-request/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "build-plugin-ice-request",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "request for build-plugin-ice-request",
55
"author": "[email protected]",
66
"homepage": "",

packages/plugin-router/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "build-plugin-ice-router",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "build-plugin-ice-router",
55
"author": "[email protected]",
66
"homepage": "",

packages/plugin-router/src/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { History } from 'history';
66
import { RouteItemProps, IModifyRoutes } from './base';
77

88
export interface IAppRouterProps {
9-
type?: 'hash' | 'browser' | 'memory';
9+
type?: 'hash' | 'browser' | 'memory' | 'static';
1010
routes?: RouteItemProps[];
1111
basename?: string;
1212
modifyRoutes?: IModifyRoutes;

packages/plugin-service/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "build-plugin-ice-service",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "service pulgin",
55
"author": "[email protected]",
66
"homepage": "https://github.com/ice-lab/icejs#readme",

0 commit comments

Comments
 (0)