npmpack:node_modules

Full name:

net.kozelka.maven:npmpack-maven-plugin:1.0-SNAPSHOT:node_modules

Description:

Prepares the node_modules directory.

If it exists, uses MD5 hash of the package.json file is used to determine if its contents should be updated from "npm install".

If it does not exist, unpacks it from an archive within maven repository. If that does not exist, uses "npm install" to produce it.

Attributes:

  • Requires a Maven project to be executed.
  • The goal is thread-safe and supports parallel builds.
  • Binds by default to the lifecycle phase: compile.

Required Parameters

Name Type Since Description
allowNpmInstall boolean - Enable this flag to allow the npm install command. By default, this is disabled, because this command downloads from (potentially) many internet sites, which would make the build very. Therefore, whenever this is needed - which means, when package.json is changed - the developer is supposed to manually run the build with this flag turned on, and ideally deploy the resulting artifact into the maven repository. Then the subsequent builds are free of uncontrolled internet access and thus more reliable and deterministic.
Default value is: false.
User property is: npmpack.allowNpmInstall.
anonymize boolean -

If set, the computed checksum is performed on top of anonymized package.json file; this is useful when working with multiple modules with equal dependencies, as it ensures that they share the same cached artifact.

If unset, only line endings are normalized to LF prior to checksum.

Anonymization is a simple process which replaces properties that identify the module with neutral identification; currently it is string "ANONYMIZED" in properties "name" and "version". Note that the package.json is also sorted (properties by name, recursively) and pretty-printed, so that all insignificant differences are eliminated.

The file node_modules/package.json always c
Default value is: true.
archiveType String - Type of the resulting archive. Can be one of "zip", "tgz", "tar.gz".
Default value is: zip.
basedir File - Current project directory. Used internally to run grunt from the module's directory.
Default value is: ${basedir}.
binaryArtifactId String - The artifactId to use for caching in maven repositories.

Recommended use: do not change


Default value is: node_modules.
binaryGroupId String - The groupId under which to cache the npm artifacts in the repository.

Recommended use: preferably, do not change; but if you have a reason to do so, define once per whole project (or company), inside parent pom's pluginManagement.


Default value is: npmpack.
node_modules File - Pointer to node_modules directory.

Recommended use: do not change if you wish to use npm-based tools from commandline as well. Otherwise it might be practical to change this to "${project.build.directory}/node_modules".


Default value is: node_modules.
npmExecutables String - The executable to run as NPM. By default, we expect that it is available on PATH.
Default value is: npm,npm.cmd.
User property is: npm.executable.
npmInstallNotAllowedMsg String - (no description)
Default value is: To generate new npmpack, please add option '-Dnpmpack.allowNpmInstall' to your commandline. Remember to upload the resulting pom and binary to your nearest maven repository, so that other users do not need to do the same..
User property is: npmpack.allowNpmInstall.
packageJson File - Pointer to package.json file.

Recommended use: do not change


Default value is: package.json.
workdir File - Pointer to the build's working directory.
Default value is: ${project.build.directory}.

Optional Parameters

Name Type Since Description
unzipCommand String -

If specified, npmpack uses this external command to unpack the binary, instead of internal (java-based) implementation. The purpose is to allow for a faster unzip if one is available on the given system.

The command is expected (but not strictly checked to) include two %s placeholders, first for source archive file, second for the target directory. For example:

  • unzip %s -d %s
  • C:/bin/unzip.exe -q %s -d %s

Method String.format() is used to interpolate these placeholders; feel free to use any of its tricks to achieve desired results

Note that paths with spaces in them can cause problems due to escaping.
User property is: npmpack.unzip.

Parameter Details

allowNpmInstall:

Enable this flag to allow the npm install command. By default, this is disabled, because this command downloads from (potentially) many internet sites, which would make the build very. Therefore, whenever this is needed - which means, when package.json is changed - the developer is supposed to manually run the build with this flag turned on, and ideally deploy the resulting artifact into the maven repository. Then the subsequent builds are free of uncontrolled internet access and thus more reliable and deterministic.
  • Type: boolean
  • Required: Yes
  • User Property: npmpack.allowNpmInstall
  • Default: false

anonymize:

If set, the computed checksum is performed on top of anonymized package.json file; this is useful when working with multiple modules with equal dependencies, as it ensures that they share the same cached artifact.

If unset, only line endings are normalized to LF prior to checksum.

Anonymization is a simple process which replaces properties that identify the module with neutral identification; currently it is string "ANONYMIZED" in properties "name" and "version". Note that the package.json is also sorted (properties by name, recursively) and pretty-printed, so that all insignificant differences are eliminated.

The file node_modules/package.json always c
  • Type: boolean
  • Required: Yes
  • Default: true

archiveType:

Type of the resulting archive. Can be one of "zip", "tgz", "tar.gz".
  • Type: java.lang.String
  • Required: Yes
  • Default: zip

basedir:

Current project directory. Used internally to run grunt from the module's directory.
  • Type: java.io.File
  • Required: Yes
  • Default: ${basedir}

binaryArtifactId:

The artifactId to use for caching in maven repositories.

Recommended use: do not change

  • Type: java.lang.String
  • Required: Yes
  • Default: node_modules

binaryGroupId:

The groupId under which to cache the npm artifacts in the repository.

Recommended use: preferably, do not change; but if you have a reason to do so, define once per whole project (or company), inside parent pom's pluginManagement.

  • Type: java.lang.String
  • Required: Yes
  • Default: npmpack

node_modules:

Pointer to node_modules directory.

Recommended use: do not change if you wish to use npm-based tools from commandline as well. Otherwise it might be practical to change this to "${project.build.directory}/node_modules".

  • Type: java.io.File
  • Required: Yes
  • Default: node_modules

npmExecutables:

The executable to run as NPM. By default, we expect that it is available on PATH.
  • Type: java.lang.String
  • Required: Yes
  • User Property: npm.executable
  • Default: npm,npm.cmd

npmInstallNotAllowedMsg:

(no description)
  • Type: java.lang.String
  • Required: Yes
  • User Property: npmpack.allowNpmInstall
  • Default: To generate new npmpack, please add option '-Dnpmpack.allowNpmInstall' to your commandline. Remember to upload the resulting pom and binary to your nearest maven repository, so that other users do not need to do the same.

packageJson:

Pointer to package.json file.

Recommended use: do not change

  • Type: java.io.File
  • Required: Yes
  • Default: package.json

unzipCommand:

If specified, npmpack uses this external command to unpack the binary, instead of internal (java-based) implementation. The purpose is to allow for a faster unzip if one is available on the given system.

The command is expected (but not strictly checked to) include two %s placeholders, first for source archive file, second for the target directory. For example:

  • unzip %s -d %s
  • C:/bin/unzip.exe -q %s -d %s

Method String.format() is used to interpolate these placeholders; feel free to use any of its tricks to achieve desired results

Note that paths with spaces in them can cause problems due to escaping.
  • Type: java.lang.String
  • Required: No
  • User Property: npmpack.unzip

workdir:

Pointer to the build's working directory.
  • Type: java.io.File
  • Required: Yes
  • Default: ${project.build.directory}