The YAML schema for NpmBuild native step is as follows:
An alphanumeric string (underscores are permitted) that identifies the step.
NpmBuild for this step type.
Description of usage
|Specifies an Artifactory Integration where modules will be published. If a FileSpec resource is specified in ||May be required|
Must specify a GitRepo resource. The
May also optionally specify a FileSpec resource that specifies what files to copy to
In addition, these tags can be defined to support the step's native operation:
All native steps derive from the Bash step. This means that all steps share the same base set of tags from Bash, while native steps have their own additional tags as well that support the step's particular function. So it's important to be familiar with the Bash step definition, since it's the core of the definition of all other steps.
Description of usage
|Specifies a command line string of arguments to use with npm-install.||Optional|
|The name of the npm repository in Artifactory.||Optional|
|Alternative to ||Optional|
|The directory containing the ||Optional|
Declares collections of shell command sequences to perform for pre- and post-execution phases:
|Tag||Description of usage||Required/Optional|
|Commands to execute in advance of the native operation||Optional|
|Commands to execute on successful completion||Optional|
|Commands to execute on failed completion||Optional|
|Commands to execute on any completion||Optional|
The actions performed for the
onExecute phase are inherent to this step type and may not be overridden.
The following examples show how to configure an NpmBuild step.
Using Default Settings
An NpmBuild step using default locations and default commands.
- This example requires a GitHub Integration.
- The Pipelines DSL for this example is available in this repository in the JFrog GitHub account.
- For more information about running this example, see Pipeline Example: Npm Build.
Using FileSpec Input
An NpmBuild step with a FileSpec input providing files for the build that are not in the GitRepo and resolverRepo specifying an Artifactory repository to use when resolving dependencies.
How it Works
When you use the NpmBuild native step in a pipeline, it performs the following functions in the background:
- jfrog rt config (if there is a FileSpec input, to configure the JFrog CLI with the Artifactory credentials in the input FileSpec)
- jfrog rt use (to set the current default Artifactory configuration )
- cp (if there is an input FileSpec, copy the files to the root of the cloned GitRepo)
- jfrog rt npm-config (configure the repository to resolve dependencies)
- jfrog rt npm-install
- add_run_variables (save information about this step for future steps)
- jfrog rt build-collect-env (collect environment variables)
- add_run_files (save the output and the build information in the run state for later publish steps)