Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Diablohu committed Jan 8, 2020
1 parent 198d21a commit 7d84b27
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 30 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
"eslint": "^6.8.0",
"eslint-config-koot": "^1.6.0",
"fs-extra": "^8.1.0",
"husky": "^3.1.0",
"inquirer": "7.0.1",
"husky": "^4.0.1",
"inquirer": "7.0.3",
"is-valid-path": "^0.1.1",
"jest": "^24.9.0",
"jsdom": "^15.2.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/koot-boilerplate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"up": "yarn upgrade-interactive --latest"
},
"dependencies": {
"axios": "^0.19.0",
"axios": "^0.19.1",
"bind-event": "^1.1.2",
"classnames": "^2.2.6",
"koot": "^0.12.0-beta.5"
Expand All @@ -43,7 +43,7 @@
"cssnano": "^4.1.10",
"eslint": "^6.8.0",
"eslint-config-koot": "^1.6.0",
"husky": "^3.1.0",
"husky": "^4.0.1",
"lint-staged": "^9.5.0",
"normalize.css": "^8.0.1",
"prettier": "^1.19.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/koot-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"gitignore-globs": "^0.1.1",
"glob": "^7.1.6",
"glob-promise": "^3.4.0",
"inquirer": "^7.0.2",
"inquirer": "^7.0.3",
"isbinaryfile": "^4.0.3",
"latest-version": "^5.1.0",
"npm-email": "^3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/koot-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@babel/preset-typescript": "^7.7.7",
"@babel/register": "^7.7.7",
"@hot-loader/react-dom": "^16.11.0",
"@types/webpack": "^4.41.1",
"@types/webpack": "^4.41.2",
"babel-loader": "^8.0.6",
"compression-webpack-plugin": "^3.0.1",
"copy-webpack-plugin": "^5.1.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/koot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"chalk": "^3.0.0",
"classlist-polyfill": "^1.2.0",
"cli-spinners": "^2.2.0",
"commander": "^4.0.1",
"commander": "^4.1.0",
"cookie": "^0.4.0",
"copyfiles": "^2.1.1",
"debug": "^4.1.1",
Expand All @@ -65,7 +65,7 @@
"fs-extra": "^8.1.0",
"glob": "^7.1.6",
"glob-promise": "^3.4.0",
"inquirer": "7.0.1",
"inquirer": "7.0.3",
"is-port-reachable": "^3.0.0",
"is-url": "^1.2.4",
"isomorphic-fetch": "^2.2.1",
Expand Down
14 changes: 14 additions & 0 deletions packages/koot/utils/get-port.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* 获取当前环境的服务器端口号
*/
function getPort(
portConfig?:
| number
| {
prod?: number;
dev?: number;
},
currentEnv?: 'prod' | 'dev'
): number;

export default getPort;
28 changes: 14 additions & 14 deletions packages/koot/utils/get-port.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

/**
* 获取当前环境的服务器端口号
* @param {Object|Number} port
* @param {String} [env=process.env.WEBPACK_BUILD_ENV]
* @returns {Number}
* @param {Object|number} port
* @param {string} [env=process.env.WEBPACK_BUILD_ENV]
* @returns {number}
*/
module.exports = (port, env = process.env.WEBPACK_BUILD_ENV) => {
const defaultPort = typeof process.env.SERVER_PORT === 'undefined' && typeof __SERVER_PORT__ !== 'undefined'
? __SERVER_PORT__
: process.env.SERVER_PORT
const defaultPort =
typeof process.env.SERVER_PORT === 'undefined' &&
typeof __SERVER_PORT__ !== 'undefined'
? __SERVER_PORT__
: process.env.SERVER_PORT;

if (typeof port === 'object') {
if (!env) env = 'prod'
if (typeof port[env] !== 'undefined')
return port[env]
return defaultPort
if (!env) env = 'prod';
if (typeof port[env] !== 'undefined') return port[env];
return defaultPort;
}

if (typeof port !== 'undefined' && typeof port !== 'boolean')
return port
if (typeof port !== 'undefined' && typeof port !== 'boolean') return port;

return defaultPort
}
return defaultPort;
};
9 changes: 5 additions & 4 deletions test/projects/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@
"private": true,
"sideEffects": false,
"koot": {
"version": "0.12.0-beta.3"
"version": "0.12.0-beta.5"
},
"devDependencies": {
"@types/lodash": "^4.14.149",
"@types/node": "^13.1.4",
"@types/react": "^16.9.17",
"@types/react-dom": "^16.9.4",
Expand All @@ -60,7 +61,7 @@
"chalk": "^3.0.0",
"classlist-polyfill": "^1.2.0",
"cli-spinners": "^2.2.0",
"commander": "^4.0.1",
"commander": "^4.1.0",
"cookie": "^0.4.0",
"copyfiles": "^2.1.1",
"debug": "^4.1.1",
Expand All @@ -70,7 +71,7 @@
"fs-extra": "^8.1.0",
"glob": "^7.1.6",
"glob-promise": "^3.4.0",
"inquirer": "^7.0.2",
"inquirer": "7.0.3",
"is-port-reachable": "^3.0.0",
"is-url": "^1.2.4",
"isomorphic-fetch": "^2.2.1",
Expand Down Expand Up @@ -124,7 +125,7 @@
"@babel/preset-typescript": "^7.7.7",
"@babel/register": "^7.7.7",
"@hot-loader/react-dom": "^16.11.0",
"@types/webpack": "^4.41.1",
"@types/webpack": "^4.41.2",
"babel-loader": "^8.0.6",
"compression-webpack-plugin": "^3.0.1",
"copy-webpack-plugin": "^5.1.1",
Expand Down
2 changes: 2 additions & 0 deletions test/projects/simple/src/views/home/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import clientUpdatePageinfo from 'koot/utils/client-update-pageinfo';

import Issue68 from '@components/issue-68';
import TestAsyncFunction from './test-async-function';
import TestGetPort from './test-get-port';

import styles from './styles.component.less';

Expand Down Expand Up @@ -41,6 +42,7 @@ const PageHome = ({ className }) => {
</div>

<TestAsyncFunction />
<TestGetPort />
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.component {
position: relative;
}
30 changes: 30 additions & 0 deletions test/projects/simple/src/views/home/test-get-port/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import { extend } from 'koot';
import getPort from 'koot/utils/get-port';

import styles from './index.module.less';

// ============================================================================

interface ComponentProps {
customProps?: string;
}

// Functional Component =======================================================

const TestGetPort = extend<ComponentProps>({
styles
})(
React.memo(
({ className, children }): JSX.Element => {
return (
<React.Fragment>
<h3>Test: async/await</h3>
<div id="__test-get-port">{getPort()}</div>
</React.Fragment>
);
}
)
);

export default TestGetPort;
9 changes: 5 additions & 4 deletions test/projects/standard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@
"private": true,
"sideEffects": false,
"koot": {
"version": "0.12.0-beta.3"
"version": "0.12.0-beta.5"
},
"devDependencies": {
"@types/lodash": "^4.14.149",
"@types/node": "^13.1.4",
"@types/react": "^16.9.17",
"@types/react-dom": "^16.9.4",
Expand All @@ -76,7 +77,7 @@
"chalk": "^3.0.0",
"classlist-polyfill": "^1.2.0",
"cli-spinners": "^2.2.0",
"commander": "^4.0.1",
"commander": "^4.1.0",
"cookie": "^0.4.0",
"copyfiles": "^2.1.1",
"debug": "^4.1.1",
Expand All @@ -86,7 +87,7 @@
"fs-extra": "^8.1.0",
"glob": "^7.1.6",
"glob-promise": "^3.4.0",
"inquirer": "^7.0.2",
"inquirer": "7.0.3",
"is-port-reachable": "^3.0.0",
"is-url": "^1.2.4",
"isomorphic-fetch": "^2.2.1",
Expand Down Expand Up @@ -140,7 +141,7 @@
"@babel/preset-typescript": "^7.7.7",
"@babel/register": "^7.7.7",
"@hot-loader/react-dom": "^16.11.0",
"@types/webpack": "^4.41.1",
"@types/webpack": "^4.41.2",
"babel-loader": "^8.0.6",
"compression-webpack-plugin": "^3.0.1",
"copy-webpack-plugin": "^5.1.1",
Expand Down

0 comments on commit 7d84b27

Please sign in to comment.