-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1457 from geoman-io/develop
release v2.16.0
- Loading branch information
Showing
44 changed files
with
3,901 additions
and
15,802 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,5 +19,8 @@ | |
"L": true, | ||
"window": true, | ||
"document": true | ||
} | ||
}, | ||
"ignorePatterns": [ | ||
"cypress/libs" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
env: | ||
FILE_NAME_PREFIX: geoman-io-leaflet-geoman-pro | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
jobs: | ||
build: | ||
name: release job | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set version | ||
id: version | ||
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | ||
|
||
- name: Check version | ||
run: | | ||
PACKAGE_VERSION=$(node -p "require('./package.json').version") | ||
if [ "${{ steps.version.outputs.version }}" != "$PACKAGE_VERSION" ]; then | ||
echo "Tag version ($TAG_VERSION) does not match package.json version ($PACKAGE_VERSION)" | ||
exit 1 | ||
fi | ||
- uses: pnpm/action-setup@v3 | ||
with: | ||
version: 8 | ||
|
||
- name: Use Node.js 20.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
cache: pnpm | ||
|
||
- name: Get pnpm store directory | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- uses: actions/cache@v4 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile --store-dir ${{ env.STORE_PATH }} | ||
|
||
- name: Prepare package | ||
run: pnpm pack | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: ${{ steps.version.outputs.version }} | ||
tag_name: v${{ steps.version.outputs.version }} | ||
token: ${{ secrets.GEOMAN_RELEASE_TOKEN }} | ||
files: | | ||
${{env.FILE_NAME_PREFIX}}-${{ steps.version.outputs.version }}.tgz | ||
LICENSE | ||
- name: Publish to NPM | ||
shell: bash | ||
run: | | ||
#!/bin/bash | ||
# Set npm configurations | ||
pnpm config set shamefully-hoist true | ||
pnpm config set strict-peer-dependencies false | ||
# Set auth token | ||
pnpm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} | ||
pnpm publish --no-git-checks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import * as esbuild from 'esbuild'; | ||
import fs from 'fs'; | ||
|
||
const plugins = [{ | ||
name: 'my-plugin', | ||
setup(build) { | ||
let count = 0; | ||
build.onEnd(({ errors, warnings }) => { | ||
count++; | ||
const message = errors.length === 0 && warnings.length === 0 | ||
? 'Build completed.' | ||
: `Build completed with ${errors.length} error(s) and ${warnings.length} warning(s).`; | ||
console.log(`[BUILD #${count.toString().padStart(3, '0')}]:`, message); }); | ||
}, | ||
}]; | ||
|
||
const buildOptions = { | ||
bundle: true, | ||
entryPoints: ['./src/js/L.PM.js'], | ||
loader: { | ||
'.js': 'jsx', | ||
'.css': 'css', | ||
'.svg': 'dataurl' }, | ||
minify: true, | ||
outfile: './dist/leaflet-geoman.js', | ||
sourcemap: process.env.DEV ? true : false, | ||
} | ||
|
||
const ctx = await esbuild.context({ ...buildOptions, plugins }); | ||
|
||
if (process.env.DEV) { | ||
// Watch in dev mode | ||
await ctx.watch(); | ||
console.log('watching...'); | ||
const { host, port } = await ctx.serve({ | ||
port: 5500, | ||
servedir: '.', | ||
fallback: "./index.html" | ||
}); | ||
console.log(`Serving app at ${host}:${port}.`); | ||
} else { | ||
// Clean /dist folder | ||
fs.rmSync("./dist", { recursive: true, force: true }); | ||
|
||
// Build | ||
await ctx.rebuild(); | ||
|
||
// Dispose context | ||
ctx.dispose(); | ||
|
||
// Copy types | ||
fs.copyFileSync('leaflet-geoman.d.ts', './dist/leaflet-geoman.d.ts'); | ||
fs.copyFileSync('./dist/leaflet-geoman.js', './dist/leaflet-geoman.min.js'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
describe('KeyboardMixin', () => { | ||
it('Should unbind event listeners that bound by the KeyboardMixin after the map is destroyed', () => { | ||
cy.window().then((window) => { | ||
const { map, document } = window; | ||
|
||
map.remove(); | ||
|
||
const isWindowBlurEventUnbound = !Object.entries( | ||
window._leaflet_events | ||
).some(([name, handler]) => name.startsWith('blur') && handler); | ||
expect( | ||
isWindowBlurEventUnbound, | ||
'window blur event listener is not unbound' | ||
).to.eq(true); | ||
|
||
const isKeyUpDownEventUnbound = !Object.entries( | ||
document._leaflet_events | ||
).some(([name, handler]) => name.startsWith('key') && handler); | ||
expect( | ||
isKeyUpDownEventUnbound, | ||
'document keyboard event listener is not unbound' | ||
).to.eq(true); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.