Skip to content

Start vnu server on the first available port #1

@prantlf

Description

@prantlf

The vnu server can save considerable amount of time, when HTML pages are validated during a CI/CD build. Even around 50 pages can be validated in 15 seconds instead of in 50 seconds, when the server is used instead of starting multiple java processes.

However, when multiple builds run on a single machine concurrently, some of them fail, because the vnu server can be configured for a single port only and if another server is running, another one cannot be started. This problem has two solutions:

  1. Run the vnu server separately as a shared service for all builds.
  2. Make the vnu server within the single build using just the available port.

The first option looks better, but may break the requirement of freezing the build tool version after release. The second option means less investment in changes of the build process, especially if Grunt is used.

How about introducing the parameter useAvailablePort similar to grunt-contrib-connect to let the concurrent Grunt builds succeed using the option 2 from above?

Example extracted from README.md:

var vnuPort;

grunt.initConfig({
    vnuserver: {
        options: {
            port: 49152,
            useAvailablePort: true
        }
    },
    htmllint: {
        options: {
            server: function () {
                return {
                    port: vnuPort
                };
            }
        },
        all: {
            src: "app.html"
        }
    }
});

grunt.event.on('vnuserver.listening', function (port) {
    vnuPort = port;
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions