Skip to content

Commit

Permalink
Merge pull request #21 from LianjiaTech/fix/windows
Browse files Browse the repository at this point in the history
Fix/windows
  • Loading branch information
好爸爸 authored Jan 30, 2021
2 parents 5a2f67c + 80de1df commit 76b317d
Show file tree
Hide file tree
Showing 10 changed files with 775 additions and 363 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ cd ./plugin
yarn
# 打包输出esm模块
yarn build:umd
yarn run build:umd
# 启动组件库服务
yarn server:dist
yarn run server:dist
```
打开 [http://127.0.0.1:8080/manifest.json](http://127.0.0.1:8080/manifest.json) 预览, 可以看到如下内容
```json
Expand All @@ -93,23 +93,23 @@ yarn server:dist
### 第二步 安装依赖
安装client层依赖
```shell
cd ./client && yarn
cd ../client && yarn
```

安装server层依赖
```shell
cd ./server && yarn
cd ../server && yarn
```

### 第三步 启动服务
启动client层服务
```shell
cd ./client && yarn start
cd ../client && yarn start
```

启动server层服务
```shell
cd server && yarn dev
cd ../server && yarn dev
```

打开 [http://127.0.0.1:1234](http://127.0.0.1:1234) 预览, 可使用任意邮箱注册账号
Expand Down
10 changes: 7 additions & 3 deletions client/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
[
"babel-plugin-root-import",
"module-resolver",
{
"rootPathPrefix": "~",
"rootPathSuffix": "./src"
"root": "./",
"alias": {
"~": "./src",
"@test": "./test",
"*": ["src/*", "node_modules/*"]
}
}
]
],
Expand Down
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"babel-eslint": "10.0.1",
"babel-jest": "^24.9.0",
"babel-loader": "^8.0.6",
"babel-plugin-module-resolver": "^4.1.0",
"babel-plugin-named-asset-import": "^0.3.4",
"babel-plugin-require-context-hook": "^1.0.0",
"babel-plugin-root-import": "^6.4.1",
Expand Down
38 changes: 37 additions & 1 deletion client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2690,6 +2690,17 @@ babel-plugin-macros@2.5.1:
cosmiconfig "^5.2.0"
resolve "^1.10.0"

babel-plugin-module-resolver@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/babel-plugin-module-resolver/-/babel-plugin-module-resolver-4.1.0.tgz#22a4f32f7441727ec1fbf4967b863e1e3e9f33e2"
integrity sha512-MlX10UDheRr3lb3P0WcaIdtCSRlxdQsB1sBqL7W0raF070bGl1HQQq5K3T2vf2XAYie+ww+5AKC/WrkjRO2knA==
dependencies:
find-babel-config "^1.2.0"
glob "^7.1.6"
pkg-up "^3.1.0"
reselect "^4.0.0"
resolve "^1.13.1"

babel-plugin-named-asset-import@^0.3.4:
version "0.3.6"
resolved "https://registry.yarnpkg.com/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.6.tgz#c9750a1b38d85112c9e166bf3ef7c5dbc605f4be"
Expand Down Expand Up @@ -5380,6 +5391,14 @@ finalhandler@~1.1.2:
statuses "~1.5.0"
unpipe "~1.0.0"

find-babel-config@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/find-babel-config/-/find-babel-config-1.2.0.tgz#a9b7b317eb5b9860cda9d54740a8c8337a2283a2"
integrity sha512-jB2CHJeqy6a820ssiqwrKMeyC6nNdmrcgkKWJWmpoxpE8RKciYJXCcXRq1h2AzCo5I5BJeN2tkGEO3hLTuePRA==
dependencies:
json5 "^0.5.1"
path-exists "^3.0.0"

find-cache-dir@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-0.1.1.tgz#c8defae57c8a52a8a784f9e31c57c742e993a0b9"
Expand Down Expand Up @@ -5694,7 +5713,7 @@ glob@^5.0.15:
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@~7.1.6:
glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@~7.1.6:
version "7.1.6"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
Expand Down Expand Up @@ -7304,6 +7323,11 @@ json3@^3.3.2:
resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.3.tgz#7fc10e375fc5ae42c4705a5cc0aa6f62be305b81"
integrity sha512-c7/8mbUsKigAbLkD5B010BK4D9LZm7A1pNItkEwiUZRpIN66exu/e7YQWysGun+TRKaJp8MhemM+VkfWv42aCA==

json5@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821"
integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=

json5@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
Expand Down Expand Up @@ -8710,6 +8734,13 @@ pkg-up@2.0.0:
dependencies:
find-up "^2.1.0"

pkg-up@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-3.1.0.tgz#100ec235cc150e4fd42519412596a28512a0def5"
integrity sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==
dependencies:
find-up "^3.0.0"

pn@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb"
Expand Down Expand Up @@ -10607,6 +10638,11 @@ requires-port@^1.0.0:
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=

reselect@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/reselect/-/reselect-4.0.0.tgz#f2529830e5d3d0e021408b246a206ef4ea4437f7"
integrity sha512-qUgANli03jjAyGlnbYVAV5vvnOmJnODyABz51RdBN7M4WaVu8mecZWgyQNkG8Yqe3KRGRt0l4K4B3XVEULC4CA==

resize-observer-polyfill@^1.5.0, resize-observer-polyfill@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464"
Expand Down
10 changes: 7 additions & 3 deletions plugin/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
"presets": [],
"plugins": [
[
"babel-plugin-root-import",
"module-resolver",
{
"rootPathPrefix": "~",
"rootPathSuffix": "./src"
"root": "./",
"alias": {
"~": "./src",
"@test": "./test",
"*": ["src/*", "node_modules/*"]
}
}
]
]
Expand Down
8 changes: 4 additions & 4 deletions plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"@typescript-eslint/eslint-plugin": "^2.12.0",
"@typescript-eslint/parser": "^2.12.0",
"autoprefixer": "^9.6.1",
"babel-plugin-root-import": "^6.4.1",
"chalk": "^2.4.2",
"copyfiles": "^2.1.1",
"cross-env": "^6.0.3",
Expand All @@ -61,13 +60,13 @@
"jest-transform-stub": "^2.0.0",
"less": "^3.10.3",
"prettier": "^1.18.2",
"rollup": "^1.27.14",
"rollup": "1.27.14",
"rollup-plugin-alias": "^2.2.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-postcss": "^2.0.3",
"through2": "^3.0.1",
"ts-jest": "^24.2.0",
"tsdx": "^0.13.2",
"tsdx": "0.13.2",
"tslib": "^1.10.0",
"typescript": "^3.6.4"
},
Expand All @@ -76,6 +75,7 @@
"@ice/stark-data": "^0.1.2",
"antd": "3.26.16",
"axios": "^0.19.0",
"babel-plugin-module-resolver": "^4.1.0",
"bizcharts": "^3.5.6",
"bizcharts-plugin-slider": "^2.1.1-beta.1",
"classnames": "^2.2.6",
Expand Down Expand Up @@ -117,8 +117,8 @@
"mitt": "^1.2.0",
"moment": "^2.24.0",
"monaco-editor": "^0.18.1",
"query-string": "^6.8.3",
"path-to-regexp": "^6.1.0",
"query-string": "^6.8.3",
"react": "16.8.6",
"react-dom": "16.8.6",
"react-is": "^16.8.6",
Expand Down
10 changes: 2 additions & 8 deletions plugin/tsdx.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// PostCSS plugins
const postcss = require('rollup-plugin-postcss')
const alias = require('rollup-plugin-alias')
const resolve = require('rollup-plugin-node-resolve')
const autoprefixer = require('autoprefixer')
const cssnano = require('cssnano')
Expand Down Expand Up @@ -53,16 +52,12 @@ module.exports = {
extensions: ['.less', '.css'],
}),
resolve({ extensions }),
alias({
'~': './src',
'@test': './test',
}),
options.format === 'umd' && myRollupPlugin()
)

if (options.format === 'esm') {
// 输出路径加上版本号
config.output.file = config.output.file.replace(`${__dirname}/dist`, `${__dirname}/lib`)
config.output.file = config.output.file.replace(path.resolve(__dirname, './dist'), path.resolve(__dirname, './lib'))
}

if (options.format === 'umd') {
Expand Down Expand Up @@ -92,11 +87,10 @@ module.exports = {
}

// 输出路径加上版本号
config.output.file = config.output.file.replace(`${__dirname}/dist`, `${__dirname}/dist/${pkg.version}`)
config.output.file = config.output.file.replace(path.resolve(__dirname,'./dist'), path.resolve(__dirname, './dist/'+pkg.version))

// https://www.rollupjs.com/guide/tools/#peer-dependencies
config.external = Object.keys(config.output.globals)

}

return config
Expand Down
Loading

0 comments on commit 76b317d

Please sign in to comment.