proactive-gulp-pack
v1.2.22082411
Published
Gulp tasks for packaging both npm and NuGet packages controlled by package.json (and other files)
Downloads
160
Keywords
Readme
Gulp tasks for packaging both npm and NuGet packages controlled by package.json (and other files)
Usage
Standalone
If this is the only thing you need in gulp then create your gulpfile.js like this:
require("proactive-gulp-pack")();
This will add a 'default' task so you can build the configured packages using
gulp
Gulp project
If you're using Gulp for other things then the recommended way to include packaging is
const gulp = require("gulp"),
... // Other requires
require("proactive-gulp-pack")(gulp);
This will add a 'pack:all' task so you can build the configured packages using
gulp pack:all
or by setting "pack:all" as a dependency of any other gulp task.
Advanced
If you need to specify options to the packaging then use the following in the gulpfile.js:
const gulp = require("gulp"),
... // Other requires
require("proactive-gulp-pack")(gulp, {
// Your options
...
});
As above you need to invoke 'pack:all' "manually".
Options supported are: ||| |-|-| | additionalNpmFiles | An array of file globs to include in the npm package | |||
Configuration
Package.json
This is of cause the main configuration for your npm package (if any), but should also be used as main configuration of NuGet packages.
The version number in package.json is the one which is:
- Used to name build
- Tagged in git (master and release builds only)
- Automatically incremented to next minor version when released
Should of cause include "proactive-gulp-pack" in devDependencies.
npm content
By default the following is included in the npm package:
[
"./README.md",
`./dist/${npmMainJs}`,
`./dist/${npmMainJs}.map`,
`./dist/${npmMainJs.replace(/.js$/, ".d.ts")}`,
"./style/**/*.less",
"./tests/*Mocks.d.ts",
"./tests/*Mocks.js",
"./typings.json ",
]
where npmMainJs is the javascript file specified as main
in package.json.
If you need more then you can add and additionalNpmFiles
to options
NoNpm
To prevent building a npm package add NoNpm
to the keywords array.
*nuspec.json
To build a NuGet package add a *nuspec.json
file in any folder (Except below .\Tests
).
The content should be an object with two properties (of which one is optional): ||| |-|-| | options | Parameters as specified for gulp-nuget-pack. All except id optional (see below) | | files(optional) | An array of file specifications (see below) | |||
options
| Name | Description | default value| |-|-|-| | id | Id (and filename of NuGetPackage) | required | | version | The version | version from package.json | | title | Displayed name | id | | authors | Authors of package | author from package.json | | owners | Owners of package | ProActive A/S | | description | Long description of package.Can't be specified | Content of description.md (in nuspec.json folder)Content of README.md (in root folder) | | summary | Short description of package | description from package.json | | releaseNotes | Description of changes in release Can't be specified | Content of releasenotes.md (in nuspec.json folder) | | language | Locale Id for package such as en-us | | | projectUrl | Url for home page of package | | | iconUrl | Url for icon for package || | licenseUrl | Link to license the package is under || | requireLicenseAcceptance | Must license be accepted on install | false | | copyright | Copyright details | ProActive A/S | | dependencies | Array of packages of which this package is dependend each specified as an object with id and version (range) (see below) | | | tags | Space delimited list of keyword for package | keywords from package.json | | excludes | Array of globs to exclude from package || | outputDir | Path where package will be generatedCan't be specified| ./dist | | baseDir | Path relative to which files are specified | root |
dependencies
Dependencies can be specified like this:
{
"options": {
...
"dependencies": [
{"id": "dependency1", "version": "1.0"},
{"id": "dependency2", "version": "(1.0,)"},
{"id": "dependency3", "version": "(1.0,2.0)"},
],
...
}
}
files
List of files to include and where to place them like this (which is the default):
{
"options": {
...
},
"files": [
{
"dest": "/content/",
"src": "nuspec.json folder/content/*"
},
{
"dest": "/deployment/",
"src": "nuspec.json folder/deployment/*"
},
{
"dest": "/tools/",
"src": "nuspec.json folder/tools/*"
},
]
}
Build and Test
Build using
npm run build gulp
Test using
npm run test
Lint using
npm run lint
Do all of above using
npm start
Debugging
If build fails then you can debug this using the self
configuration in Code
If a test fail then you can debug this using the corresponding configuration in Code
In both cases source maps are set up to point to src\index.ts
.