23. Publish npms

We publish npms located in the folder n4js-libs to the public npm registry. Specifically, the following npms are published:

Command line tools
  • n4js-cli

  • n4js-mangelhaft-cli

Runtime definition files
  • n4js-runtime-ecma402

  • n4js-runtime-es2015

  • n4js-runtime-esnext

  • n4js-runtime-fetch

  • n4js-runtime-html5

  • n4js-runtime-node

  • n4js-runtime-v8

Mangelhaft
  • org.eclipse.n4js.mangelhaft

  • org.eclipse.n4js.mangelhaft.assert

  • org.eclipse.n4js.mangelhaft.reporter.console

  • org.eclipse.n4js.mangelhaft.reporter.ide

  • org.eclipse.n4js.mangelhaft.reporter.xunit

  • org.eclipse.n4js.mangelhaft.runner.ide

In order to make sure that the npms work correctly with the n4js product, we need to integration test the interplay between the n4js products and the npms. Right now, we only focus on the interplay between the n4js headless compiler and npms. For integration tests, we publish the npms to a local npm registry which is provided by verdaccio docker image before executing the tests. When all integration tests are executed, we stop the local npm registry.

23.1. Publish n4js-libs to during maven build

The NPMs are currently published using NumberFour’s internal build infrastructure in combination with extended integration tests. This needs to be changed in the future!

This section describes how integration tests can use local npm registry during the test. All integration tests that require a local npm registry should be placed in the bundle org.eclipse.n4js.hlc.integrationtests

publish npm in mvn workflow
Figure 61. Maven phases

During the maven build, three projects org.eclipse.n4js.external.libraries.update, org.eclipse.n4js.product.build and org.eclipse.n4js.hlc.integrations are built by maven in that order.

  • During the phase process-classes of the org.eclipse.n4js.external.libraries.update build, the UpdateShippedCode MWE2 workflow is triggerd to compile n4js code of npms in n4js-lib. The phase process-classes was chosen because it must happen after the org.eclipse.n4js.external.libraries.update bundle has been compiled.

  • During the verify phase of the org.eclipse.n4js.product.build build, the Maven exec-maven plugin calls the script n4js/releng/utils/scripts/publish-n4js-libs.sh to publish the npms in the n4js-lib to the staging npm registry. The URL of this staging npm registry must be configured before triggering maven build via the environment variable NPM_STAGING_REGISTRY. Note that the staging npm registry lives beyond the life of n4js-inhouse 's maven build and holds npms that are needed by the integration tests in the n4js-extended’s build.

  • During the pre-integration-test phase of the org.eclipse.n4js.hlc.integrationtests bundle, the Maven antrun plugin starts a verdaccio docker container local npm registry at http://localhost:4873 via docker. Also in the very same phase, the Maven plugin exec-maven calls the script n4js/releng/utils/scripts/publish-n4js-libs.sh to publish the npms in the n4js-lib folder to the local registry http://localhost:4873. The list of published npms is identical to that list above. Note that the npms are published with the dist-tag test.

  • During the integration-test phase of org.eclipse.n4js.hlc.integrationtests, the Maven failsafe plugin executes the integration tests. Here, the integration tests can pull the required npms from the local registry populated during the pre-integration-test above.

  • In the pre-integration-test phase of org.eclipse.n4js.hlc.integrationtests, the Maven antrun plugins removes the verdaccio docker container.

Quick Links