Utility methods that aids in running NPM
Modifiers | Name | Description |
---|---|---|
static java.lang.String |
NPM_INSTALL |
Constructor and description |
---|
NpmExecutor
(org.ysb33r.grolifant.api.core.ProjectOperations projectOperations, NodeJSExtension nodeJS, NpmExtension npm) @param projectOperations Operations for the specific project context |
Type Params | Return Type | Name and description |
---|---|---|
|
org.gradle.api.file.FileTree |
calculateInstallableFiles(java.io.File rootPackageJson) Returns a live set of installable files. |
|
static org.gradle.api.file.FileTree |
calculateInstallableFiles(org.gradle.api.Project project, NpmExtension npmExtension, java.io.File rootPackageJson) Returns a live set of installable files. |
|
NpmExecSpec |
configureSpecFromExtensions(NpmExecSpec execSpec) Configures an NpmExecSpec from a NodeJSExtensions and a NpmExtension. |
|
static NpmExecSpec |
configureSpecFromExtensions(NpmExecSpec execSpec, NodeJSExtension nodeJS, NpmExtension npm) Configures an NpmExecSpec from a NodeJSExtensions and a NpmExtension. |
|
static java.util.Map<java.lang.String, java.lang.Object> |
environmentFromExtensions(NodeJSExtension nodeJS, NpmExtension npm) Creates an environment based up on extensions. |
|
java.io.File |
getPackageInstallationFolder(NpmPackageDescriptor npmPackageDescriptor) Works out where the installation folder will be for a executable. |
|
static java.io.File |
getPackageInstallationFolder(org.gradle.api.Project project, NodeJSExtension nodeJSExtension, NpmExtension npmExtension, NpmPackageDescriptor npmPackageDescriptor) Works out where the installation folder will be for a executable. |
|
java.io.File |
initPkgJson(java.lang.String projectName, org.gradle.api.provider.Provider<java.lang.String> projectVersion) Creates a template package.json file. |
|
static java.io.File |
initPkgJson(java.lang.String projectName, java.lang.String projectVersion, org.gradle.api.Project project, NodeJSExtension nodeJSExtension, NpmExtension npmExtension) Creates a template package.json file. |
|
static java.io.File |
initPkgJson(org.gradle.api.Project project, NodeJSExtension nodeJSExtension, NpmExtension npmExtension) Creates a template package.json file. |
|
org.gradle.api.file.FileTree |
installNpmPackage(NpmPackageDescriptor npmPackageDescriptor, NpmDependencyGroup installGroup, java.lang.Iterable<java.lang.String> additionalArgs, java.util.Map<java.lang.String, java.lang.Object> additionalEnvironment = [:]
) Installs an NPM executable by running npmExt install in a controlled environment. |
|
static org.gradle.api.file.FileTree |
installNpmPackage(org.gradle.api.Project project, NodeJSExtension nodeJSExtension, NpmExtension npmExtension, NpmPackageDescriptor npmPackageDescriptor, NpmDependencyGroup installGroup, java.lang.Iterable<java.lang.String> additionalArgs, java.util.Map<java.lang.String, java.lang.Object> additionalEnvironment = [:]
) Installs an NPM executable by running npmExt install in a controlled environment. |
|
static org.gradle.api.file.FileTree |
installNpmPackage(org.gradle.api.Project project, NpmPackageDescriptor npmPackageDescriptor, NpmDependencyGroup installGroup, java.lang.Iterable<java.lang.String> additionalArgs) Installs an NPM executable by running npmExt install i a controlled environment. |
|
org.gradle.api.file.FileTree |
installPackagesFromDescription(java.io.File packageJson, java.lang.Iterable<java.lang.String> additionalArgs, boolean productionOnly = false
) Installs packages from a package.json description. |
|
static org.gradle.api.file.FileTree |
installPackagesFromDescription(org.gradle.api.Project project, NodeJSExtension nodeJSExtension, NpmExtension npmExtension, java.io.File packageJson, java.lang.Iterable<java.lang.String> additionalArgs, boolean productionOnly = false
) Installs packages from a package.json description. |
|
static org.gradle.api.file.FileTree |
installPackagesFromDescription(org.gradle.api.Project project, java.io.File packageJson, java.lang.Iterable<java.lang.String> additionalArgs) Installs packages from a package.json description. |
|
org.gradle.process.ExecResult |
runNpm(NpmExecSpec execSpec) Runs NPM given a fully-configured execution specification. |
|
static org.gradle.process.ExecResult |
runNpm(org.gradle.api.Project project, NpmExecSpec execSpec) Runs NPM given a fully-configured execution specification. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
projectOperations
- Operations for the specific project contextnodeJS
- NodeJSExtension to use for resolving node
location.npm
- NpmExtension to use for resolving NPM-related activities.Returns a live set of installable files.
This is an approximation. It parses the package.json
file to discover dependencies, then
recursively parses all other package.json
files it find in those dependencies.
rootPackageJson
- Initial package.json file to start traversal.packageJson
does not exist or is not in the
npmExtension.homeDirectoryProperty
.Returns a live set of installable files.
This is an approximation. It parses the package.json
file to discover dependencies, then
recursively parses all other package.json
files it find in those dependencies.
project
- Gradle project this installation is associated withnpmExtension
- Extension that defines the NPM context.rootPackageJson
- Initial package.json file to start traversal.packageJson
does not exist or is not in the
npmExtension.homeDirectoryProperty
.Configures an NpmExecSpec from a NodeJSExtensions and a NpmExtension.
Will set npm_config_userconfig
and npm_config_globalconfig
environmental variables. The working directoryis set it to the homeDirectoryProperty
as defined by the NpmExtension.
execSpec
- NPM execution spec that needs configuration.Configures an NpmExecSpec from a NodeJSExtensions and a NpmExtension.
Will set npm_config_userconfig
and npm_config_globalconfig
environmental variables. The working directoryis set it to the homeDirectoryProperty
as defined by the NpmExtension.
execSpec
- NPM execution spec that needs configuration.nodeJS
- NodeJSExtensionnpm
- NpmExtension.Creates an environment based up on extensions.
nodeJS
- NodeJSExtension.npm
- NpmExtension.Works out where the installation folder will be for a executable.
npmPackageDescriptor
- Description of NPM executableWorks out where the installation folder will be for a executable.
project
- Gradle org.gradle.api.Project that this installation is associated with.nodeJSExtension
- A NodeJS project or task extensionnpmExtension
- A NPM project or task extensionnpmPackageDescriptor
- Description of NPM executable Creates a template package.json
file.
projectName
- Name of the project.projectVersion
- Version/tag of the project. Creates a template package.json
file.
projectName
- Name of the project.projectVersion
- Version/tag of the project.project
- Project for which the {@package.json} file needs to be created.nodeJSExtension
- Configured {@Link NodeJSExtension}.npmExtension
- Configured NpmExtension Creates a template package.json
file.
project
- Project for which the {@package.json} file needs to be created.nodeJSExtension
- Configured {@Link NodeJSExtension}.npmExtension
- Configured NpmExtension Installs an NPM executable by running npmExt install
in a controlled environment.
npmPackageDescriptor
- Description of NPM executable.installGroup
- Production, development of optional installation.additionalArgs
- Any additional arguments that might be deemed necessary to customise the installation.
This is here to provide flexibility as the author cannot foresee all common use cases.
Should rarely be used. Should you find using this method regular occurance it might be prudent to
to raise an issue to ask to a feature update and explaining the context in which this is needed.additionalEnvironment
- Additional environmental settings when installing. This can be used to set the
system path variable if need be. Installs an NPM executable by running npmExt install
in a controlled environment.
project
- Gradle org.gradle.api.Project that this installation is associated with.nodeJSExtension
- A NodeJS project or task extension.npmExtension
- A NPM project or task extension.npmPackageDescriptor
- Description of NPM executable.installGroup
- Production, development of optional installation.additionalArgs
- Any additional arguments that might be deemed necessary to customise the installation.
This is here to provide flexibility as the auithro cannot foresee all common use cases.
Should rarely be used. Should you find using this method regular occurance it might be prudent to
to raise an issue to ask to a feature update and explaining the context in which this is needed.additionalEnvironment
- Additional environmental settings when installing. This can be used to set the
system path variable if need be. Installs an NPM executable by running npmExt install
i a controlled environment.
This uses the global nodejs
and npmExt
project extension to find defaults.
project
- Gradle org.gradle.api.Project that this installation is associated with.npmPackageDescriptor
- Description of NPM executableinstallGroup
- Production, development of optional installation.additionalArgs
- Any additional arguments that might be deemed necessary to customise the installation.
This is here to provide flexibility as the author cannot foresee all common use cases.
Should rarely be used. Should you find using this method regular occurance it might be prudent to
to raise an issue to ask to a feature update and explaining the context in which this is needed. Installs packages from a package.json
description.
packageJson
- Path to a package.json
file.additionalArgs
- Additional arguments to be passed to NPM install command.productionOnly
- Only install the production packages.packageJson
does not exist or is not in the
npmExtension.homeDirectoryProperty
. Installs packages from a package.json
description.
project
- Project the installation is associated with.nodeJSExtension
- A NodeJS project or task extension.npmExtension
- A NPM project or task extension.packageJson
- Path to a package.json
file.additionalArgs
- Additional arguments to be passed to NPM install command.productionOnly
- Only install the production packages.packageJson
does not exist or is not in the
npmExtension.homeDirectoryProperty
. Installs packages from a package.json
description.
project
- Project the installation is associated with.packageJson
- Path to a package.json
file.additionalArgs
- Additional arguments to be passed to NPM install command.packageJson
does not exist or is not in the
project.npmExt.homeDirectoryProperty
.Runs NPM given a fully-configured execution specification.
execSpec
- Specification to executeRuns NPM given a fully-configured execution specification.
project
- The project in which context this execution will be performed.