Skip to content

Commit 6a8294c

Browse files
authored
Add CI lint and test (#82)
* Add CI * fmt
1 parent e6b0b70 commit 6a8294c

17 files changed

+163
-66
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
14+
jobs:
15+
lint-and-test:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
22+
- name: Set up Volta
23+
uses: volta-cli/action@v4
24+
25+
- name: Get npm cache directory
26+
id: npm-cache-dir
27+
shell: bash
28+
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
29+
30+
- uses: actions/cache@v3
31+
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
32+
with:
33+
path: ${{ steps.npm-cache-dir.outputs.dir }}
34+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
35+
restore-keys: |
36+
${{ runner.os }}-node-
37+
38+
- name: Install
39+
run: npm install
40+
41+
- name: Prettier check
42+
run: npm run fmt:check
43+
44+
- name: Type check
45+
run: npm run typecheck
46+
47+
- name: Test
48+
run: npm run test

.prettierrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"tabWidth": 2,
3+
"semi": true,
4+
"trailingComma": "all"
5+
}

package-lock.json

Lines changed: 48 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@
2222
"default": "./dist/dist.es.mjs"
2323
},
2424
"scripts": {
25-
"build": "npm run build:tsc && npm run build:rollup",
26-
"build:tsc": "tsc",
2725
"build:rollup": "rollup -c rollup.config.js",
26+
"build:tsc": "tsc",
27+
"build": "npm run build:tsc && npm run build:rollup",
2828
"clean": "rimraf dist",
29-
"watch": "tsc --watch",
29+
"fmt:check": "prettier './src/**/*.ts' --check",
30+
"fmt": "prettier './src/**/*.ts' --write",
31+
"prepublishOnly": "npm run clean && npm run build",
3032
"test": "vitest run",
31-
"prepublishOnly": "npm run clean && npm run build"
33+
"typecheck": "tsc --build",
34+
"watch": "tsc --watch"
3235
},
3336
"files": [
3437
"dist/",
@@ -54,6 +57,7 @@
5457
"@rollup/plugin-terser": "^0.4.3",
5558
"@rollup/plugin-typescript": "^11.1.2",
5659
"apache-arrow": "^13.0.0",
60+
"prettier": "^3.1.0",
5761
"rimraf": "^5.0.5",
5862
"rollup": "^3.26.2",
5963
"rollup-plugin-dts": "^5.3.0",

src/arc-layer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const defaultProps: DefaultProps<GeoArrowArcLayerProps> = {
108108
};
109109

110110
export class GeoArrowArcLayer<
111-
ExtraProps extends {} = {}
111+
ExtraProps extends {} = {},
112112
> extends CompositeLayer<Required<GeoArrowArcLayerProps> & ExtraProps> {
113113
static defaultProps = defaultProps;
114114
static layerName = "GeoArrowArcLayer";

src/column-layer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const defaultProps: DefaultProps<GeoArrowColumnLayerProps> = {
104104
* coordinates.
105105
*/
106106
export class GeoArrowColumnLayer<
107-
ExtraProps extends {} = {}
107+
ExtraProps extends {} = {},
108108
> extends CompositeLayer<Required<GeoArrowColumnLayerProps> & ExtraProps> {
109109
static defaultProps = defaultProps;
110110
static layerName = "GeoArrowColumnLayer";
@@ -130,7 +130,7 @@ export class GeoArrowColumnLayer<
130130
}
131131

132132
_renderLayersPoint(
133-
geometryColumn: PointVector
133+
geometryColumn: PointVector,
134134
): Layer<{}> | LayersList | null {
135135
const { data: table } = this.props;
136136

src/earcut.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function earcutSinglePolygon(data: PolygonData, geomIndex: number): number[] {
4040

4141
const slicedFlatCoords = flatCoords.values.subarray(
4242
coordsBegin * dim,
43-
coordsEnd * dim
43+
coordsEnd * dim,
4444
);
4545

4646
const initialCoordIndex = ringOffsets[ringBegin];

src/h3-hexagon-layer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const defaultProps: DefaultProps<GeoArrowH3HexagonLayerProps> = {
5656
};
5757

5858
export class GeoArrowH3HexagonLayer<
59-
ExtraProps extends {} = {}
59+
ExtraProps extends {} = {},
6060
> extends CompositeLayer<Required<GeoArrowH3HexagonLayerProps> & ExtraProps> {
6161
static defaultProps = defaultProps;
6262
static layerName = "GeoArrowH3HexagonLayer";

src/heatmap-layer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const defaultProps: DefaultProps<GeoArrowHeatmapLayerProps> = {
7070
};
7171

7272
export class GeoArrowHeatmapLayer<
73-
ExtraProps extends {} = {}
73+
ExtraProps extends {} = {},
7474
> extends CompositeLayer<Required<GeoArrowHeatmapLayerProps> & ExtraProps> {
7575
static defaultProps = defaultProps;
7676
static layerName = "GeoArrowHeatmapLayer";
@@ -92,7 +92,7 @@ export class GeoArrowHeatmapLayer<
9292
}
9393

9494
_renderLayersPoint(
95-
geometryColumn: PointVector
95+
geometryColumn: PointVector,
9696
): Layer<{}> | LayersList | null {
9797
const { data: table } = this.props;
9898

src/path-layer.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const defaultProps: DefaultProps<GeoArrowPathLayerProps> = {
9898
* Render lists of coordinate points as extruded polylines with mitering.
9999
*/
100100
export class GeoArrowPathLayer<
101-
ExtraProps extends {} = {}
101+
ExtraProps extends {} = {},
102102
> extends CompositeLayer<Required<GeoArrowPathLayerProps> & ExtraProps> {
103103
static defaultProps = defaultProps;
104104
static layerName = "GeoArrowPathLayer";
@@ -112,15 +112,15 @@ export class GeoArrowPathLayer<
112112

113113
const lineStringVector = getGeometryVector(
114114
table,
115-
EXTENSION_NAME.LINESTRING
115+
EXTENSION_NAME.LINESTRING,
116116
);
117117
if (lineStringVector !== null) {
118118
return this._renderLayersLineString(lineStringVector);
119119
}
120120

121121
const multiLineStringVector = getGeometryVector(
122122
table,
123-
EXTENSION_NAME.MULTILINESTRING
123+
EXTENSION_NAME.MULTILINESTRING,
124124
);
125125
if (multiLineStringVector !== null) {
126126
return this._renderLayersMultiLineString(multiLineStringVector);
@@ -139,7 +139,7 @@ export class GeoArrowPathLayer<
139139
}
140140

141141
_renderLayersLineString(
142-
geometryColumn: LineStringVector
142+
geometryColumn: LineStringVector,
143143
): Layer<{}> | LayersList | null {
144144
const { data: table } = this.props;
145145

@@ -206,7 +206,7 @@ export class GeoArrowPathLayer<
206206
}
207207

208208
_renderLayersMultiLineString(
209-
geometryColumn: MultiLineStringVector
209+
geometryColumn: MultiLineStringVector,
210210
): Layer<{}> | LayersList | null {
211211
const { data: table } = this.props;
212212

0 commit comments

Comments
 (0)