Gulp tasks for packaging both npm and NuGet packages controlled by package.json (and other files)

Downloads in past


1.2.220824112 years ago6 years agoMinified + gzip package size for proactive-gulp-pack in KB


Gulp tasks for packaging both npm and NuGet packages controlled by package.json (and other files)


If this is the only thing you need in gulp then create your gulpfile.js like this: ```js require("proactive-gulp-pack")(); ``` This will add a 'default' task so you can build the configured packages using ```PowerShell gulp ```

Gulp project

If you're using Gulp for other things then the recommended way to include packaging is ```js 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 ```PowerShell gulp pack:all ``` or by setting "pack:all" as a dependency of any other gulp task.


If you need to specify options to the packaging then use the following in the gulpfile.js: ```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 | |||


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: ```js
`./dist/${npmMainJs.replace(/.js$/, ".d.ts")}`,
"./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


To prevent building a npm package add NoNpm to the keywords array.


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) | |||


| 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 (in nuspec.json folder)
Content of (in root folder) | | summary | Short description of package | description from package.json | | releaseNotes | Description of changes in release
Can't be specified | Content of (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 generated
Can't be specified| ./dist | | baseDir | Path relative to which files are specified | root |


Dependencies can be specified like this: ```json {
"options": {
"dependencies": [
{"id": "dependency1", "version": "1.0"},
{"id": "dependency2", "version": "(1.0,)"},
{"id": "dependency3", "version": "(1.0,2.0)"},
} ```


List of files to include and where to place them like this (which is the default): ```json {
"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 ```PowerShell npm run build gulp ``` Test using ```PowerShell npm run test ``` Lint using ```PowerShell npm run lint ``` Do all of above using ```PowerShell npm start ```
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.