blacklite / ncapsulate Goto Github PK
View Code? Open in Web Editor NEWNuGet and MSBuild wrappers around various Node based tools.
License: MIT License
NuGet and MSBuild wrappers around various Node based tools.
License: MIT License
Current version ships with older NPM, which doesn't support per-project npmrc files. At least 1.4.21 is needed.
Thanks
I'm working with a project that has a custom location for it's package.json file.
I have tried modifying the path in the node.targets
<NpmJson Include="$(MSBuildProjectDirectory)\package.json" />
to
<NpmJson Include="$(MSBuildProjectDirectory)\MYFOLDER\package.json" />
but the npm install task keeps insisting on running from the project root. Am I misunderstanding something or is this NpmJson item not actually being used in the node.targets file.
Any help here would be very much appreciated
Okay, basic details first: This is on Windows Server 2008 R2, using Visual Studio 2013 Professional Update 2, nuget 2.8.50313.46, and I've cleared my nuget package cache. I have the node toolkit for VS2013 installed, as well as the regular old node x64 installer from nodejs.org (with both node and npm on the system path).
The problem occurs when trying to install the Ncapsulate Gulp and Node packages. If I try installing Gulp directly, without installing Ncapsulate.Node first, the install succeeds but I get four errors in the package manager console:
Unable to index into an object of type System.IO.DirectoryInfo.
At D:\Projects\Launch\ai5\MobileConfig\source\packages\Ncapsulate.Node.0.10.26\tools\commands.psm1:5 char:96
+ $nodePath = (Get-ChildItem "$installPath\..\Ncapsulate.Node.*" | Sort-Object Name -descending)[ <<<< 0].FullName;
+ CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException
+ FullyQualifiedErrorId : CannotIndex
Unable to index into an object of type System.IO.DirectoryInfo.
At D:\Projects\Launch\ai5\MobileConfig\source\packages\Ncapsulate.Gulp.3.6.2.1\tools\commands.psm1:5 char:96
+ $nodePath = (Get-ChildItem "$installPath\..\Ncapsulate.Node.*" | Sort-Object Name -descending)[ <<<< 0].FullName;
+ CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException
+ FullyQualifiedErrorId : CannotIndex
D:\Projects\Launch\ai5\MobileConfig\source\Ai.MobileConfig
..\packages\Ncapsulate.Gulp.3.6.2.1
Unable to index into an object of type System.IO.DirectoryInfo.
At D:\Projects\Launch\ai5\MobileConfig\source\packages\Ncapsulate.Gulp.3.6.2.1\tools\install.ps1:18 char:96
+ $nodePath = (Get-ChildItem "$installPath\..\Ncapsulate.Node.*" | Sort-Object Name -descending)[ <<<< 0].FullName;
+ CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException
+ FullyQualifiedErrorId : CannotIndex
Resolve-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:\Projects\Launch\ai5\MobileConfig\source\packages\Ncapsulate.Gulp.3.6.2.1\tools\install.ps1:20 char:33
+ $nodeRelativePath = Resolve-Path <<<< -Relative $nodePath
+ CategoryInfo : InvalidData: (:) [Resolve-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ResolvePath
Command
If instead I install Ncapsulate.Node via nuget before installing Ncapsulate.Gulp, it installs with one error:
Unable to index into an object of type System.IO.DirectoryInfo.
At D:\Projects\Launch\ai5\MobileConfig\source\packages\Ncapsulate.Node.0.10.26.3\tools\commands.psm1:5 char:96
+ $nodePath = (Get-ChildItem "$installPath\..\Ncapsulate.Node.*" | Sort-Object Name -descending)[ <<<< 0].FullName;
+ CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException
+ FullyQualifiedErrorId : CannotIndex
And then installing Ncapsulate.Gulp still produces four errors:
Unable to index into an object of type System.IO.DirectoryInfo.
At D:\Projects\Launch\ai5\MobileConfig\source\packages\Ncapsulate.Node.0.10.26.3\tools\commands.psm1:5 char:96
+ $nodePath = (Get-ChildItem "$installPath\..\Ncapsulate.Node.*" | Sort-Object Name -descending)[ <<<< 0].FullName;
+ CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException
+ FullyQualifiedErrorId : CannotIndex
Unable to index into an object of type System.IO.DirectoryInfo.
At D:\Projects\Launch\ai5\MobileConfig\source\packages\Ncapsulate.Gulp.3.6.2.1\tools\commands.psm1:5 char:96
+ $nodePath = (Get-ChildItem "$installPath\..\Ncapsulate.Node.*" | Sort-Object Name -descending)[ <<<< 0].FullName;
+ CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException
+ FullyQualifiedErrorId : CannotIndex
D:\Projects\Launch\ai5\MobileConfig\source\Ai.MobileConfig
..\packages\Ncapsulate.Gulp.3.6.2.1
Unable to index into an object of type System.IO.DirectoryInfo.
At D:\Projects\Launch\ai5\MobileConfig\source\packages\Ncapsulate.Gulp.3.6.2.1\tools\install.ps1:18 char:96
+ $nodePath = (Get-ChildItem "$installPath\..\Ncapsulate.Node.*" | Sort-Object Name -descending)[ <<<< 0].FullName;
+ CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException
+ FullyQualifiedErrorId : CannotIndex
Resolve-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:\Projects\Launch\ai5\MobileConfig\source\packages\Ncapsulate.Gulp.3.6.2.1\tools\install.ps1:20 char:33
+ $nodeRelativePath = Resolve-Path <<<< -Relative $nodePath
+ CategoryInfo : InvalidData: (:) [Resolve-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ResolvePath
Command
And finally, the results of all of this. Basically, the node package seems to work fine (at least, npm install
is being called, as I can see the task output in the output panel), but the gulp task runner does not - I neither see output nor do the files the task should generate ever appear in the destination folder.
Just in case, here's my gulp.targets file:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Gulp-AfterBuild" AfterTargets="AfterBuild">
<Gulp Tasks="build" />
</Target>
</Project>
And my node.targets file is absolutely stock:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Support for Incremental builds -->
<!-- When package.json is changed, we'll install and update, then update lastrun -->
<ItemGroup>
<NpmJson Include="$(MSBuildProjectDirectory)\package.json" />
<NpmLastRun Include="$(MSBuildProjectDirectory)\node_modules\npm.lastrun" />
</ItemGroup>
<Target Name="Npm" BeforeTargets="BeforeBuild" Inputs="@(NpmJson)" Outputs="@(NpmLastRun)">
<NpmInstall />
<NpmUpdate />
<Delete Files="$(MSBuildProjectDirectory)\node_modules\npm.lastrun" />
<WriteLinesToFile File="$(MSBuildProjectDirectory)\node_modules\npm.lastrun" Lines="" />
</Target>
<Target Name="NpmClean" BeforeTargets="BeforeClean">
<Delete Files="$(MSBuildProjectDirectory)\node_modules\npm.lastrun" />
</Target>
</Project>
Honestly, this package is AWESOME, and I really want to use it to its full potential, but right now I have no idea what's going wrong or how to go about fixing it.
Should we also then introduce a Ncapsulate organization?
This is such a great and useful project! Thank you for making it available to all of us!
I am having a heck of a time consistently recreating this issue, so am posting anyway hoping you might be able to give guidance on how I further can help in getting this resolved as it is preventing me from using the MSBuild steps.
I am getting errors such as the following:
C:\TeamCity\buildAgent\work\691a13f7ed503d0\src\Nile.Billing.Web.Static\App_Build\bower.targets(10, 5): error MSB4062: The "Ncapsulate.Bower.Tasks.BowerInstall" task could not be loaded from the assembly C:\TeamCity\buildAgent\work\691a13f7ed503d0\lib\packages\Ncapsulate.Bower.1.3.3.2\build..\lib\net45\Ncapsulate.Bower.dll. Could not load type 'Ncapsulate.Node.Tasks.NcapsulateTask' from assembly 'Ncapsulate.Node, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
I have confirmed the file exists. I am using the stock *.targets
added by the NuGet package. The above error is from the build server when I have never had it work; but I have had it both succeed and fail locally without making any changes on my part.
The best work around I have locally is to close Visual Studio and it often times works when I re-open it.
Yesterday it was consistently working when I hit 'Build', unless it was after I did a 'Clean' in which case it would give the failure and succeed on the second build. 'Rebuild' would consistently fail. Today I have seen it consistently succeed, then I re-open Visual Studio and it consistently fails; and other such oddities.
I have Visual Studio 2013.3 locally on Windows 8.1. I have Visual Studio 2013 (Update 0, I believe) on Server 2012 for the build machine.
After installing Ncapsulate.Grunt, nothing in App_Build/grunt.targets seems to work.
From the command line, running grunt clean successfully runs the clean task through grunt.cmd, however the following target does not run the clean task after running clean through Visual Studio.
<Target Name="Grunt-AfterClean" AfterTargets="AfterClean">
<Grunt Tasks="clean" />
</Target>
This is one example - none of my targets appear to work.
I wonder how to see the feedback in Visual Studio that I would normally see if running gulp on the CLI.
After installing Ncapsulate.Grunt from Nuget, which installed Ncapsulate.Grunt 0.4.4.3 & Ncapsulate.Node 0.10.26, the grunt.cmd file references /nodejs/node, which does not exist.
I fixed this locally by altering grunt.cmd to:
@echo off
node .\packages\Ncapsulate.Grunt.0.4.4.3\nodejs\node_modules\grunt-cli\bin\grunt --no-color %*
@echo on
Hi,
is it possible to configure corporate proxies like one does for npm locally:
npm config set proxy http://[proxy]
greets,
Koray.
When specifying karma with a configuration file it is not starting in single run mode.
karma.cmd start karma.conf.js --single-run => Starts and does a single run
karma.cmd start --single-run karma.conf.js => Starts normally (not single run)
For direct usage of the cmd file this is not a problem (except being aware of it), but using the build target fails if you are giving it a ConfigFile option. Therefore the whole build hangs without any error message (and the tests are not run).
Pretty please? :)
https://www.nuget.org/packages/TypeScript.MSBuild.CI/
If you tell me where the source code is and what needs be updated, I can probably send you a PR
Everything works fine locally but after checkin using Ncapsulate.Node and Ncapsulate.Gulp along with the .target files and .cmd files. I continually get this in the TFS build log.
**Gulp-AfterBuild:
[23:30:00] Local gulp not found in D:\Builds\34_111\src\Web\CaseManagement.Web**
I tried to add in the node.targets and nothing happens.
I'm kinda flying blind on this because this is the only related information I receive in the TFS log. Can you provide any tips or things to try? I'm out of ideas. Great work BTW...I have several other teams that can benifit from Ncapsulate. My current goal is to compile .less files using gulp, and then other tasks will follow.
There's an extra "the" in https://github.com/Blacklite/Ncapsulate#targets
these allow you to change the your projects build
There's an extra apostrophe in https://github.com/Blacklite/Ncapsulate#getversion
where it says
Get's the version of the given npm dependency.
Extra "build" in https://github.com/Blacklite/Ncapsulate#gulp
as part of your build build process.
(this is about node, but I guess the same problem exists for gulp, karma etc)
If you use this package with the package restore workflow (Enable NuGet Package Restore) the Ncapsulate.Node.targets is not there when the solution is first opened and the node_module won't be created.
To reproduce, use your NCapsulate.Example and "Enable Nuget Package Restore" on the solution. Then make sure packages folder as well as node_module folder are deleted. Then compile... First build, nothing is happen. To "fix" it you can reopen VS and compileagain or change any file to "force" a new compile, then it'll work (because earlier compiles have downloaded packages).
Windows 10, Visual Studio 2015
I created a brand new Web/MVC project and installed Ncapsulate.Gulp via Nuget Package Manger. I can uninstall Ncapsulate.Gulp but that leaves Ncapsulate.Node. Trying to uninstall that gives me two warnings:
Answering yes or no in any order results in the same error, and Ncapsulate.Node remains in the project:
Could not find the file 'C:\Users\documents\visual studio 2015\Projects\node\node\node.cmd'.
I also tried forcing the uninstall in Nuget Package Manager Console but had the same result
Uninstall-Package -Force -Version 0.10.26
It's not really an issue of this library. But mabe helpful for other people.
I've got an exception when try to install Ncapsulate package with error, that System.IO.Compression is not available.
This was a bug of old Microsoft.Bcl.Build package, and after updating I were able to install Ncapsulate without any issue.
I had problems with Ncapsulate.Bower not installing the bower packages listed on bower.json. Later I figured out that it was because my bower.json file had something wrong and it was throwing an "Unexpected token" error and the output console on Visual Studio did not displayed the error.
Hi,
I would like to have the node_modules installed in one of the subfolder (where the package.json file is). I know that it's quite unusual, but is there a way to do that ?
Anyway, thanks for this useful tool!
Hey, I'm not seeing the karma target failing when 1+ of my tests fail. I looked at the Karma.cs code and noticed you're checking for ERROR, however my karma is outputting:
1> �[1A�[2KPhantomJS 1.9.7 (Windows 8) Controller: MainCtrl should return the correct CAS login url FAILED
...
1> �[1A�[2KPhantomJS 1.9.7 (Windows 8): Executed 3 of 3 (1 FAILED) (0.022 secs / 0.021 secs)
As you can see no ERROR there. Should I configure Karma a certain way to make Ncapsulate.karma work? what do you suggest?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.