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

Add npm dependencies? #3436

Open
alfonsogarciacaro opened this issue Nov 22, 2018 · 11 comments
Open

Add npm dependencies? #3436

alfonsogarciacaro opened this issue Nov 22, 2018 · 11 comments

Comments

@alfonsogarciacaro
Copy link

Continuing discussion from fable-compiler/Fable#1649 (comment)

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?
@alfonsogarciacaro
Copy link
Author

alfonsogarciacaro commented Nov 22, 2018

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

@forki
Copy link
Member

forki commented Nov 22, 2018

/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.

@nojaf
Copy link

nojaf commented Nov 22, 2018

@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

@MangelMaxime
Copy link

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.

@inosik
Copy link
Contributor

inosik commented Nov 22, 2018

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? 😄

@MangelMaxime
Copy link

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.

@theimowski
Copy link
Member

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

@forki
Copy link
Member

forki commented Nov 23, 2018 via email

@theimowski
Copy link
Member

Right sorry I misunderstood the original intent

@forki
Copy link
Member

forki commented Nov 23, 2018

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

@ericnewton76
Copy link

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.

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

No branches or pull requests

7 participants