Skip to content

Temporary Package Workflow

Kitson Kelly edited this page Dec 30, 2015 · 2 revisions

Including a Dojo 2 Package

While a package is not published on npm or bower this is a workflow you can follow to include the package as a dependency. It requires to build a distribution of the package and include it with your dependent package.

  1. Clone package
  2. Build a distribution of the package
  3. Change packaging of dependent package
  4. Copy distributable into dependent package
  5. Integrate into package typings

Clone package

For the examples, we will assume you are going to depend on dojo/core. First clone the package, outside of the path of the dependent package:

$ git clone https://github.com/dojo/core.git

Build a distribution of the package

Next you will need to build a distribution:

$ cd core
$ npm install
$ grunt dist

You will now have the distributable package in /dist.

Change packaging of dependent package

You will need to make sure that the distributable of the distributable package does not interfere with your depedent package.

You need to change your .gitignore to add the following lines:

!/_modules/**/*.js
!/_modules/**/*.js.map

As well as you should exclude the code from your test coverage. In order to do this, modify the tests/intern.ts from:

export const excludeInstrumentation = /(?:node_modules|bower_components|tests)[\/\\]/;

to:

export const excludeInstrumentation = /(?:node_modules|bower_components|tests|_modules)[\/\\]/;

Copy distributable into dependent package

You will then need to copy the distributable:

$ cd ../{dependent-package-wd}
$ mkdir _modules
$ cp -r ../core/dist _modules/dojo-core

Integrate into package typings

You should then include the typings from the distributable into your package by editing your typings/tsd.d.ts:

///<reference path="../_modules/dojo-core/typings/dojo-core/dojo-core-2.0.0-pre.d.ts"/>