修复 Windows 环境开发问题 (#109)

* fix(windows): preparing Windows environment

* re #101, add `CONTRIBUTING.md`

* chore(windows): fix lerna watch command in Windows
This commit is contained in:
xiaoiver 2019-11-29 15:38:17 +08:00 committed by GitHub
parent 99c60bb87b
commit 3eff40b37b
8 changed files with 119 additions and 85 deletions

84
.github/CONTRIBUTING.md vendored Normal file
View File

@ -0,0 +1,84 @@
# Contributing to L7
👍🎉 欢迎向 L7 贡献代码! 🎉👍
## 前置依赖安装
### 安装 Yarn
由于使用了 Yarn workspace首先需要安装 Yarnhttps://yarnpkg.com/en/docs/install#windows-stable
### Windows 环境配置
[L7 测试方案](https://github.com/antvis/L7/blob/master/dev-docs/%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E6%96%B9%E6%A1%88.md)依赖 headless-gl其中需要 node-gyp [编译本地依赖](https://github.com/nodejs/node-gyp#on-windows)。
1. 首先以管理员身份启动 PowerShell
2. 运行 `npm install --global --production windows-build-tools`,安装 Microsoft's windows-build-tools
安装过程中其他问题[详见](https://github.com/antvis/L7/issues/101)。
## 安装依赖
安装依赖并完成 Yarn workspace 初始化:
```bash
yarn install
```
### Windows
```bash
copy node_modules/gl/deps/windows/dll/x64/*.dll c:\windows\system32
```
## 运行 DEMO
启动各个 package 代码变更监听:
```bash
yarn watch
```
启动 Storybook会自动打开 `http://localhost:6006/`
```bash
yarn storybook
```
## 运行测试
运行单元测试:
```bash
yarn test
```
运行单元测试并查看代码覆盖率:
```bash
yarn coveralls
```
## 添加 Lerna package
添加一个新的 lerna package
```bash
lerna create my-pack -y
```
将 ui-lib 作为 my-pack 的依赖:
```bash
yarn workspace my-pack add ui-lib/1.0.0
```
将 lodash 添加为所有 package 的依赖(不包含root
```bash
yarn workspaces run add lodash
```
将 typescript 设置为 root 的开发依赖
```bash
yarn add -W -D typescript jest
```
## 提交代码
代替 `git commit` 提交:
```bash
yarn commit
```

View File

@ -1,4 +1,15 @@
language: node_js
os: linux
sudo: required
dist: trusty
addons:
apt:
packages:
- mesa-utils
- xvfb
- libgl1-mesa-dri
- libglapi-mesa
- libosmesa6
node_js:
- '12'
@ -13,6 +24,9 @@ before_install:
install:
- yarn install
before_script:
- export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start
script:
- yarn lint
- yarn test

View File

@ -88,31 +88,7 @@ scene.addLayer(pointLayer);
## 🔨 Development
使用 Yarn Workspace 完成依赖安装以及各包之间的 link 工作:
```bash
yarn install
```
开发模式:
```bash
yarn watch
```
运行 Demo基于 Storybook
```bash
yarn storybook
```
## view doc example
```bash
yarn start
```
Visit http://localhost:8000/
We wrote a [contribution guide](./.github/CONTRIBUTING.md) to help you get started.
## ✅ License

View File

@ -67,53 +67,6 @@ npm install @antv/l7@beta
![L7 Road Map](https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*3j9HTLTQT2MAAAAAAAAAAABkARQnAQ)
## Development
## 向 L7 贡献代码
使用 Yarn Workspace 完成依赖安装以及各包之间的 link 工作:
```bash
yarn install
```
开发模式:
```bash
yarn watch
```
运行 Demo
```bash
yarn storybook
```
代替 `git commit` 提交:
```bash
yarn commit
```
## view doc example
```bash
npm start
```
visit http://localhost:8000/
## Add Package
add new package
```bash
lerna create my-pack -y
```
将 ui-lib 作为 my-pack 的依赖:
```bash
yarn workspace my-pack add ui-lib/1.0.0
```
将 lodash 添加为所有 package 的依赖(不包含root
```bash
yarn workspaces run add lodash
```
将 typescript 设置为 root 的开发依赖
```bash
yarn add -W -D typescript jest
```
您可以参考 [CONTRIBUTING.md](./.github/CONTRIBUTING.md) 向 L7 贡献代码。

View File

@ -24,7 +24,7 @@ module.exports = {
// },
// },
moduleFileExtensions: [ 'ts', 'tsx', 'js' ],
modulePathIgnorePatterns: [ 'dist', 'packages/renderer' ], // TODO: 暂时关闭render test
modulePathIgnorePatterns: [ 'dist' ],
moduleNameMapper: {
'@antv/l7-(.+)$': '<rootDir>packages/$1/src'
},

View File

@ -51,6 +51,7 @@
"commitizen": "^4.0.3",
"copy-webpack-plugin": "^4.5.2",
"coveralls": "^3.0.7",
"cross-env": "^6.0.3",
"css-loader": "^3.2.0",
"cz-conventional-changelog": "^3.0.2",
"dat.gui": "^0.7.2",
@ -115,11 +116,11 @@
"worker-loader": "^2.0.0"
},
"scripts": {
"start": "npm run site:clean && npm run site:develop",
"site:develop": "BABEL_ENV=site gatsby develop --open -H 0.0.0.0",
"site:build": "npm run site:clean && BABEL_ENV=site gatsby build --prefix-paths",
"start": "yarn run site:clean && yarn run site:develop",
"site:develop": "cross-env BABEL_ENV=site gatsby develop --open -H 0.0.0.0",
"site:build": "yarn run site:clean && cross-env BABEL_ENV=site gatsby build --prefix-paths",
"site:clean": "gatsby clean",
"site:deploy": "npm run site:build && gh-pages -d public",
"site:deploy": "yarn run site:build && gh-pages -d public",
"site:publish": "gh-pages -d public",
"lint-fix:examples": "prettier --write examples/**/**/*.js",
"lint:site": "eslint examples/**/**/*.js --fix",
@ -139,12 +140,12 @@
"prerelease": "yarn build && yarn bundle",
"release": "lerna publish from-package --registry https://registry.npmjs.com/",
"storybook": "start-storybook -p 6006",
"test": "BABEL_ENV=test jest",
"test": "cross-env BABEL_ENV=test jest",
"coveralls": "jest --coverage && cat ./tests/coverage/lcov.info | coveralls",
"tsc": "tsc",
"watch": "yarn clean && lerna exec --parallel 'BABEL_ENV=cjs babel --watch src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments'",
"bundle": "BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js",
"bundle:watch": "BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js --watch",
"watch": "yarn clean && lerna exec --parallel -- cross-env BABEL_ENV=cjs babel --watch src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments",
"bundle": "cross-env BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js",
"bundle:watch": "cross-env BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js --watch",
"glsl-minify": "node_modules/.bin/glsl-minifier -i ./build/example.frag -o ./build/example.min.frag",
"clean": "lerna run clean"
},
@ -154,7 +155,7 @@
],
"husky": {
"hooks": {
"pre-commit": "npm run lint",
"pre-commit": "yarn run lint",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},

View File

@ -52,7 +52,6 @@ export default class PopupComponent extends React.Component {
})
.setText('hello');
scene.addPopup(popup);
}
public render() {

View File

@ -7649,6 +7649,13 @@ create-react-context@^0.3.0:
gud "^1.0.0"
warning "^4.0.3"
cross-env@^6.0.3:
version "6.0.3"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-6.0.3.tgz#4256b71e49b3a40637a0ce70768a6ef5c72ae941"
integrity sha512-+KqxF6LCvfhWvADcDPqo64yVIB31gv/jQulX2NGzKS/g3GEVz6/pt4wjHFtFWsHMddebWD/sDthJemzM4MaAag==
dependencies:
cross-spawn "^7.0.0"
cross-fetch@2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/cross-fetch/-/cross-fetch-2.0.0.tgz#a17475449561e0f325146cea636a8619efb9b382"