Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support requiring specific versions of an npm package #212

Closed
dylburger opened this issue Oct 23, 2019 · 7 comments
Closed

Support requiring specific versions of an npm package #212

dylburger opened this issue Oct 23, 2019 · 7 comments
Labels
enhancement New feature or request

Comments

@dylburger
Copy link
Contributor

Currenty, I can require() an npm package within a code step, but I cannot specify the version of the package I'd like to use. I'd like support for this.

@dylburger
Copy link
Contributor Author

I've encountered specific cases with Google npm packages that had instructed me to require a specific version of the package. Using the most recent version (no version specified) fails to work.

@dylburger dylburger transferred this issue from PipedreamHQ/roadmap Jun 19, 2020
@dylburger dylburger added the enhancement New feature or request label Jun 19, 2020
@togakangaroo
Copy link

To fill in a use case, I’m drawing a utility function deep out of exceljs but am not sure at all that it’s part of their official “public interface” so I'd like to be able to pin the version

@dparnold
Copy link

dparnold commented Mar 5, 2021

This is really an important issue. If I we have many workflows running for our clients, we cannot afford having npm package updates breaking our code.
The change to a newer version has to be tested properly.
At the moment it comes as a possibly negative surprise.

I hope you can soon add this basic functionality of node via something like a package.json.

@huzaifahj
Copy link

Any update on this?

@dylburger
Copy link
Contributor Author

@huzaifahj not yet, but this is still on our radar. I know it's not ideal by any means, but I've published specific versions of npm packages to my own npm account / namespace using this technique.

Essentially, I'll clone the relevant repo for the project, check out the specific tag / commit I want to use in my workflow, then publish that code to my own namespace, allowing me to require the specific version of that package in my workflow:

const package = require("@your-username/your-package");

We'll provide more updates on this ticket on a native solution, we as we develop it!

@anton-isaykin
Copy link

Hi team,

Unfortunately, this issue is the dealbreaker with Pipedream for us also. We can not rely on workflows that can stop working any day.

@dylburger
Copy link
Contributor Author

We just shipped a way to pin package versions in Node.js code steps! See https://pipedream.com/docs/code/nodejs/#pinning-package-versions for more details (reproducing below), and let us know if you have any questions / feedback on the implementation.

We're still considering exposing the existing version of dependencies in a more clear way, so let us know if there are other related features you'd like to see.


Each time you deploy a workflow with Node.js code, Pipedream downloads the npm packages you import in your step. By default, Pipedream deploys the latest version of the npm package each time you deploy a change.

There are many cases where you may want to specify the version of the packages you're using. If you'd like to use a specific version of a package in a workflow, you can add that version in the import string, for example:

import axios from "axios@0.19.2"

You can also pass the version specifiers used by npm to support semantic version upgrades. For example, to allow for future patch version upgrades:

import axios from "axios@~0.20.0"

To allow for patch and minor version upgrades, use:

import got from "got@^11.0.0"

Note that the behavior of the caret (^) operator is different for 0.x versions, for which it will only match patch versions, and not minor versions.

You can also specify different versions of the same package in different steps. Each step will used the associated version. Note that this also increases the size of your deployment, which can affect cold start times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants