Skip to content

XVincentX/NodeJsMsBuild

Repository files navigation

NodeJsMsBuild

No Maintenance Intended

Alt text

MsBuild tasks for NodeJS tools

Build status: Build status Nuget downloads: Nuget Downloads

CI Nuget feed

This project is a collection of utilities that will inject some targets/files into your Visual Studio project and integrating NodeJs tools.

NOTE: This project is all about plain MsBuild task. No tools will be inserted into your project. They are up to you.

Yes but why?

At first, there are a lot,a lot and a lot of nuget packages claiming NodeJS support. I know that more will come in near future. The same is for Bower, Grunt, Gulp and other tools. I do not know which one to choose, and which one will be updated time after time. Futhermore, a lot of users (like me) have got a global npm installation and want to take advantage of that one. For this reason I prefer to install in your project only the targets with several search options. The rest is up to you.

This project is born after this article.

If you're looking for binaries, point your browser to the nuget package

I want to build on my own

grunt

This will output a nuget package that you may upload on your nuget feed.

Clean generated code

grunt clean //I think it does not work now.

Gimme the bits

Open your Visual Studio copy and search for NodeJsMsBuild package. Once installed, it will

  • Insert into your project a Gruntfile.js and a gulpfile.js. Both of them have got:

    • A shared task
    • A default task
    • A Debug task
    • A Release task

    All of these are empty and all depends from shared.

  • The Install.ps1 script will detect presence of package managers and will remove from project (but not delete from file system) the unnecessary task files. If you have got both of task runners (will you?), both files will be leaved in your project.

  • 3 named targets will be imported into your projects. These are:

    • CleanNodeJsFiles: this task will delete all Javascript filed created by Typescript compilation process (the .js and .js.map). Then it will delete the entire node_modules/ directory and typings folder as well.
    • RestoreNodeJsPackages: This target will run the following commands:
      • npm install
      • tsd reinstall
      • bower install
    • RunJsBuildTasks: This target will run grunt/gulp tasks based on your configuration (Debug/Release).

The process will not fail if the executables will not be found, but a warning message will be emitted.

How do you detect presence of NodeJS modules?

To go into details, it will:

  • Check for commands into your PATH. This will be fine if you install NodeJS, NPM and other modules as global ones.
  • Check for commands into ./bin path of your project. This is the case when you do not want to install packages into your system, but as standalone executables.
  • Check into node_modules bin folder of your project.

You can make this using nuget package manager too. NodeJs, Npm, Bower, Gulp and Grunt are avaiable as nuget packages.

There is no support for tsd at the moment, but I think he will add it soon if you ask him.

  • Check for binaries into node_modules directory. This is the case if you have got Node and NPM installed in your PATH, but all the other tools are installed as local packages.

If you think I mess some scenario, please open an issue

The project logo was kindly assembled by R.Iazzetta

About

MsBuild tasks for NodeJS tools

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published