Mad's original NPM Task Runner now supports Yarn, so choose NPM Task Runner for a better experience
Mad's NPM Task Runner forked and changed to use Yarn instead.
Download the extension at the VS Gallery
Adds support for yarn scripts defined in package.json directly in Visual Studio's Task Runner Explorer.
- Task Runner Explorer seems to not allow more than one extension to target the same file (in this case the
package.jsonfile). As such, It won't load if NPM Task Runner is installed - There's a limitation in one of Yarn's files (at 0.15.1) -
base-reporter.js- that attempts to access stdin under IISNODE, which is inexistent. To work around this, you currently need to edit the installedbase-reporter.jsfile at%appData%\npm\node_modules\yarn\lib\reporters\base-reporte.js. At that file, around line 55 change:
this.stdout = opts.stdout || process.stdout;
this.stderr = opts.stderr || process.stderr;
this.stdin = opts.stdin || process.stdin;
this.emoji = !!opts.emoji;
to
this.stdout = opts.stdout || process.stdout;
this.stderr = opts.stderr || process.stderr;
//HACK!!!!
if(process.platform !== 'win32' && !process.env.IISNODE_VERSION)
this.stdin = opts.stdin || process.stdin;
this.emoji = !!opts.emoji;
this situation has been reported to the yarn team and is a pull-request on their repo at yarnpkg/yarn#1000
Inside package.json it is possible to add custom scripts inside the "scripts" element.
{
"name": "test",
"version": "1.0.0",
"scripts": {
"watch-test": "mocha --watch --reporter spec test",
"build-js": "browserify -t reactify app/js/main.js | uglifyjs -mc > static/bundle.js"
}
}Open Task Runner Explorer by right-clicking the package.json
file and select Task Runner Explorer from the context menu:
When scripts are specified, the Task Runner Explorer will show those scripts.
Each script can be executed by double-clicking the task.
A button for turning verbose output on and off is located at the left toolbar.
The button is a toggle button that can be left on or off for as long as needed.
Script bindings make it possible to associate individual scripts with Visual Studio events such as "After build" etc.
If you manually edit bindings in package.json, then full Intellisense is provided.





