From 88656e076e2e8b18064dad2b103b1401e0c7f0a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=80=9D=E5=BF=A0?= Date: Sun, 10 May 2020 00:53:37 +0800 Subject: [PATCH 01/11] fix: compatible with the index page --- examples/basic-store/src/pages/Index/index.tsx | 9 +++++++++ examples/basic-store/src/routes.ts | 6 ++++++ packages/plugin-store/src/babelPluginReplacePath.ts | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 examples/basic-store/src/pages/Index/index.tsx diff --git a/examples/basic-store/src/pages/Index/index.tsx b/examples/basic-store/src/pages/Index/index.tsx new file mode 100644 index 0000000000..5744000e4f --- /dev/null +++ b/examples/basic-store/src/pages/Index/index.tsx @@ -0,0 +1,9 @@ +import React from 'react'; + +export default function Home() { + return ( + <> +

Index Page...

+ + ); +} diff --git a/examples/basic-store/src/routes.ts b/examples/basic-store/src/routes.ts index 9895c6faca..cd22620339 100644 --- a/examples/basic-store/src/routes.ts +++ b/examples/basic-store/src/routes.ts @@ -1,9 +1,11 @@ + // import { lazy } from 'ice'; import Layout from '@/layouts/index'; import Home from '@/pages/Home'; import About from '@/pages/About'; import { NotFound } from '@/pages/NotFound'; +import Index from '@/pages/Index'; // const Home = lazy(() => import('@/pages/Home')); // const About =lazy(() => import('@/pages/About')); @@ -23,6 +25,10 @@ export default [ path: '/about', component: About }, + { + path: '/index', + component: Index + }, { path: '*', component: NotFound, diff --git a/packages/plugin-store/src/babelPluginReplacePath.ts b/packages/plugin-store/src/babelPluginReplacePath.ts index 1f9c9ed030..0f17ffd5c9 100644 --- a/packages/plugin-store/src/babelPluginReplacePath.ts +++ b/packages/plugin-store/src/babelPluginReplacePath.ts @@ -118,7 +118,7 @@ function formatPagePath({ routesPath, value, alias, applyMethod }: IGetConfigRou newValue = value.replace(/\.{2}\/src\/pages/, './pages/index'); } else { const [, , pageName] = matchedPagePath.split('/'); - newValue = pageName ? `ice/${pageName}/${pageName}` : ''; + newValue = pageName ? `ice/${pageName}/${pageName}.tsx` : ''; } return newValue; } From 48d8da0fd39c6157937c1841cd00f89c97306f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=80=9D=E5=BF=A0?= Date: Sun, 10 May 2020 01:00:23 +0800 Subject: [PATCH 02/11] fix: create histroy when render root app --- packages/plugin-icestark/src/module.tsx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/plugin-icestark/src/module.tsx b/packages/plugin-icestark/src/module.tsx index eee3d4edff..063ace6539 100644 --- a/packages/plugin-icestark/src/module.tsx +++ b/packages/plugin-icestark/src/module.tsx @@ -63,22 +63,26 @@ const module = ({ appConfig, addDOMRender, setRenderRouter, modifyRoutes }) => { }); } else if (appType === 'framework') { const { getApps, appRouter, Layout, AppRoute: CustomAppRoute, removeRoutesLayout } = (icestark || {}) as IIceStark; - const history = createHistory(type, basename); if (removeRoutesLayout) { modifyRoutes(removeRootLayout); } + const RootApp = ({ routes }) => { + const [routerHistory] = useState(createHistory(type, basename)); + const routerProps = { + type, + routes, + basename, + history: routerHistory, + }; + return ; + }; + const frameworkRouter = (routes) => () => { const [appPathname, setAppPathname] = useState(''); const [appEnter, setAppEnter] = useState({}); const [appLeave, setAppLeave] = useState({}); const [apps, setApps] = useState(null); - const routerProps = { - type, - routes, - basename, - history - }; const BasicLayout = Layout || DefaultLayout; const RenderAppRoute = CustomAppRoute || AppRoute; @@ -130,7 +134,7 @@ const module = ({ appConfig, addDOMRender, setRenderRouter, modifyRoutes }) => { { - return ; + return ; }} /> )} From 469d4cee03aa435127e558df2ec568c83e37c8ad Mon Sep 17 00:00:00 2001 From: chenbin92 Date: Mon, 11 May 2020 09:57:18 +0800 Subject: [PATCH 03/11] feat: support promise function with useRequest (#3188) --- .eslintrc.js | 1 + examples/basic-request/src/app.ts | 5 +- .../basic-request/src/pages/Home/index.tsx | 73 ++++++++++++++----- .../basic-request/src/pages/Home/service.ts | 16 ++++ .../plugin-request/request/axiosInstance.ts | 3 +- packages/plugin-request/request/request.ts | 4 + packages/plugin-request/request/useRequest.ts | 70 ++++++++++-------- packages/plugin-request/src/types/index.ts | 3 +- 8 files changed, 119 insertions(+), 56 deletions(-) create mode 100644 examples/basic-request/src/pages/Home/service.ts diff --git a/.eslintrc.js b/.eslintrc.js index 2ddbc8a291..d45ec5a192 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -20,6 +20,7 @@ const jsRules = deepmerge(eslint, { const tsRules = deepmerge(tslint, { rules: { ...commonRules, + "@typescript-eslint/ban-ts-ignore": 0, "@typescript-eslint/no-explicit-any": 0, "@typescript-eslint/interface-name-prefix": 0, "@typescript-eslint/explicit-function-return-type": 0, diff --git a/examples/basic-request/src/app.ts b/examples/basic-request/src/app.ts index 41902449aa..1cc5168a80 100644 --- a/examples/basic-request/src/app.ts +++ b/examples/basic-request/src/app.ts @@ -1,16 +1,17 @@ -import { createApp, IAppConfig, history } from 'ice'; +import { createApp, IAppConfig } from 'ice'; const appConfig: IAppConfig = { app: { rootId: 'ice-container', }, request: { + // 可选的,全局设置 request 是否返回 response 对象,默认为 false + // withFullResponse: true, baseURL: '/api', interceptors: { response: { // 可选的 onConfig: (config) => { - console.log({history}); return config; }, // 可选的 diff --git a/examples/basic-request/src/pages/Home/index.tsx b/examples/basic-request/src/pages/Home/index.tsx index 9a48fe1903..bee90bebcd 100644 --- a/examples/basic-request/src/pages/Home/index.tsx +++ b/examples/basic-request/src/pages/Home/index.tsx @@ -1,43 +1,76 @@ import React, { useEffect } from 'react'; -import { useRequest, request } from 'ice'; +import { request, useRequest } from 'ice'; +import service from './service'; -// 1. request in outside -request('/user').then(res => console.log('request in outside:', res)); +const BuiltInRequestDemo1 = () => { + console.clear(); -const Home = () => { - // 2. useRequest hook - const { data, loading, request: fetchRepo } = useRequest({ url: '/repo' }); + async function fetchUser1() { + const data = await request({url: '/user' }); + console.log('直接调用 request:', data); + } - useEffect(() => { - fetchRepo(); + async function fetchUser2() { + const data = await request({url: '/user', withFullResponse: true }); + console.log('调用 request + withFullResponse:', data); + } - // 3. requse.get alias - request.get('/user').then(res => console.log('get:', res)); + const { request: fetchUser3, ...rest } = useRequest({url: '/user'}); + console.log('直接调用 useRequest:', {...rest}); - // 4. requse.post alias - request.post('/users/123').then(res => console.log('post:', res)); + return ( + <> +

内置 request 演示

+ + + + + ) +} - // 5. requse.delete alias - request.delete('/user/123').then(res => console.log('delete:', res)); +const BuiltInRequestDemo2 = () => { + console.clear(); + const { request: fetchUser, ...rest } = useRequest(service.getUser); + console.log('通过 Service + useRequest 调用:', {...rest}); - // 6. request method - request({ url: '/user'}).then((res) => {console.log('request:', res);}); + return ( + + ) +} +const CustomRequestDemo = () => { + console.clear(); + const { data, loading, error, request: fetchRepo } = useRequest(service.getRepo); + console.log('自定义请求进行调用:', { data, loading, error }); + useEffect(() => { + fetchRepo(); }, [fetchRepo]); return (
-

data fetching with icejs

- +

自定义请求演示

+ { loading ?
loading...
: - <> +
repo name:{data && data.name}
repo url:{data && data.url}
- +
}
+ ) +} + +const Home = () => { + return ( +
+

data fetching with icejs

+ 请打开控制台进行调试 + + + +
); }; diff --git a/examples/basic-request/src/pages/Home/service.ts b/examples/basic-request/src/pages/Home/service.ts new file mode 100644 index 0000000000..4cc6cc21ba --- /dev/null +++ b/examples/basic-request/src/pages/Home/service.ts @@ -0,0 +1,16 @@ +import { request } from 'ice'; + +async function customFetch (url) { + const res = await fetch(url) + return res.json() +} + +export default { + async getRepo() { + return await customFetch('/api/repo') + }, + + async getUser() { + return await request('/user') + }, +} diff --git a/packages/plugin-request/request/axiosInstance.ts b/packages/plugin-request/request/axiosInstance.ts index 69f70e0295..f4aace2c81 100644 --- a/packages/plugin-request/request/axiosInstance.ts +++ b/packages/plugin-request/request/axiosInstance.ts @@ -1,8 +1,7 @@ import axios from 'axios'; // https://github.com/axios/axios#request-config -const DEFAULE_CONFIG = { -}; +const DEFAULE_CONFIG = {}; const axiosInstance = axios.create(DEFAULE_CONFIG); diff --git a/packages/plugin-request/request/request.ts b/packages/plugin-request/request/request.ts index 9e97beb4fe..efb054b92d 100644 --- a/packages/plugin-request/request/request.ts +++ b/packages/plugin-request/request/request.ts @@ -20,6 +20,10 @@ interface IRequest extends IRequestProps { const request = async function (options) { try { const response = await axiosInstance(options); + // @ts-ignore + if (axiosInstance.defaults.withFullResponse || options.withFullResponse) { + return response; + } return response.data; } catch (error) { console.error(error); diff --git a/packages/plugin-request/request/useRequest.ts b/packages/plugin-request/request/useRequest.ts index 35e55c6c06..6c09eb1add 100644 --- a/packages/plugin-request/request/useRequest.ts +++ b/packages/plugin-request/request/useRequest.ts @@ -1,56 +1,60 @@ -import { useReducer, useCallback } from 'react'; -import { AxiosRequestConfig, AxiosResponse } from 'axios'; -import axiosInstance from './axiosInstance'; +import { useReducer, useCallback, useRef } from 'react'; +import { AxiosRequestConfig } from 'axios'; +import customRequest from './request'; interface Result { - response: AxiosResponse; data: D; error: Error | undefined; loading: boolean; request: (config?: AxiosRequestConfig) => Promise; } +type Noop = (...args: any[]) => any; + /** * Hooks to make ajax request * - * @param {object} options - axios config (https://github.com/axios/axios#request-config) + * @param {object} options - axios config (https://github.com/axios/axios#request-config) or Promise * @return {object} * @param {object} data - data in axios response - * @param {object} response - response of axios (https://github.com/axios/axios#response-schema) * @param {object} error - HTTP or use defined error * @param {boolean} loading - loading status of the request * @param {function} request - function to make the request manually */ -function useRequest(options: AxiosRequestConfig): Result { - const initialState = { - data: null, - response: null, - error: null, - loading: false - }; +function useRequest(options: AxiosRequestConfig | Noop): Result { + const initialState = Object.assign( + { + data: null, + error: null, + loading: false, + }, + ); const [state, dispatch] = useReducer(requestReducer, initialState); /** * Method to make request manually * @param {object} config - axios config to shallow merged with options before making request */ - const request = useCallback(async (config?: AxiosRequestConfig) => { + const request = usePersistFn(async (config?: AxiosRequestConfig) => { try { dispatch({ type: 'loading' }); - const response = await axiosInstance({ - ...options, - ...config - }); + let data; + if (typeof options === 'function') { + data = await options(config); + } else { + data = await customRequest({ + ...options, + ...config + }); + } dispatch({ - type: 'loaded', - data: response.data, - response, + type: 'success', + data }); - return response.data; } catch (error) { dispatch({ type: 'error', @@ -58,8 +62,7 @@ function useRequest(options: AxiosRequestConfig): Result { }); throw error; } - // eslint-disable-next-line - }, []); + }); return { ...state, @@ -78,27 +81,32 @@ function requestReducer(state, action) { case 'loading': return { data: null, - response: null, error: null, loading: true, - }; - case 'loaded': + } + case 'success': return { data: action.data, - response: action.response, error: null, loading: false, - }; + } case 'error': return { data: null, - response: null, error: action.error, loading: false, - }; + } default: throw new Error(); } } +function usePersistFn(fn: T) { + const ref = useRef(() => { + throw new Error('Cannot call function while rendering.'); + }); + ref.current = fn; + return useCallback(((...args) => ref.current(...args)) as T, [ref]); +} + export default useRequest; diff --git a/packages/plugin-request/src/types/index.ts b/packages/plugin-request/src/types/index.ts index fcd4286e18..32b7a8d410 100644 --- a/packages/plugin-request/src/types/index.ts +++ b/packages/plugin-request/src/types/index.ts @@ -2,5 +2,6 @@ import { AxiosRequestConfig } from 'axios'; import { IInterceptors } from './base'; export interface IRequest extends AxiosRequestConfig { + withFullResponse?: boolean; interceptors?: IInterceptors; -} \ No newline at end of file +} From a6f265a2ddf138dad495742d3800bbed0717eaa0 Mon Sep 17 00:00:00 2001 From: chenbin92 Date: Mon, 11 May 2020 14:15:16 +0800 Subject: [PATCH 04/11] fix: repository url (#3192) --- packages/create-ice/package.json | 4 ++++ packages/icejs/package.json | 4 ++++ packages/plugin-config/package.json | 2 +- packages/plugin-core/package.json | 4 ++++ packages/plugin-helpers/package.json | 4 ++++ packages/plugin-icestark/package.json | 4 ++++ packages/plugin-logger/package.json | 4 ++++ packages/plugin-mpa/package.json | 2 +- packages/plugin-react-app/package.json | 4 ++++ packages/plugin-rematch/package.json | 4 ++++ packages/plugin-request/package.json | 2 +- packages/plugin-router/package.json | 4 ++++ packages/plugin-service/package.json | 2 +- packages/plugin-ssr/package.json | 2 +- packages/plugin-store/package.json | 2 +- 15 files changed, 42 insertions(+), 6 deletions(-) diff --git a/packages/create-ice/package.json b/packages/create-ice/package.json index 6019b85096..c94a436cae 100644 --- a/packages/create-ice/package.json +++ b/packages/create-ice/package.json @@ -30,5 +30,9 @@ "publishConfig": { "registry": "http://registry.npmjs.com/" }, + "repository": { + "type": "git", + "url": "git@github.com:alibaba/ice.git" + }, "gitHead": "07ac7bb07162aac8c90778dd1de4a2060f8df498" } diff --git a/packages/icejs/package.json b/packages/icejs/package.json index db608b3a1c..fd489caf0a 100644 --- a/packages/icejs/package.json +++ b/packages/icejs/package.json @@ -16,6 +16,10 @@ "publishConfig": { "registry": "http://registry.npmjs.com/" }, + "repository": { + "type": "git", + "url": "git@github.com:alibaba/ice.git" + }, "scripts": { "test": "echo \"Error: run tests from root\" && exit 1" }, diff --git a/packages/plugin-config/package.json b/packages/plugin-config/package.json index 4fbcc16c2b..52527c1eeb 100644 --- a/packages/plugin-config/package.json +++ b/packages/plugin-config/package.json @@ -19,7 +19,7 @@ }, "repository": { "type": "git", - "url": "git@gitlab.alibaba-inc.com:ice/ice.js.git" + "url": "git@github.com:alibaba/ice.git" }, "scripts": { "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/plugin-core/package.json b/packages/plugin-core/package.json index 71bc2918a2..f0c3f1ef87 100644 --- a/packages/plugin-core/package.json +++ b/packages/plugin-core/package.json @@ -27,5 +27,9 @@ "globby": "^11.0.0", "prettier": "^2.0.2" }, + "repository": { + "type": "git", + "url": "git@github.com:alibaba/ice.git" + }, "gitHead": "07ac7bb07162aac8c90778dd1de4a2060f8df498" } diff --git a/packages/plugin-helpers/package.json b/packages/plugin-helpers/package.json index 94c4d3a80d..f2ed699806 100644 --- a/packages/plugin-helpers/package.json +++ b/packages/plugin-helpers/package.json @@ -31,6 +31,10 @@ "publishConfig": { "registry": "http://registry.npmjs.com/" }, + "repository": { + "type": "git", + "url": "git@github.com:alibaba/ice.git" + }, "scripts": { "test": "echo \"Error: run tests from root\" && exit 1" }, diff --git a/packages/plugin-icestark/package.json b/packages/plugin-icestark/package.json index bd3f68fb87..cdb3360ccb 100644 --- a/packages/plugin-icestark/package.json +++ b/packages/plugin-icestark/package.json @@ -30,6 +30,10 @@ "publishConfig": { "registry": "http://registry.npmjs.com/" }, + "repository": { + "type": "git", + "url": "git@github.com:alibaba/ice.git" + }, "scripts": { "test": "echo \"Error: run tests from root\" && exit 1" } diff --git a/packages/plugin-logger/package.json b/packages/plugin-logger/package.json index 3a354cfea7..c7b70b446b 100644 --- a/packages/plugin-logger/package.json +++ b/packages/plugin-logger/package.json @@ -25,6 +25,10 @@ "publishConfig": { "registry": "http://registry.npmjs.com/" }, + "repository": { + "type": "git", + "url": "git@github.com:alibaba/ice.git" + }, "scripts": { "test": "echo \"Error: run tests from root\" && exit 1" }, diff --git a/packages/plugin-mpa/package.json b/packages/plugin-mpa/package.json index c7f5cc79a0..9e2c4e9f62 100644 --- a/packages/plugin-mpa/package.json +++ b/packages/plugin-mpa/package.json @@ -17,7 +17,7 @@ }, "repository": { "type": "git", - "url": "git@gitlab.alibaba-inc.com:ice/ice.js.git" + "url": "git@github.com:alibaba/ice.git" }, "scripts": { "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/plugin-react-app/package.json b/packages/plugin-react-app/package.json index 4de0b880ab..47d937af73 100644 --- a/packages/plugin-react-app/package.json +++ b/packages/plugin-react-app/package.json @@ -32,5 +32,9 @@ "devDependencies": { "webpack": "^4.41.1" }, + "repository": { + "type": "git", + "url": "git@github.com:alibaba/ice.git" + }, "gitHead": "07ac7bb07162aac8c90778dd1de4a2060f8df498" } diff --git a/packages/plugin-rematch/package.json b/packages/plugin-rematch/package.json index a787706df1..ed6dba99d8 100644 --- a/packages/plugin-rematch/package.json +++ b/packages/plugin-rematch/package.json @@ -30,5 +30,9 @@ "publishConfig": { "registry": "http://registry.npmjs.com/" }, + "repository": { + "type": "git", + "url": "git@github.com:alibaba/ice.git" + }, "gitHead": "07ac7bb07162aac8c90778dd1de4a2060f8df498" } diff --git a/packages/plugin-request/package.json b/packages/plugin-request/package.json index 3509e1f2fe..e1e1e53380 100644 --- a/packages/plugin-request/package.json +++ b/packages/plugin-request/package.json @@ -26,7 +26,7 @@ }, "repository": { "type": "git", - "url": "git@gitlab.alibaba-inc.com:ice/ice.js.git" + "url": "git@github.com:alibaba/ice.git" }, "scripts": { "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/plugin-router/package.json b/packages/plugin-router/package.json index ca54b259ad..2bba4fbae7 100644 --- a/packages/plugin-router/package.json +++ b/packages/plugin-router/package.json @@ -36,6 +36,10 @@ "publishConfig": { "registry": "http://registry.npmjs.com/" }, + "repository": { + "type": "git", + "url": "git@github.com:alibaba/ice.git" + }, "scripts": { "test": "echo \"Error: run tests from root\" && exit 1" }, diff --git a/packages/plugin-service/package.json b/packages/plugin-service/package.json index d38c87ae5e..0779fc6a76 100644 --- a/packages/plugin-service/package.json +++ b/packages/plugin-service/package.json @@ -20,7 +20,7 @@ ], "repository": { "type": "git", - "url": "git+https://github.com/ice-lab/icejs.git" + "url": "git@github.com:alibaba/ice.git" }, "scripts": { "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/plugin-ssr/package.json b/packages/plugin-ssr/package.json index d4e064aaf4..9d021cd422 100644 --- a/packages/plugin-ssr/package.json +++ b/packages/plugin-ssr/package.json @@ -19,7 +19,7 @@ }, "repository": { "type": "git", - "url": "git@gitlab.alibaba-inc.com:ice/ice.js.git" + "url": "git@github.com:alibaba/ice.git" }, "scripts": { "test": "echo \"Error: run tests from root\" && exit 1" diff --git a/packages/plugin-store/package.json b/packages/plugin-store/package.json index d107705d42..38932f9600 100644 --- a/packages/plugin-store/package.json +++ b/packages/plugin-store/package.json @@ -19,7 +19,7 @@ }, "repository": { "type": "git", - "url": "git@gitlab.alibaba-inc.com:ice/ice.js.git" + "url": "git@github.com:alibaba/ice.git" }, "scripts": { "test": "echo \"Error: run tests from root\" && exit 1" From ad0a3d6bd2a7d43797b45cc33665145ccb2cbb3b Mon Sep 17 00:00:00 2001 From: chenbin92 Date: Mon, 11 May 2020 22:23:35 +0800 Subject: [PATCH 05/11] feat: optimize webpackbar (#3187) * feat: optimize webpackbar * fix: rename eslintLoaderOptions to eslint --- packages/icejs/bin/start.js | 1 + packages/plugin-react-app/package.json | 5 +- .../src/config/default.config.js | 2 +- .../src/config/setWebpackbar.js | 20 +++++ packages/plugin-react-app/src/index.js | 52 ++++++++++++- packages/plugin-ssr/package.json | 3 +- packages/plugin-ssr/src/index.ts | 22 +++++- yarn.lock | 76 ++++++++++++++++++- 8 files changed, 171 insertions(+), 10 deletions(-) create mode 100644 packages/plugin-react-app/src/config/setWebpackbar.js diff --git a/packages/icejs/bin/start.js b/packages/icejs/bin/start.js index 1389a945d5..ad20cac6f6 100644 --- a/packages/icejs/bin/start.js +++ b/packages/icejs/bin/start.js @@ -59,6 +59,7 @@ const onUserChange = () => { }; module.exports = () => { + process.env.DISABLE_STATS = true; restartProcess(); const watcher = chokidar.watch(configPath, { diff --git a/packages/plugin-react-app/package.json b/packages/plugin-react-app/package.json index 47d937af73..8be040404c 100644 --- a/packages/plugin-react-app/package.json +++ b/packages/plugin-react-app/package.json @@ -16,9 +16,11 @@ "@alifd/fusion-collector": "^1.2.5", "@babel/plugin-transform-runtime": "^7.6.2", "build-scripts-config": "^0.1.0", + "chalk": "^4.0.0", "copy-webpack-plugin": "^5.0.4", "core-js": "^3.3.1", "eslint-loader": "^4.0.0", + "friendly-errors-webpack-plugin": "^1.7.0", "fs-extra": "^8.1.0", "html-webpack-plugin": "^3.2.0", "lodash": "^4.17.15", @@ -27,7 +29,8 @@ "react-dev-utils": "^9.1.0", "regenerator-runtime": "^0.13.3", "webpack-bundle-analyzer": "^3.6.0", - "webpack-dev-mock": "^0.1.5" + "webpack-dev-mock": "^0.1.5", + "webpackbar": "^4.0.0" }, "devDependencies": { "webpack": "^4.41.1" diff --git a/packages/plugin-react-app/src/config/default.config.js b/packages/plugin-react-app/src/config/default.config.js index 56126481c9..7b95ad1eed 100644 --- a/packages/plugin-react-app/src/config/default.config.js +++ b/packages/plugin-react-app/src/config/default.config.js @@ -10,8 +10,8 @@ module.exports = { devServer: { disableHostCheck: true, compress: true, - clientLogLevel: 'none', logLevel: 'silent', + clientLogLevel: 'none', hot: true, publicPath: '/', quiet: false, diff --git a/packages/plugin-react-app/src/config/setWebpackbar.js b/packages/plugin-react-app/src/config/setWebpackbar.js new file mode 100644 index 0000000000..7193be0448 --- /dev/null +++ b/packages/plugin-react-app/src/config/setWebpackbar.js @@ -0,0 +1,20 @@ +const WebpackBar = require('webpackbar'); + +module.exports = (config) => { + if (config.plugins.get('SimpleProgressPlugin')) { + config + .plugins + .delete('SimpleProgressPlugin') + .end() + .plugin('WebpackBar') + .use(WebpackBar) + .tap((args) => { + return [ + ...args, + { + name: 'client' + } + ]; + }); + } +}; diff --git a/packages/plugin-react-app/src/index.js b/packages/plugin-react-app/src/index.js index 8ec4a9d3bd..8d5f25b446 100644 --- a/packages/plugin-react-app/src/index.js +++ b/packages/plugin-react-app/src/index.js @@ -4,11 +4,16 @@ const { getWebpackConfig, getJestConfig } = require('build-scripts-config'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const openBrowser = require('react-dev-utils/openBrowser'); +const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages'); const defaultConfig = require('./config/default.config'); const validation = require('./config/validation'); const optionConfig = require('./config/option.config'); const getFilePath = require('./utils/getFilePath'); const collect = require('./utils/collect'); +const setWebpackbar = require('./config/setWebpackbar'); + +// eslint-disable-next-line +const chalk = require('chalk'); module.exports = ({ onGetWebpackConfig, @@ -53,22 +58,30 @@ module.exports = ({ const mode = command === 'start' ? 'development' : 'production'; const config = getWebpackConfig(mode); - // set webpack name - config.name('Client'); - // setup DefinePlugin, HtmlWebpackPlugin and CopyWebpackPlugin out of onGetWebpackConfig // in case of registerUserConfig will be excute before onGetWebpackConfig + // set webpackbar + setWebpackbar(config); + // DefinePlugin const defineVariables = { 'process.env.NODE_ENV': JSON.stringify(mode || 'development'), 'process.env.APP_MODE': JSON.stringify(appMode), 'process.env.SERVER_PORT': JSON.stringify(commandArgs.port), }; + config .plugin('DefinePlugin') .use(webpack.DefinePlugin, [defineVariables]) .end() + .plugin('friendly-error') + .use(require.resolve('friendly-errors-webpack-plugin'), [ + { + clearConsole: false, + } + ]) + .end() // HtmlWebpackPlugin .plugin('HtmlWebpackPlugin') .use(HtmlWebpackPlugin, [{ @@ -98,6 +111,8 @@ module.exports = ({ config.plugin('HotModuleReplacementPlugin') .use(webpack.HotModuleReplacementPlugin); } + + config.name('web'); registerTask('web', config); // sort config key to make sure entry config is always excute before injectBabel @@ -161,6 +176,37 @@ module.exports = ({ }); } + if (command === 'start') { + onHook('after.start.compile', ({ urls, stats }) => { + const statsJson = stats.toJson({ + all: false, + errors: true, + warnings: true, + timings: true, + }); + const messages = formatWebpackMessages(statsJson); + const isSuccessful = !messages.errors.length && !messages.warnings.length; + if (isSuccessful) { + console.log(); + console.log(chalk.green(' Starting the development server at:')); + console.log(' - Local : ', chalk.underline.white(urls.localUrlForBrowser)); + console.log(' - Network: ', chalk.underline.white(urls.lanUrlForTerminal)); + console.log(); + + console.log(stats.toString({ + errors: false, + warnings: false, + colors: true, + assets: true, + chunks: false, + entrypoints: false, + modules: false, + timings: false + })); + } + }); + } + // open browser on server start if (!commandArgs.disableOpen) { onHook('after.start.devServer', ({ url }) => { diff --git a/packages/plugin-ssr/package.json b/packages/plugin-ssr/package.json index 9d021cd422..823ea0f9a4 100644 --- a/packages/plugin-ssr/package.json +++ b/packages/plugin-ssr/package.json @@ -30,6 +30,7 @@ "cheerio": "^1.0.0-rc.3", "ejs": "^3.0.1", "fs-extra": "^8.1.0", - "html-minifier": "^4.0.0" + "html-minifier": "^4.0.0", + "webpackbar": "^4.0.0" } } diff --git a/packages/plugin-ssr/src/index.ts b/packages/plugin-ssr/src/index.ts index 017bbf456b..4e2b7bf850 100644 --- a/packages/plugin-ssr/src/index.ts +++ b/packages/plugin-ssr/src/index.ts @@ -1,6 +1,7 @@ import * as path from 'path'; import * as fse from 'fs-extra'; import * as ejs from 'ejs'; +import * as WebpackBar from 'webpackbar'; import { minify } from 'html-minifier'; import { getWebpackConfig } from 'build-scripts-config'; @@ -61,6 +62,23 @@ const plugin = async (api): Promise => { } }); + if (config.plugins.get('SimpleProgressPlugin')) { + config + .plugins + .delete('SimpleProgressPlugin') + .end() + .plugin('WebpackBar') + .use(WebpackBar) + .tap((args) => { + return [ + ...args, + { + name: 'server' + } + ]; + }); + } + config.output .path(serverDir) .filename(serverFilename) @@ -122,7 +140,6 @@ const plugin = async (api): Promise => { if (serverReady) { serverRender(res, req); } else { - console.log('[SSR]', 'pending request until server is ready'); httpResponseQueue.push([req, res]); } }); @@ -135,8 +152,7 @@ const plugin = async (api): Promise => { const htmlFilePath = path.join(buildDir, 'index.html'); const bundle = fse.readFileSync(serverFilePath, 'utf-8'); const html = fse.readFileSync(htmlFilePath, 'utf-8'); - // eslint-disable-next-line quotes - const minifedHtml = minify(html, { collapseWhitespace: true, quoteCharacter: "'" }); + const minifedHtml = minify(html, { collapseWhitespace: true, quoteCharacter: '\'' }); const newBundle = bundle.replace(/__ICE_SERVER_HTML_TEMPLATE__/, minifedHtml); fse.writeFileSync(serverFilePath, newBundle, 'utf-8'); }); diff --git a/yarn.lock b/yarn.lock index 1b7b20cc4b..bb4663f340 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3012,7 +3012,7 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" -ansi-styles@^4.1.0: +ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.2.1" resolved "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" integrity sha1-kK51xCTQCNJiTFvynq0xd+v881k= @@ -3990,6 +3990,14 @@ chalk@^3.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" +chalk@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz#6e98081ed2d17faab615eb52ac66ec1fe6209e72" + integrity sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + character-entities-html4@^1.0.0: version "1.1.4" resolved "https://registry.npm.taobao.org/character-entities-html4/download/character-entities-html4-1.1.4.tgz#0e64b0a3753ddbf1fdc044c5fd01d0199a02e125" @@ -4078,6 +4086,11 @@ chrome-trace-event@^1.0.2: dependencies: tslib "^1.9.0" +ci-info@^1.6.0: + version "1.6.0" + resolved "https://registry.npmjs.org/ci-info/-/ci-info-1.6.0.tgz#2ca20dbb9ceb32d4524a683303313f0304b1e497" + integrity sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A== + ci-info@^2.0.0: version "2.0.0" resolved "https://registry.npm.taobao.org/ci-info/download/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" @@ -4384,6 +4397,11 @@ connect-history-api-fallback@^1.6.0: resolved "https://registry.npm.taobao.org/connect-history-api-fallback/download/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc" integrity sha1-izIIk1kwjRERFdgcrT/Oq4iPl7w= +consola@^2.10.0: + version "2.12.1" + resolved "https://registry.npmjs.org/consola/-/consola-2.12.1.tgz#88e9311a02cb88a7f6f9488239dd30b6ba99cbb0" + integrity sha512-aEkkju9ZcEa9y2MhzNhfmTUws/CEZZ0LKu0FxftSU3HygPfVMMIMSYyYct+xBN6XNRhsaDZjw2HAv3m2ammXSA== + console-browserify@^1.1.0: version "1.2.0" resolved "https://registry.npm.taobao.org/console-browserify/download/console-browserify-1.2.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fconsole-browserify%2Fdownload%2Fconsole-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336" @@ -5540,6 +5558,13 @@ error-ex@^1.2.0, error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" +error-stack-parser@^2.0.0: + version "2.0.6" + resolved "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.0.6.tgz#5a99a707bd7a4c58a797902d48d82803ede6aad8" + integrity sha512-d51brTeqC+BHlwF0BhPtcYgF5nlzf9ZZ0ZIUQNZpc9ZB9qw5IJ2diTrBY9jlCJkTLITYPjmiX6OWCwH+fuyNgQ== + dependencies: + stackframe "^1.1.1" + es-abstract@^1.17.0, es-abstract@^1.17.0-next.1, es-abstract@^1.17.2, es-abstract@^1.17.5: version "1.17.5" resolved "https://registry.npm.taobao.org/es-abstract/download/es-abstract-1.17.5.tgz#d8c9d1d66c8981fb9200e2251d799eee92774ae9" @@ -6342,6 +6367,15 @@ fresh@0.5.2: resolved "https://registry.npm.taobao.org/fresh/download/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= +friendly-errors-webpack-plugin@^1.7.0: + version "1.7.0" + resolved "https://registry.npmjs.org/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-1.7.0.tgz#efc86cbb816224565861a1be7a9d84d0aafea136" + integrity sha512-K27M3VK30wVoOarP651zDmb93R9zF28usW4ocaK3mfQeIEI5BPht/EzZs5E8QLLwbLRJQMwscAjDxYPb1FuNiw== + dependencies: + chalk "^1.1.3" + error-stack-parser "^2.0.0" + string-width "^2.0.0" + from2@^2.1.0: version "2.3.0" resolved "https://registry.npm.taobao.org/from2/download/from2-2.3.0.tgz#8bfb5502bde4a4d36cfdeea007fcca21d7e382af" @@ -11219,6 +11253,11 @@ pretty-format@^24.9.0: ansi-styles "^3.2.0" react-is "^16.8.4" +pretty-time@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/pretty-time/-/pretty-time-1.1.0.tgz#ffb7429afabb8535c346a34e41873adf3d74dd0e" + integrity sha512-28iF6xPQrP8Oa6uxE6a1biz+lWeTOAPKggvjB8HAs6nVMKZwf5bG++632Dx614hIWgUPkgivRfG+a8uAXGTIbA== + private@^0.1.8: version "0.1.8" resolved "https://registry.npm.taobao.org/private/download/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" @@ -12856,6 +12895,11 @@ stack-utils@^1.0.1: resolved "https://registry.npm.taobao.org/stack-utils/download/stack-utils-1.0.2.tgz?cache=0&sync_timestamp=1576219937837&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstack-utils%2Fdownload%2Fstack-utils-1.0.2.tgz#33eba3897788558bebfc2db059dc158ec36cebb8" integrity sha1-M+ujiXeIVYvr/C2wWdwVjsNs67g= +stackframe@^1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/stackframe/-/stackframe-1.1.1.tgz#ffef0a3318b1b60c3b58564989aca5660729ec71" + integrity sha512-0PlYhdKh6AfFxRyK/v+6/k+/mMfyiEBbTM5L94D0ZytQnJ166wuwoTYLHFWGbs2dpA8Rgq763KGWmN1EQEYHRQ== + state-toggle@^1.0.0: version "1.0.3" resolved "https://registry.npm.taobao.org/state-toggle/download/state-toggle-1.0.3.tgz?cache=0&sync_timestamp=1580045011904&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstate-toggle%2Fdownload%2Fstate-toggle-1.0.3.tgz#e123b16a88e143139b09c6852221bc9815917dfe" @@ -12874,6 +12918,13 @@ static-extend@^0.1.1: resolved "https://registry.npm.taobao.org/statuses/download/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= +std-env@^2.2.1: + version "2.2.1" + resolved "https://registry.npmjs.org/std-env/-/std-env-2.2.1.tgz#2ffa0fdc9e2263e0004c1211966e960948a40f6b" + integrity sha512-IjYQUinA3lg5re/YMlwlfhqNRTzMZMqE+pezevdcTaHceqx8ngEi1alX9nNCk9Sc81fy1fLDeQoaCzeiW1yBOQ== + dependencies: + ci-info "^1.6.0" + stdout-stream@^1.4.0: version "1.4.1" resolved "https://registry.npm.taobao.org/stdout-stream/download/stdout-stream-1.4.1.tgz#5ac174cdd5cd726104aa0c0b2bd83815d8d535de" @@ -14412,6 +14463,20 @@ webpack@^4.27.1, webpack@^4.41.1: watchpack "^1.6.0" webpack-sources "^1.4.1" +webpackbar@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/webpackbar/-/webpackbar-4.0.0.tgz#ee7a87f16077505b5720551af413c8ecd5b1f780" + integrity sha512-k1qRoSL/3BVuINzngj09nIwreD8wxV4grcuhHTD8VJgUbGcy8lQSPqv+bM00B7F+PffwIsQ8ISd4mIwRbr23eQ== + dependencies: + ansi-escapes "^4.2.1" + chalk "^2.4.2" + consola "^2.10.0" + figures "^3.0.0" + pretty-time "^1.1.0" + std-env "^2.2.1" + text-table "^0.2.0" + wrap-ansi "^6.0.0" + websocket-driver@>=0.5.1: version "0.7.3" resolved "https://registry.npm.taobao.org/websocket-driver/download/websocket-driver-0.7.3.tgz#a2d4e0d4f4f116f1e6297eba58b05d430100e9f9" @@ -14550,6 +14615,15 @@ wrap-ansi@^5.1.0: string-width "^3.0.0" strip-ansi "^5.0.0" +wrap-ansi@^6.0.0: + version "6.2.0" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" + integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrappy@1: version "1.0.2" resolved "https://registry.npm.taobao.org/wrappy/download/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" From b5c10cbb7757ab8ac57f3cef4d792a07f4d3b5b8 Mon Sep 17 00:00:00 2001 From: chenbin92 Date: Mon, 11 May 2020 22:41:27 +0800 Subject: [PATCH 06/11] fix: upgrate react-dev-utils (#3190) * fix: upgrate react-dev-utils * v1.2.2-alpha.1 * fix: set transportMode to ws Co-authored-by: ClarkXia --- lerna.json | 2 +- packages/create-ice/package.json | 2 +- packages/icejs/package.json | 22 +-- packages/plugin-config/package.json | 2 +- packages/plugin-core/package.json | 2 +- packages/plugin-helpers/package.json | 2 +- packages/plugin-icestark/package.json | 2 +- packages/plugin-logger/package.json | 2 +- packages/plugin-mpa/package.json | 2 +- packages/plugin-react-app/package.json | 4 +- .../src/config/default.config.js | 2 + packages/plugin-rematch/package.json | 2 +- packages/plugin-request/package.json | 2 +- packages/plugin-router/package.json | 2 +- packages/plugin-service/package.json | 2 +- packages/plugin-ssr/package.json | 2 +- packages/plugin-store/package.json | 2 +- yarn.lock | 187 ++++++++++++++++-- 18 files changed, 197 insertions(+), 46 deletions(-) diff --git a/lerna.json b/lerna.json index 7ada502ba1..7904dff6f3 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.2.1", + "version": "1.2.2-alpha.1", "npmClient": "yarn", "useWorkspaces": true, "packages": [ diff --git a/packages/create-ice/package.json b/packages/create-ice/package.json index c94a436cae..8d476ac129 100644 --- a/packages/create-ice/package.json +++ b/packages/create-ice/package.json @@ -1,6 +1,6 @@ { "name": "create-ice", - "version": "1.2.1", + "version": "1.2.2-alpha.1", "description": "npm init ice", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/icejs/package.json b/packages/icejs/package.json index fd489caf0a..3da04d1678 100644 --- a/packages/icejs/package.json +++ b/packages/icejs/package.json @@ -1,6 +1,6 @@ { "name": "ice.js", - "version": "1.2.1", + "version": "1.2.2-alpha.1", "description": "command line interface and builtin plugin for icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", @@ -25,16 +25,16 @@ }, "dependencies": { "@alib/build-scripts": "^0.1.13", - "build-plugin-ice-config": "1.2.1", - "build-plugin-ice-core": "1.2.1", - "build-plugin-ice-helpers": "1.2.1", - "build-plugin-ice-logger": "1.2.1", - "build-plugin-ice-mpa": "1.2.1", - "build-plugin-ice-request": "1.2.1", - "build-plugin-ice-router": "1.2.1", - "build-plugin-ice-ssr": "1.2.1", - "build-plugin-ice-store": "1.2.1", - "build-plugin-react-app": "1.2.1", + "build-plugin-ice-config": "1.2.2-alpha.1", + "build-plugin-ice-core": "1.2.2-alpha.1", + "build-plugin-ice-helpers": "1.2.2-alpha.1", + "build-plugin-ice-logger": "1.2.2-alpha.1", + "build-plugin-ice-mpa": "1.2.2-alpha.1", + "build-plugin-ice-request": "1.2.2-alpha.1", + "build-plugin-ice-router": "1.2.2-alpha.1", + "build-plugin-ice-ssr": "1.2.2-alpha.1", + "build-plugin-ice-store": "1.2.2-alpha.1", + "build-plugin-react-app": "1.2.2-alpha.1", "chokidar": "^3.3.1", "commander": "^5.0.0", "detect-port": "^1.3.0", diff --git a/packages/plugin-config/package.json b/packages/plugin-config/package.json index 52527c1eeb..9fc0b9c9e2 100644 --- a/packages/plugin-config/package.json +++ b/packages/plugin-config/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-config", - "version": "1.2.1", + "version": "1.2.2-alpha.1", "description": "Define application config in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-core/package.json b/packages/plugin-core/package.json index f0c3f1ef87..93bc4d8e80 100644 --- a/packages/plugin-core/package.json +++ b/packages/plugin-core/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-core", - "version": "1.2.1", + "version": "1.2.2-alpha.1", "description": "the core plugin for icejs.", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-helpers/package.json b/packages/plugin-helpers/package.json index f2ed699806..8fbd4b204b 100644 --- a/packages/plugin-helpers/package.json +++ b/packages/plugin-helpers/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-helpers", - "version": "1.2.1", + "version": "1.2.2-alpha.1", "description": "builtin helpers in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-icestark/package.json b/packages/plugin-icestark/package.json index cdb3360ccb..301e0e510d 100644 --- a/packages/plugin-icestark/package.json +++ b/packages/plugin-icestark/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-icestark", - "version": "1.2.1", + "version": "1.2.2-alpha.1", "description": "Easy use `icestark` in icejs.", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-logger/package.json b/packages/plugin-logger/package.json index c7b70b446b..f43bee36c4 100644 --- a/packages/plugin-logger/package.json +++ b/packages/plugin-logger/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-logger", - "version": "1.2.1", + "version": "1.2.2-alpha.1", "description": "builtin logger in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-mpa/package.json b/packages/plugin-mpa/package.json index 9e2c4e9f62..1cef24c43a 100644 --- a/packages/plugin-mpa/package.json +++ b/packages/plugin-mpa/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-mpa", - "version": "1.2.1", + "version": "1.2.2-alpha.1", "description": "enable mpa project for icejs framework", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-react-app/package.json b/packages/plugin-react-app/package.json index 8be040404c..7c4c173c3c 100644 --- a/packages/plugin-react-app/package.json +++ b/packages/plugin-react-app/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-react-app", - "version": "1.2.1", + "version": "1.2.2-alpha.1", "description": "The basic webpack configuration for ice project", "author": "ice-admin@alibaba-inc.com", "main": "src/index.js", @@ -26,7 +26,7 @@ "lodash": "^4.17.15", "mkcert": "^1.2.0", "path-exists": "^4.0.0", - "react-dev-utils": "^9.1.0", + "react-dev-utils": "^10.2.1", "regenerator-runtime": "^0.13.3", "webpack-bundle-analyzer": "^3.6.0", "webpack-dev-mock": "^0.1.5", diff --git a/packages/plugin-react-app/src/config/default.config.js b/packages/plugin-react-app/src/config/default.config.js index 7b95ad1eed..d8f771c7cb 100644 --- a/packages/plugin-react-app/src/config/default.config.js +++ b/packages/plugin-react-app/src/config/default.config.js @@ -10,6 +10,8 @@ module.exports = { devServer: { disableHostCheck: true, compress: true, + // Use 'ws' instead of 'sockjs-node' on server since webpackHotDevClient is using native websocket + transportMode: 'ws', logLevel: 'silent', clientLogLevel: 'none', hot: true, diff --git a/packages/plugin-rematch/package.json b/packages/plugin-rematch/package.json index ed6dba99d8..85bdd9d451 100644 --- a/packages/plugin-rematch/package.json +++ b/packages/plugin-rematch/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-rematch", - "version": "1.2.1", + "version": "1.2.2-alpha.1", "description": "Easy use `rematch` in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-request/package.json b/packages/plugin-request/package.json index e1e1e53380..cd0c3a105e 100644 --- a/packages/plugin-request/package.json +++ b/packages/plugin-request/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-request", - "version": "1.2.1", + "version": "1.2.2-alpha.1", "description": "request for build-plugin-ice-request", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-router/package.json b/packages/plugin-router/package.json index 2bba4fbae7..ff90369b97 100644 --- a/packages/plugin-router/package.json +++ b/packages/plugin-router/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-router", - "version": "1.2.1", + "version": "1.2.2-alpha.1", "description": "build-plugin-ice-router", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-service/package.json b/packages/plugin-service/package.json index 0779fc6a76..ce3613d0fa 100644 --- a/packages/plugin-service/package.json +++ b/packages/plugin-service/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-service", - "version": "1.2.1", + "version": "1.2.2-alpha.1", "description": "service pulgin", "author": "ice-admin@alibaba-inc.com", "homepage": "https://github.com/ice-lab/icejs#readme", diff --git a/packages/plugin-ssr/package.json b/packages/plugin-ssr/package.json index 823ea0f9a4..29cf3de35a 100644 --- a/packages/plugin-ssr/package.json +++ b/packages/plugin-ssr/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-ssr", - "version": "1.2.1", + "version": "1.2.2-alpha.1", "description": "ssr plugin", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-store/package.json b/packages/plugin-store/package.json index 38932f9600..fa6c4a2866 100644 --- a/packages/plugin-store/package.json +++ b/packages/plugin-store/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-store", - "version": "1.2.1", + "version": "1.2.2-alpha.1", "description": "builtin `icestore` in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/yarn.lock b/yarn.lock index bb4663f340..e3e8e9cd90 100644 --- a/yarn.lock +++ b/yarn.lock @@ -39,7 +39,7 @@ dependencies: "@babel/highlight" "^7.0.0" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.8.3": +"@babel/code-frame@7.8.3", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.8.3": version "7.8.3" resolved "https://registry.npm.taobao.org/@babel/code-frame/download/@babel/code-frame-7.8.3.tgz?cache=0&sync_timestamp=1578953126105&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fcode-frame%2Fdownload%2F%40babel%2Fcode-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e" integrity sha1-M+JZA9dIEYFTThLsCiXxa2/PQZ4= @@ -3642,6 +3642,16 @@ browserify-zlib@^0.2.0: dependencies: pako "~1.0.5" +browserslist@4.10.0: + version "4.10.0" + resolved "https://registry.npm.taobao.org/browserslist/download/browserslist-4.10.0.tgz#f179737913eaf0d2b98e4926ac1ca6a15cbcc6a9" + integrity sha1-8XlzeRPq8NK5jkkmrBymoVy8xqk= + dependencies: + caniuse-lite "^1.0.30001035" + electron-to-chromium "^1.3.378" + node-releases "^1.1.52" + pkg-up "^3.1.0" + browserslist@4.7.0: version "4.7.0" resolved "https://registry.npm.taobao.org/browserslist/download/browserslist-4.7.0.tgz#9ee89225ffc07db03409f2fee524dc8227458a17" @@ -3940,6 +3950,11 @@ caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000989, caniuse-lite@^1.0.30001038, can resolved "https://registry.npm.taobao.org/caniuse-lite/download/caniuse-lite-1.0.30001041.tgz#c2ea138dafc6fe03877921ddcddd4a02a14daf76" integrity sha1-wuoTja/G/gOHeSHdzd1KAqFNr3Y= +caniuse-lite@^1.0.30001035: + version "1.0.30001055" + resolved "https://registry.npm.taobao.org/caniuse-lite/download/caniuse-lite-1.0.30001055.tgz#7b52c3537f7a8c0408aca867e83d2b04268b54cd" + integrity sha1-e1LDU396jAQIrKhn6D0rBCaLVM0= + capture-exit@^2.0.0: version "2.0.0" resolved "https://registry.npm.taobao.org/capture-exit/download/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" @@ -4059,6 +4074,21 @@ chokidar@^2.0.4, chokidar@^2.1.8: optionalDependencies: fsevents "^1.2.7" +chokidar@^3.3.0: + version "3.4.0" + resolved "https://registry.npm.taobao.org/chokidar/download/chokidar-3.4.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchokidar%2Fdownload%2Fchokidar-3.4.0.tgz#b30611423ce376357c765b9b8f904b9fba3c0be8" + integrity sha1-swYRQjzjdjV8dlubj5BLn7o8C+g= + dependencies: + anymatch "~3.1.1" + braces "~3.0.2" + glob-parent "~5.1.0" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.4.0" + optionalDependencies: + fsevents "~2.1.2" + chokidar@^3.3.1: version "3.3.1" resolved "https://registry.npm.taobao.org/chokidar/download/chokidar-3.3.1.tgz?cache=0&sync_timestamp=1584609518131&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchokidar%2Fdownload%2Fchokidar-3.3.1.tgz#c84e5b3d18d9a4d77558fef466b1bf16bbeb3450" @@ -4671,6 +4701,15 @@ cross-spawn@6.0.5, cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" +cross-spawn@7.0.1: + version "7.0.1" + resolved "https://registry.npm.taobao.org/cross-spawn/download/cross-spawn-7.0.1.tgz#0ab56286e0f7c24e153d04cc2aa027e43a9a5d14" + integrity sha1-CrVihuD3wk4VPQTMKqAn5DqaXRQ= + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + cross-spawn@^3.0.0: version "3.0.1" resolved "https://registry.npm.taobao.org/cross-spawn/download/cross-spawn-3.0.1.tgz#1256037ecb9f0c5f79e3d6ef135e30770184b982" @@ -5453,6 +5492,11 @@ electron-to-chromium@^1.3.247, electron-to-chromium@^1.3.390: resolved "https://registry.npm.taobao.org/electron-to-chromium/download/electron-to-chromium-1.3.403.tgz#c8bab4e2e72bf78bc28bad1cc355c061f9cc1918" integrity sha1-yLq04ucr94vCi60cw1XAYfnMGRg= +electron-to-chromium@^1.3.378: + version "1.3.432" + resolved "https://registry.npm.taobao.org/electron-to-chromium/download/electron-to-chromium-1.3.432.tgz#3bf7b191978ff2e8bc3caf811bb52b1e9f9eab25" + integrity sha1-O/exkZeP8ui8PK+BG7UrHp+eqyU= + elliptic@^6.0.0: version "6.5.2" resolved "https://registry.npm.taobao.org/elliptic/download/elliptic-6.5.2.tgz#05c5678d7173c049d8ca433552224a495d0e3762" @@ -5613,6 +5657,11 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1 resolved "https://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz?cache=0&sync_timestamp=1586278520081&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fescape-string-regexp%2Fdownload%2Fescape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= +escape-string-regexp@2.0.0: + version "2.0.0" + resolved "https://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha1-owME6Z2qMuI7L9IPUbq9B8/8o0Q= + escodegen@1.x.x, escodegen@^1.6.1, escodegen@^1.9.1: version "1.14.1" resolved "https://registry.npm.taobao.org/escodegen/download/escodegen-1.14.1.tgz?cache=0&sync_timestamp=1580955044375&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fescodegen%2Fdownload%2Fescodegen-1.14.1.tgz#ba01d0c8278b5e95a9a45350142026659027a457" @@ -6185,6 +6234,11 @@ filesize@3.6.1, filesize@^3.6.1: resolved "https://registry.npm.taobao.org/filesize/download/filesize-3.6.1.tgz?cache=0&sync_timestamp=1582340569604&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffilesize%2Fdownload%2Ffilesize-3.6.1.tgz#090bb3ee01b6f801a8a8be99d31710b3422bb317" integrity sha1-CQuz7gG2+AGoqL6Z0xcQs0Irsxc= +filesize@6.0.1: + version "6.0.1" + resolved "https://registry.npm.taobao.org/filesize/download/filesize-6.0.1.tgz#f850b509909c7c86f7e450ea19006c31c2ed3d2f" + integrity sha1-+FC1CZCcfIb35FDqGQBsMcLtPS8= + fill-range@^4.0.0: version "4.0.0" resolved "https://registry.npm.taobao.org/fill-range/download/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" @@ -6249,6 +6303,14 @@ find-up@3.0.0, find-up@^3.0.0: dependencies: locate-path "^3.0.0" +find-up@4.1.0, find-up@^4.0.0: + version "4.1.0" + resolved "https://registry.npm.taobao.org/find-up/download/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha1-l6/n1s3AvFkoWEt8jXsW6KmqXRk= + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + find-up@^1.0.0: version "1.1.2" resolved "https://registry.npm.taobao.org/find-up/download/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" @@ -6264,14 +6326,6 @@ find-up@^2.0.0, find-up@^2.1.0: dependencies: locate-path "^2.0.0" -find-up@^4.0.0: - version "4.1.0" - resolved "https://registry.npm.taobao.org/find-up/download/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" - integrity sha1-l6/n1s3AvFkoWEt8jXsW6KmqXRk= - dependencies: - locate-path "^5.0.0" - path-exists "^4.0.0" - flat-cache@^2.0.1: version "2.0.1" resolved "https://registry.npm.taobao.org/flat-cache/download/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" @@ -6332,6 +6386,20 @@ fork-ts-checker-webpack-plugin@1.5.0: tapable "^1.0.0" worker-rpc "^0.1.0" +fork-ts-checker-webpack-plugin@3.1.1: + version "3.1.1" + resolved "https://registry.npm.taobao.org/fork-ts-checker-webpack-plugin/download/fork-ts-checker-webpack-plugin-3.1.1.tgz#a1642c0d3e65f50c2cc1742e9c0a80f441f86b19" + integrity sha1-oWQsDT5l9QwswXQunAqA9EH4axk= + dependencies: + babel-code-frame "^6.22.0" + chalk "^2.4.1" + chokidar "^3.3.0" + micromatch "^3.1.10" + minimatch "^3.0.4" + semver "^5.6.0" + tapable "^1.0.0" + worker-rpc "^0.1.0" + form-data@~2.3.2: version "2.3.3" resolved "https://registry.npm.taobao.org/form-data/download/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" @@ -7467,6 +7535,25 @@ inquirer@6.5.0: strip-ansi "^5.1.0" through "^2.3.6" +inquirer@7.0.4: + version "7.0.4" + resolved "https://registry.npm.taobao.org/inquirer/download/inquirer-7.0.4.tgz#99af5bde47153abca23f5c7fc30db247f39da703" + integrity sha1-ma9b3kcVOryiP1x/ww2yR/OdpwM= + dependencies: + ansi-escapes "^4.2.1" + chalk "^2.4.2" + cli-cursor "^3.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^3.0.0" + lodash "^4.17.15" + mute-stream "0.0.8" + run-async "^2.2.0" + rxjs "^6.5.3" + string-width "^4.1.0" + strip-ansi "^5.1.0" + through "^2.3.6" + inquirer@^6.2.0: version "6.5.2" resolved "https://registry.npm.taobao.org/inquirer/download/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" @@ -7711,6 +7798,11 @@ is-directory@^0.3.1: resolved "https://registry.npm.taobao.org/is-directory/download/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" integrity sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE= +is-docker@^2.0.0: + version "2.0.0" + resolved "https://registry.npm.taobao.org/is-docker/download/is-docker-2.0.0.tgz#2cb0df0e75e2d064fe1864c37cdeacb7b2dcf25b" + integrity sha1-LLDfDnXi0GT+GGTDfN6st7Lc8ls= + is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.npm.taobao.org/is-extendable/download/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" @@ -7974,6 +8066,13 @@ is-wsl@^1.1.0: resolved "https://registry.npm.taobao.org/is-wsl/download/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= +is-wsl@^2.1.1: + version "2.2.0" + resolved "https://registry.npm.taobao.org/is-wsl/download/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" + integrity sha1-dKTHbnfKn9P5MvKQwX6jJs0VcnE= + dependencies: + is-docker "^2.0.0" + isarray@0.0.1: version "0.0.1" resolved "https://registry.npm.taobao.org/isarray/download/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" @@ -9793,6 +9892,11 @@ node-releases@^1.1.29, node-releases@^1.1.53: resolved "https://registry.npm.taobao.org/node-releases/download/node-releases-1.1.53.tgz#2d821bfa499ed7c5dffc5e2f28c88e78a08ee3f4" integrity sha1-LYIb+kme18Xf/F4vKMiOeKCO4/Q= +node-releases@^1.1.52: + version "1.1.55" + resolved "https://registry.npm.taobao.org/node-releases/download/node-releases-1.1.55.tgz#8af23b7c561d8e2e6e36a46637bab84633b07cee" + integrity sha1-ivI7fFYdji5uNqRmN7q4RjOwfO4= + node-sass@^4.12.0: version "4.13.1" resolved "https://registry.npm.taobao.org/node-sass/download/node-sass-4.13.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnode-sass%2Fdownload%2Fnode-sass-4.13.1.tgz#9db5689696bb2eec2c32b98bfea4c7a2e992d0a3" @@ -10167,6 +10271,14 @@ open@^6.3.0: dependencies: is-wsl "^1.1.0" +open@^7.0.2: + version "7.0.3" + resolved "https://registry.npm.taobao.org/open/download/open-7.0.3.tgz#db551a1af9c7ab4c7af664139930826138531c48" + integrity sha1-21UaGvnHq0x69mQTmTCCYThTHEg= + dependencies: + is-docker "^2.0.0" + is-wsl "^2.1.1" + opencollective-postinstall@^2.0.2: version "2.0.2" resolved "https://registry.npm.taobao.org/opencollective-postinstall/download/opencollective-postinstall-2.0.2.tgz#5657f1bede69b6e33a45939b061eb53d3c6c3a89" @@ -10755,7 +10867,7 @@ pkg-up@2.0.0, pkg-up@^2.0.0: dependencies: find-up "^2.1.0" -pkg-up@^3.1.0: +pkg-up@3.1.0, pkg-up@^3.1.0: version "3.1.0" resolved "https://registry.npm.taobao.org/pkg-up/download/pkg-up-3.1.0.tgz#100ec235cc150e4fd42519412596a28512a0def5" integrity sha1-EA7CNcwVDk/UJRlBJZaihRKg3vU= @@ -11550,7 +11662,37 @@ rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" -react-dev-utils@^9.0.4, react-dev-utils@^9.1.0: +react-dev-utils@^10.2.1: + version "10.2.1" + resolved "https://registry.npm.taobao.org/react-dev-utils/download/react-dev-utils-10.2.1.tgz#f6de325ae25fa4d546d09df4bb1befdc6dd19c19" + integrity sha1-9t4yWuJfpNVG0J30uxvv3G3RnBk= + dependencies: + "@babel/code-frame" "7.8.3" + address "1.1.2" + browserslist "4.10.0" + chalk "2.4.2" + cross-spawn "7.0.1" + detect-port-alt "1.1.6" + escape-string-regexp "2.0.0" + filesize "6.0.1" + find-up "4.1.0" + fork-ts-checker-webpack-plugin "3.1.1" + global-modules "2.0.0" + globby "8.0.2" + gzip-size "5.1.1" + immer "1.10.0" + inquirer "7.0.4" + is-root "2.1.0" + loader-utils "1.2.3" + open "^7.0.2" + pkg-up "3.1.0" + react-error-overlay "^6.0.7" + recursive-readdir "2.2.2" + shell-quote "1.7.2" + strip-ansi "6.0.0" + text-table "0.2.0" + +react-dev-utils@^9.0.4: version "9.1.0" resolved "https://registry.npm.taobao.org/react-dev-utils/download/react-dev-utils-9.1.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Freact-dev-utils%2Fdownload%2Freact-dev-utils-9.1.0.tgz#3ad2bb8848a32319d760d0a84c56c14bdaae5e81" integrity sha1-OtK7iEijIxnXYNCoTFbBS9quXoE= @@ -11591,7 +11733,7 @@ react-dom@^16.12.0: prop-types "^15.6.2" scheduler "^0.19.1" -react-error-overlay@^6.0.3: +react-error-overlay@^6.0.3, react-error-overlay@^6.0.7: version "6.0.7" resolved "https://registry.npm.taobao.org/react-error-overlay/download/react-error-overlay-6.0.7.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Freact-error-overlay%2Fdownload%2Freact-error-overlay-6.0.7.tgz#1dcfb459ab671d53f660a991513cb2f0a0553108" integrity sha1-Hc+0WatnHVP2YKmRUTyy8KBVMQg= @@ -11812,6 +11954,13 @@ readdirp@~3.3.0: dependencies: picomatch "^2.0.7" +readdirp@~3.4.0: + version "3.4.0" + resolved "https://registry.npm.taobao.org/readdirp/download/readdirp-3.4.0.tgz#9fdccdf9e9155805449221ac645e8303ab5b9ada" + integrity sha1-n9zN+ekVWAVEkiGsZF6DA6tbmto= + dependencies: + picomatch "^2.2.1" + realpath-native@^1.1.0: version "1.1.0" resolved "https://registry.npm.taobao.org/realpath-native/download/realpath-native-1.1.0.tgz#2003294fea23fb0672f2476ebe22fcf498a2d65c" @@ -13133,6 +13282,13 @@ strip-ansi@5.2.0, strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@6.0.0, strip-ansi@^6.0.0: + version "6.0.0" + resolved "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-6.0.0.tgz?cache=0&sync_timestamp=1573280518303&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstrip-ansi%2Fdownload%2Fstrip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha1-CxVx3XZpzNTz4G4U7x7tJiJa5TI= + dependencies: + ansi-regex "^5.0.0" + strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-3.0.1.tgz?cache=0&sync_timestamp=1573280518303&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstrip-ansi%2Fdownload%2Fstrip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" @@ -13147,13 +13303,6 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" -strip-ansi@^6.0.0: - version "6.0.0" - resolved "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-6.0.0.tgz?cache=0&sync_timestamp=1573280518303&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstrip-ansi%2Fdownload%2Fstrip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" - integrity sha1-CxVx3XZpzNTz4G4U7x7tJiJa5TI= - dependencies: - ansi-regex "^5.0.0" - strip-bom@^2.0.0: version "2.0.0" resolved "https://registry.npm.taobao.org/strip-bom/download/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" From 9442e9b93166705a706d0e49900a07156e38967d Mon Sep 17 00:00:00 2001 From: chenbin92 Date: Tue, 12 May 2020 14:02:39 +0800 Subject: [PATCH 07/11] feat: support route wrappers (#3189) * feat: support route wrappers * feat: support pageConfig wrappers * refactor: wrappers api * docs: add wrappers api to ruotes * fix: destructuring routes --- docs/guide/basic/router.md | 3 +++ .../basic-spa/src/components/WrapperPage/index.tsx | 11 +++++++++++ examples/basic-spa/src/pages/Dashboard/index.tsx | 5 +++++ examples/basic-spa/src/routes.ts | 4 +++- packages/plugin-router/src/runtime/Router.tsx | 8 ++++++-- packages/plugin-router/src/types/base.ts | 4 ++++ 6 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 examples/basic-spa/src/components/WrapperPage/index.tsx diff --git a/docs/guide/basic/router.md b/docs/guide/basic/router.md index 55e748d5a9..3346771eae 100644 --- a/docs/guide/basic/router.md +++ b/docs/guide/basic/router.md @@ -16,6 +16,7 @@ icejs 提供了 **配置式路由** 和 **约定式路由** 两种方案,默 import UserLayout from '@/Layouts/UserLayout'; import UserLogin from '@/pages/UserLogin'; import NotFound from '@/components/NotFound'; +import wrapperPage from '@/components/WrapperPage'; const routerConfig = [ // 分组路由,children 里的路由会将父节点的 component 作为布局组件 @@ -27,6 +28,8 @@ const routerConfig = [ path: '/login', exact: true, component: UserLogin, + // 配置路由的高阶组件 + wrappers: [wrapperPage] }, { path: '/', diff --git a/examples/basic-spa/src/components/WrapperPage/index.tsx b/examples/basic-spa/src/components/WrapperPage/index.tsx new file mode 100644 index 0000000000..151d93906c --- /dev/null +++ b/examples/basic-spa/src/components/WrapperPage/index.tsx @@ -0,0 +1,11 @@ +import React from 'react'; + +const wrapperPage = (PageComponent) => { + console.log('custom route wrapper') + const WrappedPage = (props) => { + return + }; + return WrappedPage; +}; + +export default wrapperPage; diff --git a/examples/basic-spa/src/pages/Dashboard/index.tsx b/examples/basic-spa/src/pages/Dashboard/index.tsx index 388d64b8ed..d3d7f0df68 100644 --- a/examples/basic-spa/src/pages/Dashboard/index.tsx +++ b/examples/basic-spa/src/pages/Dashboard/index.tsx @@ -31,4 +31,9 @@ const Dashboard = (props) => { ); }; + +Dashboard.pageConfig = { + title: 'Dashboard Page' +}; + export default Dashboard; diff --git a/examples/basic-spa/src/routes.ts b/examples/basic-spa/src/routes.ts index 7dab29e479..586b9ee513 100644 --- a/examples/basic-spa/src/routes.ts +++ b/examples/basic-spa/src/routes.ts @@ -1,5 +1,6 @@ import { lazy } from 'ice'; import Layout from '@/layouts'; +import wrapperPage from '@/components/WrapperPage'; const Dashboard = lazy(() => import('@/pages/Dashboard')); const Home = lazy(() => import('@/pages/Home')); @@ -14,7 +15,8 @@ export default [ { path: '/dashboard', exact: true, - component: Dashboard + component: Dashboard, + wrappers: [wrapperPage] }, { path: '/about', diff --git a/packages/plugin-router/src/runtime/Router.tsx b/packages/plugin-router/src/runtime/Router.tsx index 72c946917b..baff8926dd 100644 --- a/packages/plugin-router/src/runtime/Router.tsx +++ b/packages/plugin-router/src/runtime/Router.tsx @@ -38,10 +38,14 @@ function getRouteComponent(component, routerWrappers?: IRouteWrapper[]) { function parseRoutes(routes: RouteItemProps[]) { return routes.map((route) => { - const { children, component, routeWrappers, ...others } = route; + const { children, component, routeWrappers, wrappers, ...others } = route; + let mergedRouteWrappers = routeWrappers; + if (wrappers && wrappers.length) { + mergedRouteWrappers = routeWrappers.concat(route.wrappers); + } const parsedRoute: IRouterConfig = { ...others }; if (component) { - parsedRoute.component = getRouteComponent(component, children ? [] : routeWrappers); + parsedRoute.component = getRouteComponent(component, children ? [] : mergedRouteWrappers); } if (children) { parsedRoute.children = parseRoutes(children); diff --git a/packages/plugin-router/src/types/base.ts b/packages/plugin-router/src/types/base.ts index a596829813..f636b9193d 100644 --- a/packages/plugin-router/src/types/base.ts +++ b/packages/plugin-router/src/types/base.ts @@ -29,5 +29,9 @@ export interface RouteItemProps extends Omit { component?: React.ComponentType> | React.ComponentType | IDynamicImportComponent; + // built-in route wrappers routeWrappers?: IRouteWrapper[]; + + // custom route wrappers + wrappers?: IRouteWrapper[]; }; From c8bcd14c842507de0e45671699ec20214c2efe9f Mon Sep 17 00:00:00 2001 From: chenbin92 Date: Thu, 14 May 2020 13:23:57 +0800 Subject: [PATCH 08/11] feat: enhance use request types (#3195) * feat: enhance useRequest types * chore: remove comments * docs: useRequest usage * v1.2.2-alpha.2 * docs: add withFullResponse api * docs: refactor request docs * chore: typo * chore: useRequest docs * docs: fix typo * docs: optimize title --- docs/guide/basic/request.md | 275 +++++++++++++++--- .../basic-request/src/pages/Home/service.ts | 3 +- lerna.json | 2 +- packages/create-ice/package.json | 2 +- packages/icejs/package.json | 22 +- packages/plugin-config/package.json | 2 +- packages/plugin-core/package.json | 2 +- packages/plugin-helpers/package.json | 2 +- packages/plugin-icestark/package.json | 2 +- packages/plugin-logger/package.json | 2 +- packages/plugin-mpa/package.json | 2 +- packages/plugin-react-app/package.json | 2 +- packages/plugin-rematch/package.json | 2 +- packages/plugin-request/package.json | 2 +- packages/plugin-request/request/useRequest.ts | 29 +- packages/plugin-router/package.json | 2 +- packages/plugin-service/package.json | 2 +- packages/plugin-ssr/package.json | 2 +- packages/plugin-store/package.json | 2 +- 19 files changed, 289 insertions(+), 70 deletions(-) diff --git a/docs/guide/basic/request.md b/docs/guide/basic/request.md index 30c99cb6c1..f7bd277b49 100644 --- a/docs/guide/basic/request.md +++ b/docs/guide/basic/request.md @@ -3,9 +3,159 @@ title: 数据请求 order: 4 --- -大多数前端应用都需要通过 HTTP 协议与后端服务器通讯。框架内置提供了请求功能,基于社区主流的 axios 进行封装,提供了 request 和 useRequest Hooks 方法。 +大多数前端应用都需要通过 HTTP 协议与后端服务器通讯。在 icejs 框架中内置约定和规范了一套从 UI 交互到请求服务端数据的完整方案,更进一步简化了应用的数据请求流程,基于此提供了 request 和 useRequest Hooks 方法。 + +## 目录约定 + +目录组织如下: + +```diff + src + ├── models ++├── services // 定义全局数据请求 ++│ └── user.ts + └── pages + | ├── Home + | │   ├── models ++| │   ├── services // 定义页面级数据请求 ++| │   | └── repo.ts + | │   ├── components + | │   | └── Todo + | | │   | ├── index.tsx + | | │   | ├── model.ts ++| | │   | └── service.ts // 定义组件级数据请求 + | │   └── index.tsx + | ├── About + | │   ├── services + | │   ├── components + | │   └── index.tsx + └── app.ts +``` + +## 定义 service + +通过调用 request 定义数据请求如下: + +```ts +import { request } from 'ice'; + +export default { + // 简单场景 + async getUser() { + return await request('/api/user'); + }, -## request + // 参数场景 + async getRepo(id) { + return await request(`/api/repo/${id}`); + }, + + // 格式化返回值 + async getDetail(params) { + const data = await request({ + url: `/api/detail`; + params, + }); + + return data.map(item => { + return { + ...item, + price: item.oldPrice, + text: item.status === '1' ? '确定' : '取消' + }; + }); + } +} +``` + +## 消费 service + +消费 service 主要有两种方式: + +* 在模型中调用 service:`service` -> `model` -> `view` +* 在视图中调用 service:`service` -> `view` + +### 在模型中调用 service + +* `service`:约定数据请求统一管理在 services 目录下; +* `model`:约定数据请求统一在 models 里进行调用; +* `view`:最终在视图里通过调用 models 的 effects 的方法触发数据请求。 + +在模型中调用定义好的 service: + +```ts +import userService from '@/services/user'; + +// src/models/user.ts +export default { + state: { + name: 'taoxiaobao', + age: 20 + }, + reducers: { + update(prevState, payload) { + return { ...prevState, ...payload }; + } + }, + effects: (dispatch) => { + async fetchUserInfo() { + const data = await userService.getUser(); + dispatch.user.update(data); + } + } +} +``` + +* 在视图中调用模型方法: + +```ts +import React, { useEffect } from 'react'; +import { store } from 'ice'; + +const HomePage = () => { + // 调用定义的 user 模型 + const [ userState, userDispatchers ] = store.useModel('user'); + + useEffect(() => { + // 调用 user 模型中的 fetchUserInfo 方法 + userDispatchers.fetchUserInfo(); + }, []); + + return ( + <>Home + ); +} +``` + +### 在视图中调用 service + +* `service`:约定数据请求统一管理在 services 目录下; +* `view`:最终在视图里通过 useRequest 直接调用 service 触发数据请求。 + +```ts +import React, { useEffect } from 'react'; +import { useRequest } from 'ice'; +import userService from '@/services/user'; + +export default function HomePage() { + // 调用 service + const { data, error, isLoading, request } = useRequest(userService.getUser); + + useEffect(() => { + // 触发数据请求 + request(); + }, []); + + + return ( + <>Home + ); +} +``` + +## API + +### request request 基于 axios 进行封装,在使用上与 axios 保持一致,使用方式如下: @@ -15,7 +165,7 @@ import { request } from 'ice' async function getList() { try { const data = await request({ - url: '/api/list' + url: '/api/user' }); console.log(data); } catch (error) { @@ -24,8 +174,6 @@ async function getList() { } ``` -> 注意:request API 当前并未返回整个 response,如有需求可先在 issue 中反馈 - 常用使用方式: ```js @@ -39,6 +187,7 @@ RequestConfig: ```js { + // `url` is the server URL that will be used for the request url: '/user', // `method` is the request method to be used when making the request method: 'get', // default @@ -63,53 +212,108 @@ RequestConfig: // `responseType` indicates the type of data that the server will respond with // options are: 'arraybuffer', 'document', 'json', 'text', 'stream' responseType: 'json', // default - // `validateStatus` defines whether to resolve or reject the promise for a given - // HTTP response status code. If `validateStatus` returns `true` the promise will be resolved; otherwise, the promise will be rejected. - validateStatus: function (status) { - return status >= 200 && status < 300; // default - }, + // should be made return full response + withFullResponse: false, +} +``` + +更完整的配置请 [参考](https://github.com/axios/axios#request-config) + +request 默认只返回服务端响应的数据,并未返回整个 response,如需返回可以设置 `withFullResponse` 属性,完整的 response 返回格式如下: + +Response Schema: + +```ts +{ + // `data` is the response that was provided by the server + data: {}, + + // `status` is the HTTP status code from the server response + status: 200, + + // `statusText` is the HTTP status message from the server response + statusText: 'OK', + + // `headers` the HTTP headers that the server responded with + // All header names are lower cased and can be accessed using the bracket notation. + // Example: `response.headers['content-type']` + headers: {}, + + // `config` is the config that was provided to `axios` for the request + config: {}, + + // `request` is the request that generated this response + // It is the last ClientRequest instance in node.js (in redirects) + // and an XMLHttpRequest instance in the browser + request: {} } ``` -更完整的配置请参考:https://github.com/axios/axios#request-config +### useRequest + +* 可以用在 Function Component,使用 useRequest 可以极大的简化对请求状态(error/loading)的管理。 +* 可以接收一个 `Object` 或者是 `(...args)=> any` 作为参数。 -## useRequest +#### 传入对象作为参数 -useRequest 用在 Function Component,使用 useRequest 可以极大的简化对请求状态(错误/loading)的管理: +```ts +const { data, loading, error, request } = useRequest(options: RequestConfig); +``` -```jsx +使用示例: + +```ts import { useRequest } from 'ice'; -function ListView(props) { - const { data, loading, error, request } = useRequest({ - url: '/api/list', - method: 'GET', +export default function HomePage() { + const { data, error, isLoading, request } = useRequest({ + url: '/api/getRepo', + params: { + id: 123 + } }); - const dataSource = data ? data.dataSource : []; useEffect(() => { - // 实际请求配置会跟 useRequest 的参数合并 - request({ - params: { a: 1 } - }); + request(); + }, []); + + + return ( + <>Home + ); +} +``` + +#### 传入函数作为参数 + +```ts +const { data, loading, error, request } = useRequest((...args: any[]) => any); +``` + +使用示例: + +```ts +// src/pages/Home/index.tsx +import { useRequest } from 'ice'; +import services from '@/services'; + +export default function HomePage() { + const { data, error, isLoading, request } = useRequest(services.getRepo); + + useEffect(() => { + // 动态传入参数 + const id = 123; + request(id); }, []); + return ( - <> - {error &&
{error.message}
} - {loading ? ( -
loading....
- ) : ( - (dataSource || []).map(item => { - return
{item.name}
; - }) - )} - + <>Home ); } ``` -## 请求配置 +### 请求配置 在实际项目中通常需要对请求进行全局统一的封装,例如配置请求的 baseURL、统一 header、拦截请求和响应等等,这时只需要在应用的的 appConfig 中进行配置即可。 @@ -118,6 +322,9 @@ import { createApp } from 'ice'; const appConfig = { request: { + // 可选的,全局设置 request 是否返回 response 对象,默认为 false + withFullResponse: false, + baseURL: '/api', headers: {}, // ...RequestConfig 其他参数 diff --git a/examples/basic-request/src/pages/Home/service.ts b/examples/basic-request/src/pages/Home/service.ts index 4cc6cc21ba..b228423aeb 100644 --- a/examples/basic-request/src/pages/Home/service.ts +++ b/examples/basic-request/src/pages/Home/service.ts @@ -6,7 +6,8 @@ async function customFetch (url) { } export default { - async getRepo() { + async getRepo(id: number) { + console.log(id); return await customFetch('/api/repo') }, diff --git a/lerna.json b/lerna.json index 7904dff6f3..d17456dbcf 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "npmClient": "yarn", "useWorkspaces": true, "packages": [ diff --git a/packages/create-ice/package.json b/packages/create-ice/package.json index 8d476ac129..144e8def99 100644 --- a/packages/create-ice/package.json +++ b/packages/create-ice/package.json @@ -1,6 +1,6 @@ { "name": "create-ice", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "description": "npm init ice", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/icejs/package.json b/packages/icejs/package.json index 3da04d1678..e7fb450ba1 100644 --- a/packages/icejs/package.json +++ b/packages/icejs/package.json @@ -1,6 +1,6 @@ { "name": "ice.js", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "description": "command line interface and builtin plugin for icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", @@ -25,16 +25,16 @@ }, "dependencies": { "@alib/build-scripts": "^0.1.13", - "build-plugin-ice-config": "1.2.2-alpha.1", - "build-plugin-ice-core": "1.2.2-alpha.1", - "build-plugin-ice-helpers": "1.2.2-alpha.1", - "build-plugin-ice-logger": "1.2.2-alpha.1", - "build-plugin-ice-mpa": "1.2.2-alpha.1", - "build-plugin-ice-request": "1.2.2-alpha.1", - "build-plugin-ice-router": "1.2.2-alpha.1", - "build-plugin-ice-ssr": "1.2.2-alpha.1", - "build-plugin-ice-store": "1.2.2-alpha.1", - "build-plugin-react-app": "1.2.2-alpha.1", + "build-plugin-ice-config": "1.2.2-alpha.2", + "build-plugin-ice-core": "1.2.2-alpha.2", + "build-plugin-ice-helpers": "1.2.2-alpha.2", + "build-plugin-ice-logger": "1.2.2-alpha.2", + "build-plugin-ice-mpa": "1.2.2-alpha.2", + "build-plugin-ice-request": "1.2.2-alpha.2", + "build-plugin-ice-router": "1.2.2-alpha.2", + "build-plugin-ice-ssr": "1.2.2-alpha.2", + "build-plugin-ice-store": "1.2.2-alpha.2", + "build-plugin-react-app": "1.2.2-alpha.2", "chokidar": "^3.3.1", "commander": "^5.0.0", "detect-port": "^1.3.0", diff --git a/packages/plugin-config/package.json b/packages/plugin-config/package.json index 9fc0b9c9e2..2c77130bfd 100644 --- a/packages/plugin-config/package.json +++ b/packages/plugin-config/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-config", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "description": "Define application config in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-core/package.json b/packages/plugin-core/package.json index 93bc4d8e80..2e5cd4862b 100644 --- a/packages/plugin-core/package.json +++ b/packages/plugin-core/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-core", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "description": "the core plugin for icejs.", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-helpers/package.json b/packages/plugin-helpers/package.json index 8fbd4b204b..7e10326c2e 100644 --- a/packages/plugin-helpers/package.json +++ b/packages/plugin-helpers/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-helpers", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "description": "builtin helpers in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-icestark/package.json b/packages/plugin-icestark/package.json index 301e0e510d..5c5962a238 100644 --- a/packages/plugin-icestark/package.json +++ b/packages/plugin-icestark/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-icestark", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "description": "Easy use `icestark` in icejs.", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-logger/package.json b/packages/plugin-logger/package.json index f43bee36c4..9552f19213 100644 --- a/packages/plugin-logger/package.json +++ b/packages/plugin-logger/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-logger", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "description": "builtin logger in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-mpa/package.json b/packages/plugin-mpa/package.json index 1cef24c43a..58a1cc86c2 100644 --- a/packages/plugin-mpa/package.json +++ b/packages/plugin-mpa/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-mpa", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "description": "enable mpa project for icejs framework", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-react-app/package.json b/packages/plugin-react-app/package.json index 7c4c173c3c..52557db5f8 100644 --- a/packages/plugin-react-app/package.json +++ b/packages/plugin-react-app/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-react-app", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "description": "The basic webpack configuration for ice project", "author": "ice-admin@alibaba-inc.com", "main": "src/index.js", diff --git a/packages/plugin-rematch/package.json b/packages/plugin-rematch/package.json index 85bdd9d451..03c884caa0 100644 --- a/packages/plugin-rematch/package.json +++ b/packages/plugin-rematch/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-rematch", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "description": "Easy use `rematch` in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-request/package.json b/packages/plugin-request/package.json index cd0c3a105e..05ecd4e27d 100644 --- a/packages/plugin-request/package.json +++ b/packages/plugin-request/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-request", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "description": "request for build-plugin-ice-request", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-request/request/useRequest.ts b/packages/plugin-request/request/useRequest.ts index 6c09eb1add..cbbd56d209 100644 --- a/packages/plugin-request/request/useRequest.ts +++ b/packages/plugin-request/request/useRequest.ts @@ -2,14 +2,24 @@ import { useReducer, useCallback, useRef } from 'react'; import { AxiosRequestConfig } from 'axios'; import customRequest from './request'; -interface Result { +interface IResult { data: D; error: Error | undefined; loading: boolean; - request: (config?: AxiosRequestConfig) => Promise; } -type Noop = (...args: any[]) => any; +type IOptionFn = (...args: any[]) => any; +type IOptionType = IOptionFn | AxiosRequestConfig; + +interface IOptionResult extends IResult { + request: (args?: AxiosRequestConfig) => void; +} + +interface IServiceResult extends IResult { + request: (...args: Parameters) => void; +} + +type IUseRequest = (options: T) => T extends IOptionFn ? IServiceResult : IOptionResult; /** * Hooks to make ajax request @@ -21,7 +31,7 @@ type Noop = (...args: any[]) => any; * @param {boolean} loading - loading status of the request * @param {function} request - function to make the request manually */ -function useRequest(options: AxiosRequestConfig | Noop): Result { +const useRequest = function (options) { const initialState = Object.assign( { data: null, @@ -35,7 +45,7 @@ function useRequest(options: AxiosRequestConfig | Noop): Result { * Method to make request manually * @param {object} config - axios config to shallow merged with options before making request */ - const request = usePersistFn(async (config?: AxiosRequestConfig) => { + const request = usePersistFn(async (args) => { try { dispatch({ type: 'loading' @@ -43,11 +53,12 @@ function useRequest(options: AxiosRequestConfig | Noop): Result { let data; if (typeof options === 'function') { - data = await options(config); + // @ts-ignore + data = await options(args); } else { data = await customRequest({ ...options, - ...config + ...args }); } @@ -68,7 +79,7 @@ function useRequest(options: AxiosRequestConfig | Noop): Result { ...state, request }; -} +} as IUseRequest; /** * Reducer to handle the status of the request @@ -101,7 +112,7 @@ function requestReducer(state, action) { } } -function usePersistFn(fn: T) { +function usePersistFn(fn: T) { const ref = useRef(() => { throw new Error('Cannot call function while rendering.'); }); diff --git a/packages/plugin-router/package.json b/packages/plugin-router/package.json index ff90369b97..c63e5c4c3b 100644 --- a/packages/plugin-router/package.json +++ b/packages/plugin-router/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-router", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "description": "build-plugin-ice-router", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-service/package.json b/packages/plugin-service/package.json index ce3613d0fa..f3e156ac31 100644 --- a/packages/plugin-service/package.json +++ b/packages/plugin-service/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-service", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "description": "service pulgin", "author": "ice-admin@alibaba-inc.com", "homepage": "https://github.com/ice-lab/icejs#readme", diff --git a/packages/plugin-ssr/package.json b/packages/plugin-ssr/package.json index 29cf3de35a..c254ecf910 100644 --- a/packages/plugin-ssr/package.json +++ b/packages/plugin-ssr/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-ssr", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "description": "ssr plugin", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-store/package.json b/packages/plugin-store/package.json index fa6c4a2866..c4692125f2 100644 --- a/packages/plugin-store/package.json +++ b/packages/plugin-store/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-store", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "description": "builtin `icestore` in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", From c4b6dde4a3d63a08a8efb9e223b70089b1085ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=80=9D=E5=BF=A0?= Date: Thu, 14 May 2020 13:42:05 +0800 Subject: [PATCH 09/11] v1.2.2-alpha.3 --- lerna.json | 2 +- packages/create-ice/package.json | 2 +- packages/icejs/package.json | 22 +++++++++++----------- packages/plugin-config/package.json | 2 +- packages/plugin-core/package.json | 2 +- packages/plugin-helpers/package.json | 2 +- packages/plugin-icestark/package.json | 2 +- packages/plugin-logger/package.json | 2 +- packages/plugin-mpa/package.json | 2 +- packages/plugin-react-app/package.json | 2 +- packages/plugin-rematch/package.json | 2 +- packages/plugin-request/package.json | 2 +- packages/plugin-router/package.json | 2 +- packages/plugin-service/package.json | 2 +- packages/plugin-ssr/package.json | 2 +- packages/plugin-store/package.json | 2 +- 16 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lerna.json b/lerna.json index d17456dbcf..f1ce44e447 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.2.2-alpha.2", + "version": "1.2.2-alpha.3", "npmClient": "yarn", "useWorkspaces": true, "packages": [ diff --git a/packages/create-ice/package.json b/packages/create-ice/package.json index 144e8def99..a974f300b1 100644 --- a/packages/create-ice/package.json +++ b/packages/create-ice/package.json @@ -1,6 +1,6 @@ { "name": "create-ice", - "version": "1.2.2-alpha.2", + "version": "1.2.2-alpha.3", "description": "npm init ice", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/icejs/package.json b/packages/icejs/package.json index e7fb450ba1..0177d4928f 100644 --- a/packages/icejs/package.json +++ b/packages/icejs/package.json @@ -1,6 +1,6 @@ { "name": "ice.js", - "version": "1.2.2-alpha.2", + "version": "1.2.2-alpha.3", "description": "command line interface and builtin plugin for icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", @@ -25,16 +25,16 @@ }, "dependencies": { "@alib/build-scripts": "^0.1.13", - "build-plugin-ice-config": "1.2.2-alpha.2", - "build-plugin-ice-core": "1.2.2-alpha.2", - "build-plugin-ice-helpers": "1.2.2-alpha.2", - "build-plugin-ice-logger": "1.2.2-alpha.2", - "build-plugin-ice-mpa": "1.2.2-alpha.2", - "build-plugin-ice-request": "1.2.2-alpha.2", - "build-plugin-ice-router": "1.2.2-alpha.2", - "build-plugin-ice-ssr": "1.2.2-alpha.2", - "build-plugin-ice-store": "1.2.2-alpha.2", - "build-plugin-react-app": "1.2.2-alpha.2", + "build-plugin-ice-config": "1.2.2-alpha.3", + "build-plugin-ice-core": "1.2.2-alpha.3", + "build-plugin-ice-helpers": "1.2.2-alpha.3", + "build-plugin-ice-logger": "1.2.2-alpha.3", + "build-plugin-ice-mpa": "1.2.2-alpha.3", + "build-plugin-ice-request": "1.2.2-alpha.3", + "build-plugin-ice-router": "1.2.2-alpha.3", + "build-plugin-ice-ssr": "1.2.2-alpha.3", + "build-plugin-ice-store": "1.2.2-alpha.3", + "build-plugin-react-app": "1.2.2-alpha.3", "chokidar": "^3.3.1", "commander": "^5.0.0", "detect-port": "^1.3.0", diff --git a/packages/plugin-config/package.json b/packages/plugin-config/package.json index 2c77130bfd..5b968df541 100644 --- a/packages/plugin-config/package.json +++ b/packages/plugin-config/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-config", - "version": "1.2.2-alpha.2", + "version": "1.2.2-alpha.3", "description": "Define application config in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-core/package.json b/packages/plugin-core/package.json index 2e5cd4862b..7f20b84787 100644 --- a/packages/plugin-core/package.json +++ b/packages/plugin-core/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-core", - "version": "1.2.2-alpha.2", + "version": "1.2.2-alpha.3", "description": "the core plugin for icejs.", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-helpers/package.json b/packages/plugin-helpers/package.json index 7e10326c2e..4adda74422 100644 --- a/packages/plugin-helpers/package.json +++ b/packages/plugin-helpers/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-helpers", - "version": "1.2.2-alpha.2", + "version": "1.2.2-alpha.3", "description": "builtin helpers in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-icestark/package.json b/packages/plugin-icestark/package.json index 5c5962a238..600841a7ce 100644 --- a/packages/plugin-icestark/package.json +++ b/packages/plugin-icestark/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-icestark", - "version": "1.2.2-alpha.2", + "version": "1.2.2-alpha.3", "description": "Easy use `icestark` in icejs.", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-logger/package.json b/packages/plugin-logger/package.json index 9552f19213..1a17565962 100644 --- a/packages/plugin-logger/package.json +++ b/packages/plugin-logger/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-logger", - "version": "1.2.2-alpha.2", + "version": "1.2.2-alpha.3", "description": "builtin logger in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-mpa/package.json b/packages/plugin-mpa/package.json index 58a1cc86c2..617ea70b86 100644 --- a/packages/plugin-mpa/package.json +++ b/packages/plugin-mpa/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-mpa", - "version": "1.2.2-alpha.2", + "version": "1.2.2-alpha.3", "description": "enable mpa project for icejs framework", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-react-app/package.json b/packages/plugin-react-app/package.json index 52557db5f8..d070736963 100644 --- a/packages/plugin-react-app/package.json +++ b/packages/plugin-react-app/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-react-app", - "version": "1.2.2-alpha.2", + "version": "1.2.2-alpha.3", "description": "The basic webpack configuration for ice project", "author": "ice-admin@alibaba-inc.com", "main": "src/index.js", diff --git a/packages/plugin-rematch/package.json b/packages/plugin-rematch/package.json index 03c884caa0..cbf3c1283e 100644 --- a/packages/plugin-rematch/package.json +++ b/packages/plugin-rematch/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-rematch", - "version": "1.2.2-alpha.2", + "version": "1.2.2-alpha.3", "description": "Easy use `rematch` in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-request/package.json b/packages/plugin-request/package.json index 05ecd4e27d..1340452919 100644 --- a/packages/plugin-request/package.json +++ b/packages/plugin-request/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-request", - "version": "1.2.2-alpha.2", + "version": "1.2.2-alpha.3", "description": "request for build-plugin-ice-request", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-router/package.json b/packages/plugin-router/package.json index c63e5c4c3b..46cba1db0c 100644 --- a/packages/plugin-router/package.json +++ b/packages/plugin-router/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-router", - "version": "1.2.2-alpha.2", + "version": "1.2.2-alpha.3", "description": "build-plugin-ice-router", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-service/package.json b/packages/plugin-service/package.json index f3e156ac31..eefcbe2c14 100644 --- a/packages/plugin-service/package.json +++ b/packages/plugin-service/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-service", - "version": "1.2.2-alpha.2", + "version": "1.2.2-alpha.3", "description": "service pulgin", "author": "ice-admin@alibaba-inc.com", "homepage": "https://github.com/ice-lab/icejs#readme", diff --git a/packages/plugin-ssr/package.json b/packages/plugin-ssr/package.json index c254ecf910..45b501ab12 100644 --- a/packages/plugin-ssr/package.json +++ b/packages/plugin-ssr/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-ssr", - "version": "1.2.2-alpha.2", + "version": "1.2.2-alpha.3", "description": "ssr plugin", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-store/package.json b/packages/plugin-store/package.json index c4692125f2..d4aabb54f3 100644 --- a/packages/plugin-store/package.json +++ b/packages/plugin-store/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-store", - "version": "1.2.2-alpha.2", + "version": "1.2.2-alpha.3", "description": "builtin `icestore` in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", From fa630bf5a00d0679bb24384bdbe86b8a1f641dcc Mon Sep 17 00:00:00 2001 From: chenbin92 Date: Thu, 14 May 2020 15:56:58 +0800 Subject: [PATCH 10/11] Fix/release bugs (#3205) * fix: types & log * v1.2.2-alpha.4 * fix: no match single page file * v1.2.2-alpha.5 --- lerna.json | 2 +- packages/create-ice/package.json | 2 +- packages/icejs/package.json | 22 +++++++++---------- packages/plugin-config/package.json | 2 +- packages/plugin-core/package.json | 2 +- packages/plugin-helpers/package.json | 2 +- packages/plugin-icestark/package.json | 2 +- packages/plugin-logger/package.json | 2 +- packages/plugin-mpa/package.json | 2 +- packages/plugin-react-app/package.json | 2 +- packages/plugin-react-app/src/index.js | 15 +++++++------ packages/plugin-rematch/package.json | 2 +- packages/plugin-request/package.json | 2 +- packages/plugin-request/request/useRequest.ts | 8 +++++-- packages/plugin-router/package.json | 2 +- packages/plugin-service/package.json | 2 +- packages/plugin-ssr/package.json | 2 +- packages/plugin-store/package.json | 2 +- .../src/babelPluginReplacePath.ts | 5 +++-- 19 files changed, 43 insertions(+), 37 deletions(-) diff --git a/lerna.json b/lerna.json index f1ce44e447..5915b55c79 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.2.2-alpha.3", + "version": "1.2.2-alpha.5", "npmClient": "yarn", "useWorkspaces": true, "packages": [ diff --git a/packages/create-ice/package.json b/packages/create-ice/package.json index a974f300b1..7453daf48d 100644 --- a/packages/create-ice/package.json +++ b/packages/create-ice/package.json @@ -1,6 +1,6 @@ { "name": "create-ice", - "version": "1.2.2-alpha.3", + "version": "1.2.2-alpha.5", "description": "npm init ice", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/icejs/package.json b/packages/icejs/package.json index 0177d4928f..cf17d39bf2 100644 --- a/packages/icejs/package.json +++ b/packages/icejs/package.json @@ -1,6 +1,6 @@ { "name": "ice.js", - "version": "1.2.2-alpha.3", + "version": "1.2.2-alpha.5", "description": "command line interface and builtin plugin for icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", @@ -25,16 +25,16 @@ }, "dependencies": { "@alib/build-scripts": "^0.1.13", - "build-plugin-ice-config": "1.2.2-alpha.3", - "build-plugin-ice-core": "1.2.2-alpha.3", - "build-plugin-ice-helpers": "1.2.2-alpha.3", - "build-plugin-ice-logger": "1.2.2-alpha.3", - "build-plugin-ice-mpa": "1.2.2-alpha.3", - "build-plugin-ice-request": "1.2.2-alpha.3", - "build-plugin-ice-router": "1.2.2-alpha.3", - "build-plugin-ice-ssr": "1.2.2-alpha.3", - "build-plugin-ice-store": "1.2.2-alpha.3", - "build-plugin-react-app": "1.2.2-alpha.3", + "build-plugin-ice-config": "1.2.2-alpha.5", + "build-plugin-ice-core": "1.2.2-alpha.5", + "build-plugin-ice-helpers": "1.2.2-alpha.5", + "build-plugin-ice-logger": "1.2.2-alpha.5", + "build-plugin-ice-mpa": "1.2.2-alpha.5", + "build-plugin-ice-request": "1.2.2-alpha.5", + "build-plugin-ice-router": "1.2.2-alpha.5", + "build-plugin-ice-ssr": "1.2.2-alpha.5", + "build-plugin-ice-store": "1.2.2-alpha.5", + "build-plugin-react-app": "1.2.2-alpha.5", "chokidar": "^3.3.1", "commander": "^5.0.0", "detect-port": "^1.3.0", diff --git a/packages/plugin-config/package.json b/packages/plugin-config/package.json index 5b968df541..ce5ebf8f08 100644 --- a/packages/plugin-config/package.json +++ b/packages/plugin-config/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-config", - "version": "1.2.2-alpha.3", + "version": "1.2.2-alpha.5", "description": "Define application config in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-core/package.json b/packages/plugin-core/package.json index 7f20b84787..8ee1a34125 100644 --- a/packages/plugin-core/package.json +++ b/packages/plugin-core/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-core", - "version": "1.2.2-alpha.3", + "version": "1.2.2-alpha.5", "description": "the core plugin for icejs.", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-helpers/package.json b/packages/plugin-helpers/package.json index 4adda74422..b67845c010 100644 --- a/packages/plugin-helpers/package.json +++ b/packages/plugin-helpers/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-helpers", - "version": "1.2.2-alpha.3", + "version": "1.2.2-alpha.5", "description": "builtin helpers in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-icestark/package.json b/packages/plugin-icestark/package.json index 600841a7ce..046088497f 100644 --- a/packages/plugin-icestark/package.json +++ b/packages/plugin-icestark/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-icestark", - "version": "1.2.2-alpha.3", + "version": "1.2.2-alpha.5", "description": "Easy use `icestark` in icejs.", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-logger/package.json b/packages/plugin-logger/package.json index 1a17565962..1544fc4714 100644 --- a/packages/plugin-logger/package.json +++ b/packages/plugin-logger/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-logger", - "version": "1.2.2-alpha.3", + "version": "1.2.2-alpha.5", "description": "builtin logger in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-mpa/package.json b/packages/plugin-mpa/package.json index 617ea70b86..7ab15ccf33 100644 --- a/packages/plugin-mpa/package.json +++ b/packages/plugin-mpa/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-mpa", - "version": "1.2.2-alpha.3", + "version": "1.2.2-alpha.5", "description": "enable mpa project for icejs framework", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-react-app/package.json b/packages/plugin-react-app/package.json index d070736963..d9030f1fd2 100644 --- a/packages/plugin-react-app/package.json +++ b/packages/plugin-react-app/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-react-app", - "version": "1.2.2-alpha.3", + "version": "1.2.2-alpha.5", "description": "The basic webpack configuration for ice project", "author": "ice-admin@alibaba-inc.com", "main": "src/index.js", diff --git a/packages/plugin-react-app/src/index.js b/packages/plugin-react-app/src/index.js index 8d5f25b446..82f08cd2ac 100644 --- a/packages/plugin-react-app/src/index.js +++ b/packages/plugin-react-app/src/index.js @@ -185,14 +185,9 @@ module.exports = ({ timings: true, }); const messages = formatWebpackMessages(statsJson); - const isSuccessful = !messages.errors.length && !messages.warnings.length; + // 包含错误时不打印 localUrl 和 assets 信息 + const isSuccessful = !messages.errors.length; if (isSuccessful) { - console.log(); - console.log(chalk.green(' Starting the development server at:')); - console.log(' - Local : ', chalk.underline.white(urls.localUrlForBrowser)); - console.log(' - Network: ', chalk.underline.white(urls.lanUrlForTerminal)); - console.log(); - console.log(stats.toString({ errors: false, warnings: false, @@ -203,6 +198,12 @@ module.exports = ({ modules: false, timings: false })); + + console.log(); + console.log(chalk.green(' Starting the development server at:')); + console.log(' - Local : ', chalk.underline.white(urls.localUrlForBrowser)); + console.log(' - Network: ', chalk.underline.white(urls.lanUrlForTerminal)); + console.log(); } }); } diff --git a/packages/plugin-rematch/package.json b/packages/plugin-rematch/package.json index cbf3c1283e..3d2bed7452 100644 --- a/packages/plugin-rematch/package.json +++ b/packages/plugin-rematch/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-rematch", - "version": "1.2.2-alpha.3", + "version": "1.2.2-alpha.5", "description": "Easy use `rematch` in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-request/package.json b/packages/plugin-request/package.json index 1340452919..ce9313f446 100644 --- a/packages/plugin-request/package.json +++ b/packages/plugin-request/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-request", - "version": "1.2.2-alpha.3", + "version": "1.2.2-alpha.5", "description": "request for build-plugin-ice-request", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-request/request/useRequest.ts b/packages/plugin-request/request/useRequest.ts index cbbd56d209..14f35eb8fe 100644 --- a/packages/plugin-request/request/useRequest.ts +++ b/packages/plugin-request/request/useRequest.ts @@ -2,6 +2,10 @@ import { useReducer, useCallback, useRef } from 'react'; import { AxiosRequestConfig } from 'axios'; import customRequest from './request'; +export interface IAxiosRequestConfig extends AxiosRequestConfig { + withFullResponse?: boolean; +} + interface IResult { data: D; error: Error | undefined; @@ -9,10 +13,10 @@ interface IResult { } type IOptionFn = (...args: any[]) => any; -type IOptionType = IOptionFn | AxiosRequestConfig; +type IOptionType = IOptionFn | IAxiosRequestConfig; interface IOptionResult extends IResult { - request: (args?: AxiosRequestConfig) => void; + request: (args?: IAxiosRequestConfig) => void; } interface IServiceResult extends IResult { diff --git a/packages/plugin-router/package.json b/packages/plugin-router/package.json index 46cba1db0c..35d05c9d84 100644 --- a/packages/plugin-router/package.json +++ b/packages/plugin-router/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-router", - "version": "1.2.2-alpha.3", + "version": "1.2.2-alpha.5", "description": "build-plugin-ice-router", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-service/package.json b/packages/plugin-service/package.json index eefcbe2c14..850dadef79 100644 --- a/packages/plugin-service/package.json +++ b/packages/plugin-service/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-service", - "version": "1.2.2-alpha.3", + "version": "1.2.2-alpha.5", "description": "service pulgin", "author": "ice-admin@alibaba-inc.com", "homepage": "https://github.com/ice-lab/icejs#readme", diff --git a/packages/plugin-ssr/package.json b/packages/plugin-ssr/package.json index 45b501ab12..7f4f986760 100644 --- a/packages/plugin-ssr/package.json +++ b/packages/plugin-ssr/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-ssr", - "version": "1.2.2-alpha.3", + "version": "1.2.2-alpha.5", "description": "ssr plugin", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-store/package.json b/packages/plugin-store/package.json index d4aabb54f3..b9108fbd05 100644 --- a/packages/plugin-store/package.json +++ b/packages/plugin-store/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-store", - "version": "1.2.2-alpha.3", + "version": "1.2.2-alpha.5", "description": "builtin `icestore` in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-store/src/babelPluginReplacePath.ts b/packages/plugin-store/src/babelPluginReplacePath.ts index 0f17ffd5c9..12342089da 100644 --- a/packages/plugin-store/src/babelPluginReplacePath.ts +++ b/packages/plugin-store/src/babelPluginReplacePath.ts @@ -114,8 +114,9 @@ function formatPagePath({ routesPath, value, alias, applyMethod }: IGetConfigRou const matchedPagePath = matchRelativePath(routesPath, value, applyMethod) || matchAliasPath(alias, value, applyMethod); if (matchedPagePath && pathRegExp.test(matchedPagePath)) { let newValue = ''; - if (/src\/pages\/index(.tsx|.jsx?)$/.test(value)) { - newValue = value.replace(/\.{2}\/src\/pages/, './pages/index'); + // Note:过滤掉 pages 目录下的单文件形式 + if (/src\/pages\/\w+(.tsx|.jsx?)$/.test(value)) { + return newValue; } else { const [, , pageName] = matchedPagePath.split('/'); newValue = pageName ? `ice/${pageName}/${pageName}.tsx` : ''; From dda52a4c1c09f984d335a795bb126b174d5236fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=80=9D=E5=BF=A0?= Date: Thu, 14 May 2020 16:37:27 +0800 Subject: [PATCH 11/11] v1.3.0 --- lerna.json | 2 +- packages/create-ice/package.json | 2 +- packages/icejs/package.json | 22 +++++++++++----------- packages/plugin-config/package.json | 2 +- packages/plugin-core/package.json | 2 +- packages/plugin-helpers/package.json | 2 +- packages/plugin-icestark/package.json | 2 +- packages/plugin-logger/package.json | 2 +- packages/plugin-mpa/package.json | 2 +- packages/plugin-react-app/package.json | 2 +- packages/plugin-rematch/package.json | 2 +- packages/plugin-request/package.json | 2 +- packages/plugin-router/package.json | 2 +- packages/plugin-service/package.json | 2 +- packages/plugin-ssr/package.json | 2 +- packages/plugin-store/package.json | 2 +- 16 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lerna.json b/lerna.json index 5915b55c79..006734af74 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.2.2-alpha.5", + "version": "1.3.0", "npmClient": "yarn", "useWorkspaces": true, "packages": [ diff --git a/packages/create-ice/package.json b/packages/create-ice/package.json index 7453daf48d..c65bb6fa29 100644 --- a/packages/create-ice/package.json +++ b/packages/create-ice/package.json @@ -1,6 +1,6 @@ { "name": "create-ice", - "version": "1.2.2-alpha.5", + "version": "1.3.0", "description": "npm init ice", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/icejs/package.json b/packages/icejs/package.json index cf17d39bf2..03c970f23a 100644 --- a/packages/icejs/package.json +++ b/packages/icejs/package.json @@ -1,6 +1,6 @@ { "name": "ice.js", - "version": "1.2.2-alpha.5", + "version": "1.3.0", "description": "command line interface and builtin plugin for icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", @@ -25,16 +25,16 @@ }, "dependencies": { "@alib/build-scripts": "^0.1.13", - "build-plugin-ice-config": "1.2.2-alpha.5", - "build-plugin-ice-core": "1.2.2-alpha.5", - "build-plugin-ice-helpers": "1.2.2-alpha.5", - "build-plugin-ice-logger": "1.2.2-alpha.5", - "build-plugin-ice-mpa": "1.2.2-alpha.5", - "build-plugin-ice-request": "1.2.2-alpha.5", - "build-plugin-ice-router": "1.2.2-alpha.5", - "build-plugin-ice-ssr": "1.2.2-alpha.5", - "build-plugin-ice-store": "1.2.2-alpha.5", - "build-plugin-react-app": "1.2.2-alpha.5", + "build-plugin-ice-config": "1.3.0", + "build-plugin-ice-core": "1.3.0", + "build-plugin-ice-helpers": "1.3.0", + "build-plugin-ice-logger": "1.3.0", + "build-plugin-ice-mpa": "1.3.0", + "build-plugin-ice-request": "1.3.0", + "build-plugin-ice-router": "1.3.0", + "build-plugin-ice-ssr": "1.3.0", + "build-plugin-ice-store": "1.3.0", + "build-plugin-react-app": "1.3.0", "chokidar": "^3.3.1", "commander": "^5.0.0", "detect-port": "^1.3.0", diff --git a/packages/plugin-config/package.json b/packages/plugin-config/package.json index ce5ebf8f08..abe61ae720 100644 --- a/packages/plugin-config/package.json +++ b/packages/plugin-config/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-config", - "version": "1.2.2-alpha.5", + "version": "1.3.0", "description": "Define application config in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-core/package.json b/packages/plugin-core/package.json index 8ee1a34125..9907593f75 100644 --- a/packages/plugin-core/package.json +++ b/packages/plugin-core/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-core", - "version": "1.2.2-alpha.5", + "version": "1.3.0", "description": "the core plugin for icejs.", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-helpers/package.json b/packages/plugin-helpers/package.json index b67845c010..1ff1d39748 100644 --- a/packages/plugin-helpers/package.json +++ b/packages/plugin-helpers/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-helpers", - "version": "1.2.2-alpha.5", + "version": "1.3.0", "description": "builtin helpers in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-icestark/package.json b/packages/plugin-icestark/package.json index 046088497f..34ec814ec9 100644 --- a/packages/plugin-icestark/package.json +++ b/packages/plugin-icestark/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-icestark", - "version": "1.2.2-alpha.5", + "version": "1.3.0", "description": "Easy use `icestark` in icejs.", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-logger/package.json b/packages/plugin-logger/package.json index 1544fc4714..6392f3afa1 100644 --- a/packages/plugin-logger/package.json +++ b/packages/plugin-logger/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-logger", - "version": "1.2.2-alpha.5", + "version": "1.3.0", "description": "builtin logger in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-mpa/package.json b/packages/plugin-mpa/package.json index 7ab15ccf33..6a990303d0 100644 --- a/packages/plugin-mpa/package.json +++ b/packages/plugin-mpa/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-mpa", - "version": "1.2.2-alpha.5", + "version": "1.3.0", "description": "enable mpa project for icejs framework", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-react-app/package.json b/packages/plugin-react-app/package.json index d9030f1fd2..23628eb68d 100644 --- a/packages/plugin-react-app/package.json +++ b/packages/plugin-react-app/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-react-app", - "version": "1.2.2-alpha.5", + "version": "1.3.0", "description": "The basic webpack configuration for ice project", "author": "ice-admin@alibaba-inc.com", "main": "src/index.js", diff --git a/packages/plugin-rematch/package.json b/packages/plugin-rematch/package.json index 3d2bed7452..4d73cf1c89 100644 --- a/packages/plugin-rematch/package.json +++ b/packages/plugin-rematch/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-rematch", - "version": "1.2.2-alpha.5", + "version": "1.3.0", "description": "Easy use `rematch` in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-request/package.json b/packages/plugin-request/package.json index ce9313f446..1dd7f333e3 100644 --- a/packages/plugin-request/package.json +++ b/packages/plugin-request/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-request", - "version": "1.2.2-alpha.5", + "version": "1.3.0", "description": "request for build-plugin-ice-request", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-router/package.json b/packages/plugin-router/package.json index 35d05c9d84..8a877f9b69 100644 --- a/packages/plugin-router/package.json +++ b/packages/plugin-router/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-router", - "version": "1.2.2-alpha.5", + "version": "1.3.0", "description": "build-plugin-ice-router", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-service/package.json b/packages/plugin-service/package.json index 850dadef79..579eaf73e1 100644 --- a/packages/plugin-service/package.json +++ b/packages/plugin-service/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-service", - "version": "1.2.2-alpha.5", + "version": "1.3.0", "description": "service pulgin", "author": "ice-admin@alibaba-inc.com", "homepage": "https://github.com/ice-lab/icejs#readme", diff --git a/packages/plugin-ssr/package.json b/packages/plugin-ssr/package.json index 7f4f986760..fc8932b287 100644 --- a/packages/plugin-ssr/package.json +++ b/packages/plugin-ssr/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-ssr", - "version": "1.2.2-alpha.5", + "version": "1.3.0", "description": "ssr plugin", "author": "ice-admin@alibaba-inc.com", "homepage": "", diff --git a/packages/plugin-store/package.json b/packages/plugin-store/package.json index b9108fbd05..2b9db1445f 100644 --- a/packages/plugin-store/package.json +++ b/packages/plugin-store/package.json @@ -1,6 +1,6 @@ { "name": "build-plugin-ice-store", - "version": "1.2.2-alpha.5", + "version": "1.3.0", "description": "builtin `icestore` in icejs", "author": "ice-admin@alibaba-inc.com", "homepage": "",