pantheon-se/node-composer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pantheon-se/node-composer

最新稳定版本:v2.1.6

Composer 安装命令:

composer require pantheon-se/node-composer

包简介

Installs Node.js, NPM, and Yarn into vendor/bin

README 文档

README

License Packagist Version Tests

Node Composer

Composer Plugin to implement asset compilation via Composer with Node.js.

Based on node-composer by mariusbuescher, this Composer plugin will install Node.js, NPM, and/or Yarn into your vendor/bin directory so that they are available to use during your Composer builds. This plugin helps automate the download of the binaries which are linked to the bin-directory specified in your composer.json.

Once installed, you can then use Node, NPM, and Yarn commands in your composer-scripts.

Setup

Simply install the plugin, and the latest Node.js LTS with NPM will be installed - no other configurations are necessary. Optionally, you can specify the node-version in your composer.json extra configs to declare a specific version of Node.js. For Yarn, yarn-version can either be set to true to install the latest, or can be set to a specific version.

Example composer.json with Yarn

{
  "name": "my/project",
  "type": "project",
  "license": "MIT",
  "require": {
    "pantheon-se/node-composer": "*"
  },
  "extra": {
    "pantheon-se": {
      "node-composer": {
        "yarn-version": true
      }
    }
  },
  "config": {
    "allow-plugins": {
      "pantheon-se/node-composer": true
    }
  },
  "scripts": {
    "post-install-cmd": ["@build"],
    "post-update-cmd": ["@build"],
    "build": "cd web/themes/my_theme && yarn build"
  }
}

Configuration

There are three parameters you can configure:

  • Node version (node-version)
  • Yarn version (yarn-version)
  • The download url template for the Node.js binary archives (node-download-url).

In the Node download url, replace the following placeholders with your specific needs:

  • version: ${version}
  • type of your os: ${osType}
  • system architecture: ${architecture}
  • file format ${format}

Example composer.json with specific versions of Node and Yarn

{
  "extra": {
    "pantheon-se": {
      "node-composer": {
        "node-version": "16.14.0",
        "yarn-version": "1.22.18",
        "node-download-url": "https://nodejs.org/dist/v${version}/node-v${version}-${osType}-${architecture}.${format}"
      }
    }
  }
}

统计信息

  • 总下载量: 7.97k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 9
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-05-15