Coder Social home page Coder Social logo

node-composer's Introduction

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}"
      }
    }
  }
}

node-composer's People

Contributors

kyletaylored avatar mariusbuescher avatar mekdrop avatar

Stargazers

Cory Birdsong avatar Rachel avatar YSE Web DevOps avatar Dustin LeBlanc avatar JWB avatar

Watchers

Joe Stewart avatar Chris Charlton avatar Mike Monan avatar Danny Pfeiffer avatar Mariano Crivello avatar Aaron Onken avatar James Rutherford avatar  avatar Kit Wong avatar

node-composer's Issues

Unable to extract download.

I'm currently running into an error and not sure how to debug it further. I am unable to extract the download. While running composer install I get this error:

An error occurred while extracting NodeJS (/Users/peteinge/Sites/panth-github-actions/vendor/node-v14.19.0-darwin-x64.tar.gz) to /Users/peteinge/Sites/panth-github-actions/vendor/node-v14.19.0-darwin-x64. Error: tar: Error opening archive: Failed to open ' /Users/peteinge/Sites/panth-github-actions/vendor/node-v14.19.0-darwin-x64.tar.gz -C '/Users/peteinge/Sites/panth-github-actions/vendor/node-v14.19.0-darwin-x64' --strip 1'

The download looks to be successful. Running the tar command directly in the command line after seems to always work.

At first, I thought it was just a permissions issue while running in composer, so just messing around I changed the file permissions after download to 0777. And still get the error.

I am trying to use the 2.x-dev version on a new Drupal site from Pantheon. Currently Drupal 9.4.2. And Composer 2.3.7 and running on a Mac, 10.15.7. Any thoughts or if you need any more info, please let me know.

I've been playing around with Github Actions and deploying to pantheon with Integrated composer. We use Gulp to process our css and js. We've been using CircleCi for a few years now and trying to figure out new options with Pantheon's Integrated Composer.

Thanks in advance for any help.

Can we extend the untar process timeout for the node package?

My team and I are using node-composer with Docker Desktop and Lando, but some of us have experienced timeout issues locally when untaring the node package. I see that the PantheonSalesEngineering\NodeComposer\Installer::untar() method instantiates a Symfony Process, which has a default timeout of 60 seconds. Could we consider overriding this default by bumping it up a little to say, 200 seconds?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.