Chore test preCommit 增加测试用例校验 (#1281)

* docs: 文档的相关配置

* chore: package json 测试覆盖

* test(source): test

* fix: test ci

* chore: ci

* chore: ci add worker build

* chore: glsl 支持热更新

* chore: test cover view

* chore: ci test

* chore: precommit 增加 test 校验

* chore: remove stroybook lint add dumo demo lint

* chore: pre-commit build 校验

* chore: update ci 触发

* chore: lint 相关配置
This commit is contained in:
@thinkinggis 2022-08-10 15:58:12 +08:00 committed by GitHub
parent 08cab1d741
commit d8a9ccb884
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 84 additions and 187 deletions

View File

@ -1,6 +1,6 @@
name: lint
on: [push, pull_request]
on: [pull_request]
jobs:
lint:
@ -15,4 +15,4 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: yarn
- run: yarn lint
- run: yarn build

View File

@ -1,25 +0,0 @@
name: 🔂 Surge PR Preview
on: pull_request
jobs:
preview:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- uses: afc163/surge-preview@v1
with:
surge_token: ${{ secrets.SURGE_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
dist: public
build: |
yarn --frozen-lockfile
yarn site:build

View File

@ -1,6 +1,6 @@
name: test
on: [push, pull_request]
on: [pull_request]
jobs:
test:

View File

@ -1,71 +0,0 @@
import { PointLayer, Scene } from '@antv/l7';
import { GaodeMap } from '@antv/l7-maps';
import React, { useEffect } from 'react';
export default () => {
useEffect(() => {
const scene = new Scene({
id: 'map',
pickBufferScale: 1.0,
map: new GaodeMap({
style: 'light',
center: [-121.24357, 37.58264],
pitch: 0,
zoom: 6.45,
}),
});
scene.on('loaded', () => {
fetch(
'https://gw.alipayobjects.com/os/basement_prod/6c4bb5f2-850b-419d-afc4-e46032fc9f94.csv',
)
.then((res) => res.text())
.then((data) => {
const pointLayer = new PointLayer({
autoFit:true
})
.source(data.slice(0, 1000), {
parser: {
type: 'csv',
x: 'Longitude',
y: 'Latitude',
},
})
.shape('circle')
.size(16)
.active(true)
.select({
color: 'red',
})
.color('Magnitude', [
'#0A3663',
'#1558AC',
'#3771D9',
'#4D89E5',
'#64A5D3',
'#72BED6',
'#83CED6',
'#A6E1E0',
'#B8EFE2',
'#D7F9F0',
])
.style({
opacity: 1,
strokeWidth: 0,
stroke: '#fff',
});
scene.addLayer(pointLayer);
},
)
})
}, [])
return (
<div
id="map"
style={{
height:'500px',
position: 'relative'
}}
/>
);
}

View File

@ -3,43 +3,42 @@ import { GaodeMap } from '@antv/l7-maps';
import React, { useEffect } from 'react';
export default () => {
useEffect(() => {
const scene = new Scene({
id: 'map',
pickBufferScale: 1.0,
map: new GaodeMap({
center: [121.268, 30.3628],
pitch: 0,
style: 'normal',
zoom: 10,
}),
});
useEffect(() => {
const scene = new Scene({
id: 'map',
pickBufferScale: 1.0,
map: new GaodeMap({
center: [121.268, 30.3628],
pitch: 0,
style: 'normal',
zoom: 10,
}),
});
const layer = new ImageLayer({});
layer.source(
// 'https://gw.alipayobjects.com/zos/rmsportal/FnHFeFklTzKDdUESRNDv.jpg',
// 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*0TVXSbkyKvsAAAAAAAAAAAAAARQnAQ',
'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*4k6vT6rUsk4AAAAAAAAAAAAAARQnAQ',
{
parser: {
type: 'image',
extent: [121.168, 30.2828, 121.384, 30.4219],
},
},
);
scene.on('loaded', () => {
scene.addLayer(layer);
})
}, [])
return (
<div
id="map"
style={{
height:'500px',
position: 'relative'
}}
/>
const layer = new ImageLayer({});
layer.source(
// 'https://gw.alipayobjects.com/zos/rmsportal/FnHFeFklTzKDdUESRNDv.jpg',
// 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*0TVXSbkyKvsAAAAAAAAAAAAAARQnAQ',
'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*4k6vT6rUsk4AAAAAAAAAAAAAARQnAQ',
{
parser: {
type: 'image',
extent: [121.168, 30.2828, 121.384, 30.4219],
},
},
);
}
scene.on('loaded', () => {
scene.addLayer(layer);
});
}, []);
return (
<div
id="map"
style={{
height: '500px',
position: 'relative',
}}
/>
);
};

View File

@ -1,2 +0,0 @@
### 点图层
<code src="./circle.tsx"></code>

View File

@ -3,48 +3,44 @@ import { GaodeMap } from '@antv/l7-maps';
import React, { useEffect } from 'react';
export default () => {
useEffect(() => {
const scene = new Scene({
id: 'map',
pickBufferScale: 1.0,
map: new GaodeMap({
center: [121.268, 30.3628],
pitch: 0,
style: 'blank',
zoom: 10,
}),
});
useEffect(() => {
const scene = new Scene({
id: 'map',
pickBufferScale: 1.0,
map: new GaodeMap({
center: [121.268, 30.3628],
pitch: 0,
style: 'blank',
zoom: 10,
}),
});
const layerTile = new RasterLayer({
zIndex: 1,
});
layerTile.source(
'//t3.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=f1f2021a42d110057042177cd22d856f',
{
parser: {
type: 'rasterTile',
tileSize: 256,
// zoomOffset: 0
zoomOffset: 1
}
}
)
scene.on('loaded', () => {
scene.addLayer(layerTile);
})
}, [])
return (
<div
id="map"
style={{
height:'500px',
position: 'relative'
}}
/>
const layerTile = new RasterLayer({
zIndex: 1,
});
layerTile.source(
'//t3.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=f1f2021a42d110057042177cd22d856f',
{
parser: {
type: 'rasterTile',
tileSize: 256,
// zoomOffset: 0
zoomOffset: 1,
},
},
);
}
scene.on('loaded', () => {
scene.addLayer(layerTile);
});
}, []);
return (
<div
id="map"
style={{
height: '500px',
position: 'relative',
}}
/>
);
};

View File

@ -163,10 +163,10 @@
"postbuild": "yarn build:declarations",
"build:declarations": "lerna run tsc --stream --no-bail",
"fix": "run-p -c 'lint:ts-* --fix'",
"lint:fix": "prettier --write docs/api/**/*.md docs/api/*.md stories/**/**/*.tsx *.md",
"lint:fix": "prettier --write docs/api/**/*.md docs/api/*.md dev-demos/**/**/*.tsx *.md",
"lint:examples": "eslint packages/site/examples --fix --ext .js",
"lint:css": "stylelint 'packages/**/src/**/*.js{,x}'",
"lint:ts-prod1": "tslint --fix --config tslint.prod.json 'packages/**/*.ts{,x}'",
"lint:ts-prod": "tslint --fix --config tslint.prod.json 'packages/**/*.ts{,x}'",
"lint:ts-test": "tslint --fix --config tslint.json 'packages/**/*.{spec,story}.ts{,x}'",
"lint:ts": "run-p -c lint:ts-*",
"lint": "run-p -c lint:*",
@ -194,11 +194,11 @@
},
"workspaces": [
"packages/*",
"stories/*"
"dev-demos/*"
],
"husky": {
"hooks": {
"pre-commit": "yarn run lint",
"pre-commit": "yarn run build && yarn run test-cover",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},

View File

@ -25,7 +25,7 @@
"author": "xiaoiver",
"license": "ISC",
"devDependencies": {
"gl": "^4.4.0"
"gl": "^5.0.3"
},
"dependencies": {
"@antv/l7-core": "2.9.23",