I'm working on a set of VSTS extensions. Each extension is its own little Node project with its own package.json
and its own node_modules
folder. The folder structure is as follows:
- MyExtension
- package.json // containing all dev-dependencies
- tslint.json
- Tasks
- tsconfig.json
- Common
- common.ts // containing functioanlity shared across tasks
- package.json // containing all runtime dependencies for all projects
- My1stTask
- package.json // containing all prod-dependencies
- task.ts // containing task implementation
- ...
- ...
- My6thTask
- package.json // containing all prod-dependencies
- task.ts // containing task implementation
The way VSTS build tasks work, is that they should be fully self-contained. I've fixed this so far by copying the contents of the Common
project into each task and then run tsc
to convert them all to JavaScript.
This isn't bad but requires constant copying of the contents of Common to get anything tested.
I tried using local file references, added a dependency in each task's package.json to file:../common
, which works at development time, but this doesn't result in the common module being part of the task after generating the extension.
My background isn't in Node develpment, but in C#. I've searched all over and haven't found a solution that works well with vsts-extensions.
npm pack
doesn't seem to work, as the extension expects all files to be there.package.json/bundleDependencies
looks promising but doesn't bundle the local file reference.///<reference path="../common/common.ts"/>
works lovely for editing but still can't run after building the extension.- project reference with prepend doesn't work, build tasks require the commonjs module resolver. System and AMD aren't able to load the modules. Prepend only works with the latter.
Is there a way I can make this work "seamlessly" without having to take on bower or grunt and simply get each MyXthTask to have a copy of the local common module in their node_modules
folder?
extends
typescriptlang.org/docs/handbook/tsconfig-json.html I'll have to give this a try. – Tropopause