As ususal, please clone the repo first.
We use lerna in addition to yarn workspaces
The prerequisites are :
- node 18 or higher
- yarn
- An OpenCage geosearch key
We would recommend installing globally serve
. To serve the examples
yarn global add serve
# or
npm i -g serve
To set up the environment, once:
# install the dependencies
yarn
Create .env
file containing your personal Key
yarn dotenv <YOUR-GEOSEARCH-KEY>
this will create a .env file in :
Create the symbolic links
yarn symlinks
This will create symbolic links, so the examples can use the locally built version of the packages.
to build the packages run the command
yarn build
to run a continuous build, use the command
yarn watch
The playground is the React example which allows checking the built core package.
Start the playground with the command
yarn playground:start
So far other examples are provided:
It uses the bundle version of the package for an effortless integration in your website.
serve -S examples/simple-example
it uses the core version of the package and demonstrates the different options on the geosearch
serve -S examples/advanced-example
Two examples how to use the plugin and other sources in the same autocomplete input.
serve -S examples/multiple-sources
check the examples:
1- open http://localhost:3000/ : adding your own data, a set of place in this example 2- open http://localhost:3000/index2.html: adding a aynch request, a query to wikipedia in this example
it uses the bundle version along with the dedicated Leaflet's plugin
serve -S examples/leaflet-plugin-example
check the examples:
1- open http://localhost:3000/ 2- open http://localhost:3000/index-with-custom-marker
it uses the bundle version along with the dedicated OpenLayers's plugin
serve -S examples/openlayers-library-example
1- open http://localhost:3000/
We use the airnnb
config with eslint
yarn lint
yarn test
yarn test:coverage
the open your browser with open ./packages/geosearch-core/coverage/index.html
run the command
yarn build:clean
yarn clean
# LOGIN on npmjs
npm login
# DO NOT FORGET TO BUILD FIRST
yarn build
# Let's publish
lerna publish --no-private
after publishing, run
yarn
yarn outdated
update the deps for the examples:
Package Current Wanted Latest Workspace
@opencage/geosearch-core 0.0.19 0.0.19 0.0.20 @opencage/nodejs-example
@opencage/geosearch-core 0.0.19 0.0.19 0.0.20 @opencage/geosearch-react-example
update the yarn lock file with
yarn
and finally commit with a post publish message:
git commit -am "post publish updates"
Sometimes yarn audit
fails. An alternative is
yarn audit --groups "dependencies"