-
Notifications
You must be signed in to change notification settings - Fork 585
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 basic npm support #993
Conversation
I was able to make this work on Windows like this, running tasks in Grunt etc. Target "RestoreLocalPackages" (fun _ ->
RestorePackageId (fun p -> { p with ExcludeVersion = true
ToolPath = "../.nuget/NuGet.exe"
OutputPath = "packages"
Version = Some (new System.Version(4,0,0)) }) "Node.js"
RestorePackageId (fun p -> { p with ExcludeVersion = true
ToolPath = "../.nuget/NuGet.exe"
OutputPath = "packages"
Version = Some (new System.Version(2,13,1)) }) "Npm.js"
)
Target "PreBuild" (fun _ ->
Npm (fun p ->
{ p with
Command = Custom ("install grunt") })
Npm (fun p ->
{ p with
Command = Run ("fakeprebuild") })
Npm (fun p ->
{ p with
Command = Run ("faketest") })
)
Target "NpmInstall" (fun _ ->
Npm (fun p ->
{ p with
Command = Install Standard
WorkingDirectory = "Nrk.Programspiller.Frontend" })) A trick which could probably be documented in a separate page about using Npm with Fake is that to run grunt tasks without installing node.js and grunt etc globally I had to do this: "scripts": {
"faketest": "Frontend\\packages\\Node.js\\node.exe -e \"require('grunt').tasks(['karma:ci', 'zip'], {color: false});\"",
"fakeprebuild": "Frontend\\packages\\Node.js\\node.exe -e \"require('grunt').tasks(['publish'], {color: false});\""
},``` |
please let me know when if this is ready to merge. |
@bjartwolf do you think it is good enough to work? I think so, since it is really hard to know exactly how the users want to use npm. The helper tries to be helpful in that you can override where npm is. I can try to run it using a global installed version of node and npm since that is another use case as well as try it on osx. I'll try to do that later today. |
I've now tried it with global |
very cool! |
I see it is already closed but I agree and thanks, very useful for us! |
This small feature makes it really easy to run
Npm
task for build frontend projects. This also opens up for runninggulp
,grunt
or some other frontend build tool by calling them fromNpm
.To get started on Windows:
Add the following to
build.cmd
:Then you can run task like:
Haven't tried it on *nix yet, but it should work there as well since you can override the path to npm. I have also provided defaults for *nix and Windows.