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
27 changes: 27 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": ["eslint:recommended"],
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module"
},
"globals": {
"L": "readonly",
"describe": "readonly",
"it": "readonly",
"expect": "readonly",
"beforeEach": "readonly",
"afterEach": "readonly",
"vi": "readonly"
},
"rules": {
"no-unused-vars": "warn",
"no-console": "warn",
"prefer-const": "error",
"no-var": "error"
}
}
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x, 22.x, 24.x]

steps:
- uses: actions/checkout@v5

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint

- name: Run tests
run: npm test

# - name: Run tests with coverage
# run: npm run test:coverage

- name: Build
run: npm run build

build:
runs-on: ubuntu-latest
needs: test

steps:
- uses: actions/checkout@v5

- name: Use Node.js 22.x
uses: actions/setup-node@v5
with:
node-version: 22.x
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
23 changes: 21 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/.DS_Store
# Dependencies
node_modules

/node_modules/
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/extensions.json

# Local env files
.env
.env.local

# Testing
coverage
coverage.json

# Debug
npm-debug.log*

# Misc
.DS_Store
*.pem
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "es5"
}
85 changes: 52 additions & 33 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,76 @@
## Development and Production Versions

Changes should to go the source files in `src/`. Then you run the build process
outlines below to generate the production-ready files which go into `dist/`. E.g.
those files are concatenated and minified.
Changes should go into the source files in `src/`. Then you run the build process outlined below to generate the production-ready files which go into `dist/`. These files are bundled and minified for optimal performance.

## Rebuilding from Source

The plugin's build process is managed by [Grunt](http://gruntjs.com/installing-grunt),
which in turn is built on top of [Node.js](http://nodejs.org/). You'll need to have
both of these applications installed on your machine to rebuild the plugin from source.
The plugin's build process is managed by [Vite](https://vitejs.dev/), a modern build tool built on top of [Node.js](http://nodejs.org/). You'll need to have Node.js installed on your machine to rebuild the plugin from source.

Assuming you have both Grunt and Node.js (version 10 or higher) installed, you can
install all the build dependencies with a single command, from the plugin's root
directory:
Assuming you have Node.js (version 18 or higher) installed, you can install all the build dependencies with a single command, from the plugin's root directory:

```shell
$ yarn install
```bash
npm install
```

This will install all of the plugin's dependencies into the `node_modules` directory
(and which is also why you'll find this directory in the plugin's `.gitignore` file).
This will install all of the plugin's dependencies into the `node_modules` directory (which is also why you'll find this directory in the plugin's `.gitignore` file).

Once you have all the dependencies in place, you can rebuild the plugin from source
by simply running `yarn build`:
Once you have all the dependencies in place, you can rebuild the plugin from source by running `npm run build`:

```shell
$ yarn build
yarn run v1.22.17
# $ grunt
Running "clean:dist" (clean) task
>> 3 paths cleaned.
```bash
npm run build
```

This command will:

- Clean the `dist/` directory
- Build both production (minified) and development versions

Running "jshint:files" (jshint) task
>> 1 file lint free.
### Development Workflow

Running "concat:dist" (concat) task
For active development, you can use the watch mode to automatically rebuild when
source files change:

```bash
npm run dev
```

### Testing

Run the test suite with:

```bash
npm run test
```

Running "uglify:dist" (uglify) task
>> 1 file created 10.07 kB → 6.82 kB
For watch mode during development:

Running "cssmin:minify" (cssmin) task
>> 1 file created. 2.83 kB → 2.18 kB
```bash
npm run test:watch
```

For test coverage:

```bash
npm run test:coverage
```

### Formatting and Linting

Format code with Prettier:

```bash
npm run format
```

Running "copy:images" (copy) task
Copied 2 files
Check code style with ESLint:

Done.
✨ Done in 0.59s.
```bash
npm run lint
```

## Releasing

1. update version in `bower.json` and `package.json`
1. Update version in `package.json`

2. git commit, git push

Expand Down
107 changes: 0 additions & 107 deletions Gruntfile.js

This file was deleted.

8 changes: 4 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Copyright (c) 2020 OpenCage GmbH (https://opencagedata.com)
Copyright (c) 2020-2025 OpenCage GmbH (https://opencagedata.com)

All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Expand Down
Loading