Skip to content

Commit f221da6

Browse files
Update dev tools (#215)
1 parent 5d67929 commit f221da6

File tree

25 files changed

+1535
-1477
lines changed

25 files changed

+1535
-1477
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const {getESLintConfig} = require('ocular-dev-tools/configuration');
1+
const {getESLintConfig} = require('@vis.gl/dev-tools/configuration');
22

33
module.exports = getESLintConfig({
44
/** Set React version, if any */

.github/workflows/release.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
check_branch:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
should_build: ${{ steps.permitted.outputs.result }}
13+
14+
steps:
15+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
16+
17+
- name: Fetch remote branches
18+
run: |
19+
git fetch origin --depth=1
20+
21+
- name: Check if on permitted branch
22+
id: permitted
23+
run: |
24+
result=
25+
if git branch -a --contains $GITHUB_SHA | grep -q 'remotes/origin/master$'; then
26+
result=true
27+
elif git branch -a --contains $GITHUB_SHA | grep -q 'remotes/origin/.*-release$'; then
28+
result=true
29+
fi
30+
echo "result=${result}" >> "$GITHUB_OUTPUT"
31+
32+
release:
33+
runs-on: ubuntu-22.04
34+
needs: check_branch
35+
permissions:
36+
contents: write
37+
38+
if: ${{ github.repository_owner == 'visgl' && needs.check_branch.outputs.should_build }}
39+
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
43+
44+
steps:
45+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
46+
- uses: volta-cli/action@5c175f92dea6f48441c436471e6479dbc192e194 # v4.2.1
47+
with:
48+
cache: 'yarn'
49+
50+
- name: Install dependencies
51+
run: |
52+
yarn
53+
yarn bootstrap
54+
55+
- name: Build packages
56+
run: yarn build
57+
58+
- name: Run tests
59+
run: |
60+
yarn lint
61+
yarn test
62+
63+
- name: Login to NPM
64+
run: npm config set "//registry.npmjs.org/:_authToken=${NPM_ACCESS_TOKEN}"
65+
66+
- name: Publish to NPM
67+
run: npx ocular-publish from-git

.github/workflows/test.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,21 @@ jobs:
1717
checks: write
1818
contents: read
1919

20-
# NOTE: Pin official GitHub actions to a version number, pin third-party actions to a SHA1.
21-
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-third-party-actions
2220
steps:
23-
- uses: actions/checkout@v4.1.1
24-
25-
- uses: volta-cli/action@v4
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
- uses: volta-cli/action@5c175f92dea6f48441c436471e6479dbc192e194 # v4.2.1
23+
with:
24+
cache: 'yarn'
2625

2726
- name: Install dependencies
2827
run: |
29-
yarn install
28+
yarn
3029
yarn bootstrap
3130
31+
- name: Build packages
32+
run: yarn build
33+
3234
- name: Run tests
3335
run: |
34-
yarn test-ci
36+
yarn lint
37+
yarn test

.ocularrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ const config = {
1212
babel: false,
1313

1414
lint: {
15-
paths: ['modules', 'docs', 'test'], // 'examples'], module resolution errors
15+
paths: ['modules', 'test'], // 'docs', 'examples'], module resolution errors
1616
extensions: ['js', 'ts', 'jsx', 'tsx']
1717
},
1818

1919
typescript: {
20-
project: 'tsconfig.build.json'
20+
project: 'tsconfig.json'
2121
},
2222

2323
aliases: {

.yarnrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

modules/arrow-layers/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../../tsconfig.module.json",
2+
"extends": "../../tsconfig.json",
33
"include": ["src/**/*"],
44
"exclude": ["node_modules"],
55
"compilerOptions": {

modules/bing-maps/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../../tsconfig.module.json",
2+
"extends": "../../tsconfig.json",
33
"include": ["src/**/*"],
44
"exclude": ["node_modules"],
55
"compilerOptions": {

modules/editable-layers/src/edit-modes/utils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,21 @@ export function recursivelyTraverseNestedArrays(
8181
export function generatePointsParallelToLinePoints(
8282
p1: Position,
8383
p2: Position,
84-
mapCoords: Position
84+
coords: Position
8585
): Position[] {
8686
const lineString: LineString = {
8787
type: 'LineString',
8888
coordinates: [p1, p2]
8989
};
90-
const pt = point(mapCoords);
90+
const pt = point(coords);
9191
const ddistance = pointToLineDistance(pt, lineString);
9292
const lineBearing = bearing(p1, p2);
9393

9494
// Check if current point is to the left or right of line
9595
// Line from A=(x1,y1) to B=(x2,y2) a point P=(x,y)
9696
// then (x−x1)(y2−y1)−(y−y1)(x2−x1)
9797
const isPointToLeftOfLine =
98-
(mapCoords[0] - p1[0]) * (p2[1] - p1[1]) - (mapCoords[1] - p1[1]) * (p2[0] - p1[0]);
98+
(coords[0] - p1[0]) * (p2[1] - p1[1]) - (coords[1] - p1[1]) * (p2[0] - p1[0]);
9999

100100
// Bearing to draw perpendicular to the line string
101101
const orthogonalBearing = isPointToLeftOfLine < 0 ? lineBearing - 90 : lineBearing - 270;
@@ -470,21 +470,21 @@ function getEditHandlesForCoordinates(
470470
* Calculates coordinates for a feature preserving rectangular shape.
471471
* @param feature Feature before modification.
472472
* @param editHandleIndex Index of the point to modify.
473-
* @param mapCoords New position for the point.
473+
* @param coords New position for the point.
474474
* @returns Updated coordinates.
475475
*/
476476
export function updateRectanglePosition(
477477
feature: FeatureOf<Polygon>,
478478
editHandleIndex: number,
479-
mapCoords: Position
479+
coords: Position
480480
): Position[][] | null {
481481
const coordinates = feature.geometry.coordinates;
482482
if (!coordinates) {
483483
return null;
484484
}
485485

486486
const points = coordinates[0].slice(0, 4);
487-
points[editHandleIndex % 4] = mapCoords;
487+
points[editHandleIndex % 4] = coords;
488488

489489
const p0 = points[(editHandleIndex + 2) % 4];
490490
const p2 = points[editHandleIndex % 4];

modules/editable-layers/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../../tsconfig.module.json",
2+
"extends": "../../tsconfig.json",
33
"include": ["src/**/*"],
44
"exclude": ["node_modules"],
55
"compilerOptions": {

modules/experimental/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../../tsconfig.module.json",
2+
"extends": "../../tsconfig.json",
33
"include": ["src/**/*"],
44
"exclude": ["node_modules"],
55
"compilerOptions": {

0 commit comments

Comments
 (0)