@groovy.transform.CompileStatic @groovy.util.logging.Slf4j class NpmExtension extends org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension
Set up global config or task-based config for NPM.
| Fields inherited from class | Fields |
|---|---|
class org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension |
__$stMC, __$stMC, __$stMC |
| Type | Name and description |
|---|---|
static java.lang.String |
NAME |
java.io.File |
globalConfig |
java.io.File |
homeDirectory |
java.io.File |
localConfig |
| Constructor and description |
|---|
NpmExtension
(org.gradle.api.Project project)Adds the extension to the project. |
NpmExtension
(org.gradle.api.Project project, NodeJSExtension nodejs)Adds the extension to the project. |
NpmExtension
(org.gradle.api.Task task)Adds the extension to a NpmTask task. |
NpmExtension
(org.gradle.api.Task task, NodeJSExtension nodejs, NpmExtension altNpmExt)Adds the extension to a NpmTask task. |
protected NpmExtension
(org.gradle.api.Task task, java.lang.String projectExtName)Constructs a new extension which is attached to the provided task. |
protected NpmExtension
(org.gradle.api.Task task, java.lang.Class<? super NpmExtension> extClass)Constructs a new extension which is attached to the provided task. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
org.ysb33r.gradle.nodejs.NpmExecSpec |
createExecSpec()Create execution specification. |
|
void |
executableIsBundled()Use the NPM that is bundled with Node. |
|
protected org.ysb33r.grolifant.api.core.downloader.ExecutableDownloader |
getDownloader()Gets the downloader implementation. |
|
java.io.File |
getGlobalConfig()Location & name of global NPM config file. |
|
java.io.File |
getHomeDirectory()The NPM home directory - the parent directory of node_modules, |
|
org.gradle.api.provider.Provider<java.io.File> |
getHomeDirectoryProvider()The NPM home directory - the parent directory of node_modules, |
|
java.io.File |
getLocalConfig()Location & name of local NPM config file. |
|
protected java.lang.String |
getNodeJsExtensionName()Returns the name of the extension to look for when trying to find the Node.js extension. |
|
protected java.lang.String |
getNpmProjectExtensionName()Returns the name of the extension to look for when trying to find the Npm extension. |
|
org.gradle.api.provider.Provider<java.io.File> |
getNpxCliJsProvider()The location of NPX. |
|
org.gradle.api.provider.Provider<java.io.File> |
getProjectConfig()Location of .npmrc for a project. |
|
org.gradle.api.provider.Provider<java.lang.String> |
getVersionProvider()Provides the version as specified in package.json. |
|
void |
globalConfig(java.lang.Object path)Set global config file. |
|
void |
homeDirectory(java.lang.Object homeDir)Sets the home directory. |
|
void |
localConfig(java.lang.Object path)Set local config file. |
|
protected java.lang.String |
runExecutableAndReturnVersion()Runs the executable and returns the version. |
|
void |
setGlobalConfig(java.lang.Object path)Set global config file. |
|
void |
setHomeDirectory(java.lang.Object homeDir)Sets the home directory. |
|
void |
setLocalConfig(java.lang.Object path)Set local config file. |
|
org.gradle.api.provider.Provider<java.io.File> |
useGlobalGradleLocation()Sets it to use the equivalent of getGradleHomeDir()/.npmrc. |
|
org.gradle.api.provider.Provider<java.io.File> |
useGlobalSystemLocation()Tries to determine the location where global config will typically be places. |
|
org.gradle.api.provider.Provider<java.io.File> |
useLocalProjectLocation()Use to indicate that userconfig should be retrieved from the NPM home directory as configured by getHomeDirectory(). |
|
org.gradle.api.provider.Provider<java.io.File> |
useLocalUserProfileLocation()Use to indicate that userconfig should be retrieved from the user's home directory. |
|
void |
usePackageJsonVersionAsProjectVersion()Use the version specified in package.json as the version of the project. |
| Methods inherited from class | Name |
|---|---|
class org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension |
org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#executableByVersion(java.lang.Object), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#this$dist$invoke$3(java.lang.String, java.lang.Object), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#this$dist$set$3(java.lang.String, java.lang.Object), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#this$dist$get$3(java.lang.String), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#executableByPath(java.lang.Object), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#executableBySearchPath(java.lang.Object), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#setWindowsExtensionSearchOrder(java.lang.Iterable), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#setWindowsExtensionSearchOrder([Ljava.lang.String;), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#getWindowsExtensionSearchOrder(), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#resolvedExecutableVersion(), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#this$dist$invoke$2(java.lang.String, java.lang.Object), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#this$dist$set$2(java.lang.String, java.lang.Object), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#this$dist$get$2(java.lang.String), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#getExecutable(), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#getProjectOperations(), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#invokeMethod(java.lang.String, java.lang.Object), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#getMetaClass(), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#setMetaClass(groovy.lang.MetaClass), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#setProperty(java.lang.String, java.lang.Object), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#getProperty(java.lang.String), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#wait(long, int), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#wait(long), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#wait(), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#equals(java.lang.Object), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#toString(), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#hashCode(), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#getClass(), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#notify(), org.ysb33r.grolifant.api.core.runnable.AbstractToolExtension#notifyAll() |
Adds the extension to the project.
project - Project to link to.Adds the extension to the project.
project - Project to link to.nodejs - Alternative NodeJS extension to use.Adds the extension to a NpmTask task.
Links the executable resolving to the global instance, but allows it to be overridden on a per-task basis.
task - Task to be extended.Adds the extension to a NpmTask task.
Links the executable resolving to the global instance, but allows it to be overridden on a per-task basis.
task - Task to be extended.nodejs - Alternative NodeJS extension to use as project extension.altNpmExt - Alternative Npm extension to use as project extension.Constructs a new extension which is attached to the provided task. This is meant for other plugins that want to provide their own NpmExtension implementation
project - Project this extension is associated with.projectExtName - Name of the extension that is attached to the project.Constructs a new extension which is attached to the provided task. This is meant for other plugins that want to provide their own NpmExtension implementation
Task - Task this extension is associated with.extClass - Type of the extension that is attached to the project.Create execution specification.
Use the NPM that is bundled with Node. This is the default and should raely be required.
Gets the downloader implementation. Can throw an exception if downloading is not supported.
Location & name of global NPM config file.
When this extension is attached to a project, the default location is set to
"${project.gradle.gradleUserHomeDir/npmrc"}
The NPM home directory - the parent directory of node_modules,
node_modules. Never null if the extension is tied to a project,
in which case it defaults to project.projectDir. The NPM home directory - the parent directory of node_modules,
node_modules. Never null if the extension is tied to a project,
in which case it defaults to project.projectDir. Location & name of local NPM config file.
When this extension is attached to a project, the default location is set to
"${project.rootProject.projectDir/npmrc"}
Returns the name of the extension to look for when trying to find the Node.js extension.
Returns the name of the extension to look for when trying to find the Npm extension.
The location of NPX.
Location of .npmrc for a project.
Provides the version as specified in package.json.
Set global config file.
path - Anything that can be converted using project.file.Sets the home directory.
homeDir - A directory in which node_modules will be created as a child folder.
Anything that can be resolved with project.file is acceptableSet local config file.
path - Anything that can be converted using project.file.Runs the executable and returns the version. See org.ysb33r.grolifant.internal.core.executable.ExecUtils#parseVersionFromOutput as a helper to implement this method.
Set global config file.
path - Anything that can be converted using project.file.Sets the home directory.
homeDir - A directory in which node_modules will be created as a child folder.
Anything that can be resolved with project.file is acceptableSet local config file.
path - Anything that can be converted using project.file. Sets it to use the equivalent of getGradleHomeDir()/.npmrc.
This allows Gradle projects to be custom configured on local system without being affected by any system-wide
node installations.
Tries to determine the location where global config will typically be places.
Use to indicate that userconfig should be retrieved from the NPM home directory as configured by getHomeDirectory().
.npmrc Use to indicate that userconfig should be retrieved from the user's home directory.
Typically this is ~/.npmrc or %APPDATA\npm\.npmrc
.npmrc Use the version specified in package.json as the version of the project.
If package.json does not exist, then undefined is used as the version.
Groovy Documentation