Paket: Add npm dependencies?

Created on 22 Nov 2018  Â·  11Comments  Â·  Source: fsprojects/Paket

Continuing discussion from https://github.com/fable-compiler/Fable/issues/1649#issuecomment-440917740

There are currently two issues for Fable users and authors. Would it be possible to fix both by adding npm dependencies to Paket?

  • Fable users need to handle two package managers: Paket/Nuget and npm
  • Sometimes Fable lib authors need npm dependencies and they have no way to specify that, so users need to check the docs and remember what they should install.

Note I'm not talking about Fable.React because it's loosely coupled to React (can be used with preact, or in a netcore app), but about other libs where the npm dependency is more transparent to the user (Fulma, Zaid's bindings...).

What would Paket do with npm dependencies?

  • I assume Paket won't take care of the actual installation, just adding the packages to package.json (translating the semver syntax used by Paket to npm's one).
  • Should Paket run npm install automatically after restore/install if it detects npm dependencies?

Most helpful comment

@alfonsogarciacaro I'm like the biggest fan of Paket .NET Core, install via

dotnet tool install --tool-path ".paket" Paket --add-source https://api.nuget.org/v3/index.json

All 11 comments

BTW, is Paket already available as a dotnet tool? If so, what's the name?

/cc @enricosada regarding dotnet tool

I think if we want to run install automatically then we'd need to detect if the user is using npm or yarn.

@alfonsogarciacaro I'm like the biggest fan of Paket .NET Core, install via

dotnet tool install --tool-path ".paket" Paket --add-source https://api.nuget.org/v3/index.json

I think if we want to run install automatically then we'd need to detect if the user is using npm or yarn.

In order to detect the package manager, we can look for yarn.lock or packge-lock.json files.

Also, one question is about will paket discover them ? Because they are not always at the root of the repo for example.

I think that looking at the nearest package.json relative to MyProject.fsproj file should works.

I think before we start to actually install JS dependencies, we should figure out how we should express those dependencies in the first place. Then in the first iteration we can make Paket understand them and print the IDs and versions to the console.

Also remember that Fable doesn't really require Paket now. Devs who use PackageReference dependencies would still need to check the docs of the respective packages or the source code in the worst case.

@nojaf Did you just rewritten the Paket Bootstrapper in one line of shell code? 😄

I think before we start to actually install JS dependencies, we should figure out how we should express those dependencies in the first place.

Sure, I just wanted to point that if we want to make paket support "install" scenario. There can be more than one package.json in a repo.

This would be interesting from SAFE apps POV to be able to maintain JS deps using Paket

@theimowski - I didn't say paket should control js dependencies - that
would be whole different beast

Am Do., 22. Nov. 2018, 13:24 hat Tomasz Heimowski notifications@github.com
geschrieben:

This would be interesting from SAFE apps POV to be able to maintain JS
deps using Paket

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/fsprojects/Paket/issues/3436#issuecomment-441014607,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADgNNNlLVFL1DwxxNiwgIRS35ik-Y4Hks5uxpdqgaJpZM4Yu_4F
.

Right sorry I misunderstood the original intent

AFAIK the reasonml people do that and have something that uses opam and npm. But I think it's waaaay to much work.

Just my 2c:

Paket is not npm, and npm is not paket. I wouldn't expect npm to run paket install if it happened to see a paket.references file locally. That's for the developer and documentation of how to build the project.

If Fable is used to nuget/paket and npm, then it's part of the ecosystem already. Create a build.sh or build.cmd which invokes both if you need to.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pshrosbree picture pshrosbree  Â·  3Comments

alfonsogarciacaro picture alfonsogarciacaro  Â·  8Comments

sarudak picture sarudak  Â·  5Comments

forki picture forki  Â·  5Comments

haraldsteinlechner picture haraldsteinlechner  Â·  4Comments