Skip to content

Commit

Permalink
fix: 使用rimraf代替rm -rf 来跨平台使用,更新脚手架
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyuang committed Jun 27, 2019
1 parent db82ee8 commit 10bd8ce
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
5 changes: 3 additions & 2 deletions example/ssr-with-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
},
"scripts": {
"debug": "egg-bin debug",
"start": "rm -rf dist && concurrently \"npm run ssr\" \" npm run csr \"",
"start": "rimraf dist && concurrently \"npm run ssr\" \" npm run csr \"",
"ssr": "concurrently \"egg-bin dev\" \"cross-env NODE_ENV=development webpack --watch --config ./build/webpack.config.server.js\"",
"csr": "cross-env NODE_ENV=development webpack-dev-server --port 8000 --hot --client-log-level error --config ./build/webpack.config.client.js",
"prod": "npm run build && eggctl start",
"build:server": "cross-env NODE_ENV=production webpack --config build/webpack.config.server.js",
"build": "cross-env NODE_ENV=production webpack --config build/webpack.config.client.js && npm run build:server",
"build": "rimraf dist && cross-env NODE_ENV=production webpack --config build/webpack.config.client.js && npm run build:server",
"analyze": "cross-env NODE_ENV=production npm_config_report=true npm run build"
},
"browserslist": [
Expand Down Expand Up @@ -57,6 +57,7 @@
"postcss-loader": "3.0.0",
"postcss-preset-env": "^6.0.5",
"postcss-safe-parser": "4.0.1",
"rimraf": "^2.6.3",
"terser-webpack-plugin": "^1.2.0",
"url-loader": "1.1.1",
"webpack": "4.19.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/yk-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yk-cli",
"version": "1.0.15",
"version": "1.0.16",
"description": "ykcli for ssr",
"main": "./bin/index.js",
"types": "types/index.d.ts",
Expand Down
3 changes: 2 additions & 1 deletion packages/yk-cli/src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import shell from 'shelljs'
export async function cacheMange (option: Optional): Promise<void> {
const useCache = await getVersionEffective(option)
const language = option.language === 'javascript' ? 'js' : 'ts'
// 如果没有缓存可用则拉取最新代码
// 如果没有缓存可用或者远程代码更新则拉取最新代码
if (!useCache) {
shell.rm('-rf', resolveApp('./cache'))
await downloadWithPromise('github:ykfe/egg-react-ssr#master', resolveApp('./cache'))
}
const example = resolveApp(`./cache/example/ssr-with-${language}`)
Expand Down
16 changes: 9 additions & 7 deletions packages/yk-cli/tpl/package.json.nj
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
},
"scripts": {
"debug": "egg-bin debug",
"start": "concurrently \"npm run ssr\" \" npm run csr \"",
"ssr": "rm -rf dist && concurrently \"egg-bin dev\" \"NODE_ENV=development webpack --watch --config ./build/webpack.config.server.js\"",
"csr": "NODE_ENV=development webpack-dev-server --port 8000 --hot --client-log-level error --config ./build/webpack.config.client.js",
"start": "rimraf dist && concurrently \"npm run ssr\" \" npm run csr \"",
"ssr": "concurrently \"egg-bin dev\" \"cross-env NODE_ENV=development webpack --watch --config ./build/webpack.config.server.js\"",
"csr": "cross-env NODE_ENV=development webpack-dev-server --port 8000 --hot --client-log-level error --config ./build/webpack.config.client.js",
"prod": "npm run build && eggctl start",
"build:server": "NODE_ENV=production webpack --config build/webpack.config.server.js",
"build": "rm -rf dist && NODE_ENV=production webpack --config build/webpack.config.client.js && npm run build:server",
"analyze": "NODE_ENV=production npm_config_report=true npm run build"
"build:server": "cross-env NODE_ENV=production webpack --config build/webpack.config.server.js",
"build": "rimraf dist && cross-env NODE_ENV=production webpack --config build/webpack.config.client.js && npm run build:server",
"analyze": "cross-env NODE_ENV=production npm_config_report=true npm run build"
},
"browserslist": [
">0.2%",
Expand All @@ -36,14 +36,15 @@
"caniuse-lite": "1.0.30000974"
},
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"@babel/core": "^7.4.4",
"@svgr/webpack": "2.4.1",
"babel-loader": "8.0.4",
"browserslist": "^4.6.3",
"caniuse-lite": "1.0.30000974",
"concurrently": "^4.1.0",
"cross-env": "^5.2.0",
"css-hot-loader": "^1.4.3",
"css-loader": "1.0.0",
"css-modules-require-hook": "^4.2.3",
Expand All @@ -57,6 +58,7 @@
"postcss-loader": "3.0.0",
"postcss-preset-env": "^6.0.5",
"postcss-safe-parser": "4.0.1",
"rimraf": "^2.6.3",
"terser-webpack-plugin": "^1.2.0",
"url-loader": "1.1.1",
"webpack": "4.19.1",
Expand Down

0 comments on commit 10bd8ce

Please sign in to comment.