- Node.js 12+
npm ci
npm run dev
Visit http://localhost:8080/munimap/testing/.
Development script starts webpack with configuration in webpack.config.dev.babel.js
. Webpack then ensures three main functions:
- transpile source code and make it available at http://localhost:8080/munimap/testing/munimaplib.js
- automatically reloads browser in case of any change in source JS files
- precompile HTML pages (add variables from source code or webpack/npm config)
npm run build
Build script runs webpack with configuration in webpack.config.production.babel.js
. Webpack builds everything (including CSS styles) into dist/latest
.
Content of dist
folder is then prepared to be published online.
You can also start server to see built version, just run
npm run start-build
and visit http://localhost:8080/munimap/latest/quickstart.html.
npm run build-testing
npm run build-v2n
Build script runs webpack with configuration in webpack.config.production.babel.js
. Webpack builds everything (including CSS styles) into dist/testing
or dist/<previous-version>
.
npm run test
Test framework is designed for integration tests and use mocha
, chai
and puppeteer
libraries.
To create test use javascript files in test/integration
.
Main functionality:
await page.evaluate(async () => {
// code to run into browser
});
// assertions that compare expected and actual values
assert.equal();
assert.include();
...
Type checking is ensure by JSDoc annotations and TypeScript in the same way as OpenLayers do. The configuration is set in tsconfig.json
.
To check types, run
npm run typecheck
Code style is ensured by ESLint with the same configuration as Openlayers library. The configuration is set in
package.json
, attributeeslintConfig
- in eslint-config-openlayers package
- in @openlayers/eslint-plugin package
- in eslint-plugin-react package
To check code style, run
npm run lint
To automatically fix some code-style issues, run
npm run fix-lint
-
OpenLayers library is not exported as legacy build anymore
It means there is no
ol
namespace with all OpenLayers functions.It's possible to export any subset of OpenLayers classes and methods to
munimap.ol
object. Example is available insrc/munimap/index.js
, where two classes Map and View are exported. Such classes are available asmunimap.ol.Map
andmunimap.ol.View
. For legacy support this exported object is added to window as global objectol
. Ifol
already exists, munimap library can't be initialized.
When upgrading OpenLayers, upgrade also following packages to the same version as new OpenLayers version uses.
Also, upgrade @types/ol package to the same version as OpenLayers.