Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-script-loading-and-replace-lodash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-naver-maps": patch
---

Fix promise caching and error handling in loadNavermapsScript, replace deprecated lodash packages with lodash-es
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: CI

on:
pull_request:
branches: [main]

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install
- run: pnpm -r run build
- run: pnpm -r run lint
- run: pnpm -r run test
41 changes: 13 additions & 28 deletions .github/workflows/deploy-next-website.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,33 @@
name: Deploy Next Website
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on:

on:
push:
branches:
- next

jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
concurrency: ci-${{ github.ref }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
version: 7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
node-version: 22
cache: pnpm
- name: Install and Build
run: |
pnpm install
pnpm -r run build
env:
WEBSITE_BASE_PATH: '/react-naver-maps/next'

- name: Deploy 🚀
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: website/out
target-folder: './next'
clean: false

# runs-on: ubuntu-latest
# steps:
# - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
# - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
# - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
# - name: Check out repository code
# uses: actions/checkout@v3
# - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
# - run: echo "🖥️ The workflow is now ready to test your code on the runner."
# - name: List files in the repository
# run: |
# ls ${{ github.workspace }}
# - run: echo "🍏 This job's status is ${{ job.status }}."
33 changes: 16 additions & 17 deletions .github/workflows/deploy-website.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
name: Deploy Website
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on:

on:
push:
branches:
- main
env:

env:
NEXT_PUBLIC_GA_TRACKING_ID: G-51RCXPWJLZ
NEXT_PUBLIC_WEBSITE_BASE_PATH: '/react-naver-maps'

jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
concurrency: ci-${{ github.ref }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
node-version: 22
cache: pnpm
- name: Install and Build
run: |
pnpm install
pnpm -r run build

- name: Deploy 🚀
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: website/out
clean: false
clean: false
29 changes: 25 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,30 @@ jobs:
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
# with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
# publish: yarn release
with:
publish: pnpm changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Upload package tarballs to GitHub Releases
if: steps.changesets.outputs.published == 'true'
run: |
TMPDIR=$(mktemp -d)
echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -c '.[]' | while read pkg; do
name=$(echo "$pkg" | jq -r '.name')
version=$(echo "$pkg" | jq -r '.version')
tag="${name}@${version}"

pnpm --filter "$name" pack --pack-destination "$TMPDIR"
tarball="${TMPDIR}/${name}-${version}.tgz"
if [ -f "$tarball" ]; then
gh release upload "$tag" "$tarball" --clobber
echo "✓ ${name}-${version}.tgz → $tag"
else
echo "⚠ tarball not found: $tarball"
fi
done
rm -rf "$TMPDIR"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"husky": "^8.0.0",
"typescript": "^4.8.4"
},
"packageManager": "pnpm@7.26.3"
"packageManager": "pnpm@10.30.1"
}
1 change: 1 addition & 0 deletions packages/next-docz/src/rehype/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export const formatter = async (code: string) => {

// @ts-expect-error prettier@2 has no type declarations
const { default: prettier } = await import('prettier');
return prettier.format(code, {
parser: 'babel',
Expand Down
2 changes: 1 addition & 1 deletion packages/next-docz/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */

/* Advanced Options */
// "skipLibCheck": true, /* Skip type checking of declaration files. */
"skipLibCheck": true, /* Skip type checking of declaration files. */
// "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
"importsNotUsedAsValues": "error"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/react-naver-maps/src/naver-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export const NaverMap = forwardRef<naver.maps.Map | null, Props>(function NaverM
return acc;
}, {});

const _nmap = new navermaps.Map(mapDiv, { ...basicMapOptions, ...kvos });
const _nmap = new navermaps.Map(mapDiv, { ...basicMapOptions, ...kvos } as naver.maps.MapOptions);
setNmap(_nmap);
// for ref hack
nmapRef.current = _nmap;
Expand Down Expand Up @@ -305,14 +305,14 @@ function NaverMapCore({ nmap, children, ...mapProps }: Props & { nmap: naver.map

function getDirtyKVOs(keys: Array<typeof kvoKeys[number]>): Pick<Props, typeof kvoKeys[number]> {
return keys.reduce((acc, key) => {
const currentValue = nmap[`get${upperFirst(key)}` as keyof naver.maps.Map]();
const currentValue = (nmap[`get${upperFirst(key)}` as keyof naver.maps.Map] as () => unknown)() as any;
const propValue = mapProps[key];

if (!propValue || prevKVOs && prevKVOs[key] === propValue) {
return acc;
}

const isEqual = typeof currentValue.equals === 'function' ? currentValue.equals(propValue) : currentValue === propValue;
const isEqual = typeof currentValue?.equals === 'function' ? currentValue.equals(propValue) : currentValue === propValue;

if (isEqual) {
return acc;
Expand Down
12 changes: 6 additions & 6 deletions packages/react-naver-maps/src/overlays/circle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ type CircleOptions = {
strokeWeight?: number;
strokeOpacity?: number;
strokeColor?: string;
strokeStyle?: naver.maps.strokeStyleType;
strokeLineCap?: naver.maps.strokeLineCapType;
strokeLineJoin?: naver.maps.strokeLineJoinType;
strokeStyle?: naver.maps.StrokeStyleType;
strokeLineCap?: naver.maps.StrokeLineCapType;
strokeLineJoin?: naver.maps.StrokeLineJoinType;
fillColor?: string;
fillOpacity?: number;
clickable?: boolean;
Expand All @@ -64,9 +64,9 @@ export type Props = CircleOptions & {
onStrokeWeightChanged?: (value: number) => void;
onStrokeOpacityChanged?: (value: number) => void;
onStrokeColorChanged?: (value: string) => void;
onStrokeStyleChanged?: (value: naver.maps.strokeStyleType) => void;
onStrokeLineCapChanged?: (value: naver.maps.strokeLineCapType) => void;
onStrokeLineJoinChanged?: (value: naver.maps.strokeLineJoinType) => void;
onStrokeStyleChanged?: (value: naver.maps.StrokeStyleType) => void;
onStrokeLineCapChanged?: (value: naver.maps.StrokeLineCapType) => void;
onStrokeLineJoinChanged?: (value: naver.maps.StrokeLineJoinType) => void;
onFillColorChanged?: (value: string) => void;
onFillOpacityChanged?: (value: number) => void;
onClickableChanged?: (event: boolean) => void;
Expand Down
12 changes: 6 additions & 6 deletions packages/react-naver-maps/src/overlays/ellipse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ type EllipseOptions = {
strokeWeight?: number;
strokeOpacity?: number;
strokeColor?: string;
strokeStyle?: naver.maps.strokeStyleType;
strokeLineCap?: naver.maps.strokeLineCapType;
strokeLineJoin?: naver.maps.strokeLineJoinType;
strokeStyle?: naver.maps.StrokeStyleType;
strokeLineCap?: naver.maps.StrokeLineCapType;
strokeLineJoin?: naver.maps.StrokeLineJoinType;
fillColor?: string;
fillOpacity?: number;
clickable?: boolean;
Expand All @@ -61,9 +61,9 @@ export type Props = EllipseOptions & {
onStrokeWeightChanged?: (value: number) => void;
onStrokeOpacityChanged?: (value: number) => void;
onStrokeColorChanged?: (value: string) => void;
onStrokeStyleChanged?: (value: naver.maps.strokeStyleType) => void;
onStrokeLineCapChanged?: (value: naver.maps.strokeLineCapType) => void;
onStrokeLineJoinChanged?: (value: naver.maps.strokeLineJoinType) => void;
onStrokeStyleChanged?: (value: naver.maps.StrokeStyleType) => void;
onStrokeLineCapChanged?: (value: naver.maps.StrokeLineCapType) => void;
onStrokeLineJoinChanged?: (value: naver.maps.StrokeLineJoinType) => void;
onFillColorChanged?: (value: string) => void;
onFillOpacityChanged?: (value: number) => void;
onClickableChanged?: (event: boolean) => void;
Expand Down
4 changes: 2 additions & 2 deletions packages/react-naver-maps/src/overlays/marker.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { render, waitFor } from '@testing-library/react';
import { omit } from 'lodash-es';
import { ReactElement, Suspense } from 'react';

import { NaverMapContext } from '../contexts/naver-map';
import { Marker } from './marker';
import { NaverMapContext } from '../contexts/naver-map';

const map = {} as naver.maps.Map;
function renderOverlay(overlay: ReactElement) {
Expand Down Expand Up @@ -35,7 +35,7 @@ const mockMarker = jest.fn().mockImplementation((opt) => {

describe('<Marker />', () => {
beforeEach(() => {
options = {};
options = {} as naver.maps.MarkerOptions;
mockMarker.mockClear();
Object.values(mockMethods).forEach(mock => mock.mockClear());
// @ts-expect-error mocking navermaps client loader
Expand Down
4 changes: 2 additions & 2 deletions packages/react-naver-maps/src/overlays/marker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function isEqualKvo(kvo: any, target: any) {

export const Marker = forwardRef<naver.maps.Marker, Props>(function Marker(props, ref) {
const navermaps = useNavermaps();
const [marker] = useState(() => new navermaps.Marker(makeInitialOption(props)));
const [marker] = useState(() => new navermaps.Marker(makeInitialOption(props) as naver.maps.MarkerOptions));
useImperativeHandle<naver.maps.Marker | undefined, naver.maps.Marker | undefined>(ref, () => marker);

// make dirties
Expand Down Expand Up @@ -164,7 +164,7 @@ export const Marker = forwardRef<naver.maps.Marker, Props>(function Marker(props
return;
}

marker.setOptions(dirties);
marker.setOptions(dirties as naver.maps.MarkerOptions);
}, primitiveKeys.map(key => dirtiesRef.current[key]));

return (
Expand Down
14 changes: 7 additions & 7 deletions packages/react-naver-maps/src/overlays/polygon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ type PolygonOptions = {
/**
* @type naver.maps.ArrayOfCoords[] | naver.maps.KVOArrayOfCoords[] | naver.maps.ArrayOfCoordsLiteral[]
*/
paths: naver.maps.ArrayOfCoords[] | naver.maps.KVOArrayOfCoords[] | naver.maps.ArrayOfCoordsLiteral[];
paths: naver.maps.ArrayOfCoords[] | naver.maps.KVOArray<naver.maps.KVOArrayOfCoords> | naver.maps.ArrayOfCoordsLiteral[];
strokeWeight?: number;
strokeOpacity?: number;
strokeColor?: string;
strokeStyle?: naver.maps.strokeStyleType;
strokeLineCap?: naver.maps.strokeLineCapType;
strokeLineJoin?: naver.maps.strokeLineJoinType;
strokeStyle?: naver.maps.StrokeStyleType;
strokeLineCap?: naver.maps.StrokeLineCapType;
strokeLineJoin?: naver.maps.StrokeLineJoinType;
fillColor?: string;
fillOpacity?: number;
clickable?: boolean;
Expand All @@ -57,9 +57,9 @@ export type Props = PolygonOptions & {
onStrokeWeightChanged?: (value: number) => void;
onStrokeOpacityChanged?: (value: number) => void;
onStrokeColorChanged?: (value: string) => void;
onStrokeStyleChanged?: (value: naver.maps.strokeStyleType) => void;
onStrokeLineCapChanged?: (value: naver.maps.strokeLineCapType) => void;
onStrokeLineJoinChanged?: (value: naver.maps.strokeLineJoinType) => void;
onStrokeStyleChanged?: (value: naver.maps.StrokeStyleType) => void;
onStrokeLineCapChanged?: (value: naver.maps.StrokeLineCapType) => void;
onStrokeLineJoinChanged?: (value: naver.maps.StrokeLineJoinType) => void;
onFillColorChanged?: (value: string) => void;
onFillOpacityChanged?: (value: number) => void;
onClickableChanged?: (event: boolean) => void;
Expand Down
12 changes: 6 additions & 6 deletions packages/react-naver-maps/src/overlays/polyline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ type PolylineOptions = {
strokeWeight?: number;
strokeOpacity?: number;
strokeColor?: string;
strokeStyle?: naver.maps.strokeStyleType;
strokeLineCap?: naver.maps.strokeLineCapType;
strokeLineJoin?: naver.maps.strokeLineJoinType;
strokeStyle?: naver.maps.StrokeStyleType;
strokeLineCap?: naver.maps.StrokeLineCapType;
strokeLineJoin?: naver.maps.StrokeLineJoinType;
clickable?: boolean;
visible?: boolean;
zIndex?: number;
Expand All @@ -61,9 +61,9 @@ export type Props = PolylineOptions & {
onStrokeWeightChanged?: (value: number) => void;
onStrokeOpacityChanged?: (value: number) => void;
onStrokeColorChanged?: (value: string) => void;
onStrokeStyleChanged?: (value: naver.maps.strokeStyleType) => void;
onStrokeLineCapChanged?: (value: naver.maps.strokeLineCapType) => void;
onStrokeLineJoinChanged?: (value: naver.maps.strokeLineJoinType) => void;
onStrokeStyleChanged?: (value: naver.maps.StrokeStyleType) => void;
onStrokeLineCapChanged?: (value: naver.maps.StrokeLineCapType) => void;
onStrokeLineJoinChanged?: (value: naver.maps.StrokeLineJoinType) => void;
onClickableChanged?: (value: boolean) => void;
onVisibleChanged?: (value: boolean) => void;
onZIndexChanged?: (value: number) => void;
Expand Down
6 changes: 3 additions & 3 deletions packages/react-naver-maps/src/overlays/rectangle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ type RectangleOptions = {
strokeWeight?: number;
strokeOpacity?: number;
strokeColor?: string;
strokeStyle?: naver.maps.strokeStyleType;
strokeLineCap?: naver.maps.strokeLineCapType;
strokeLineJoin?: naver.maps.strokeLineJoinType;
strokeStyle?: naver.maps.StrokeStyleType;
strokeLineCap?: naver.maps.StrokeLineCapType;
strokeLineJoin?: naver.maps.StrokeLineJoinType;
fillColor?: string;
fillOpacity?: number;
clickable?: boolean;
Expand Down
Loading