Skip to main content

ihub-node

Henry...Less than 1 minute

ihub-node

plugin information

ihub-nodeplugin is a stand-alone plugin based on com.github.node-gradle.nodeopen in new window plugin supports building node.js projects, and extension supportcnpm

Plugin IdPlugin NamePlugin TypeExtension NamePlugin dependencies
pub.ihub.plugin.ihub-nodeGitHooks PluginProject[^Project]iHubNodecom.github.node-gradle.nodeopen in new window

Extended Properties

ExtensionDescriptionDefaultExt[^Ext]Prj[^Prj]Sys[^Sys]Env[^Env]
versionNode.js Versionlatest
npmVersionnpm version. If not specified, use Node.js bound versionlatest
pnpmVersionpnpm version, latest version if not specifiedlatest
yarnVersionpnpm version, latest version if not specifiedlatest
cnpmVersionpnpm version, latest version if not specifiedlatest
distBaseUrlNode.js Download Address
allowInsecureProtocolWhether unsafe protocols are allowedfalse
downloadWhether to download and install specific Node.js versionsfalse
workDirNode.js Installation Directory
npmWorkDirNPM installation directory
pnpmWorkDirNPM installation directory
yarnWorkDirYarn Installation Directory
cnpmWorkDircNpm installation directory

Plugin Installation

Kotlin
plugins {
    id("pub.ihub.plugin.ihub-node")
}

Example plugin configuration usage

Kotlin
iHubNode {
    version.set("18.16.0")
}

Plugin Extension Task

cnpm

Task Extension Configuration

Kotlin
import pub.ihub.plugin.node.cnpm.task.CnpmTask

tasks.create("cnpm_run_dev", CnpmTask::class) {
    args.set(listOf("run", "dev"))
}

Task command

cnpm run dev

cnpmSetup

Task command

npm install --global --no-save --prefix cnpm --registry=https://registry.npm.taobao.org

cnpmInstall

Task command

cnpm install

cnpmSync

Task command

cnpm sync cnpmcore