npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

grunt-cmsdeploy

v0.2.9

Published

Node.js Grunt plugin. Deploy file content to a remote server

Readme

grunt-cmsdeploy

Node.js Grunt plugin. Deploy file content to a remote server

Getting Started

This plugin requires Grunt ~0.4.x

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-cmsdeploy --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-cmsdeploy');

You can run this task as below:

grunt cmsdeploy

or

grunt cmsdeploy --auto

The late command will hot deploy all changed files automatically.

The "cmsdeploy" task

Overview

In your project's Gruntfile, add a section named cmsdeploy to the data object passed into grunt.initConfig().

grunt.initConfig({
  cmsdeploy: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
});

Options

options.remoteServer

Type: Object Default value: { protocol: 'https', hostname: "localhost", port: 443, path: "/", method: "POST", headers: { "Content-Type": "application/json" } }

A object value that is used to send client request to a remote server, all optoins from http.request() are valid.

Here, the "protocol" field indicate whether this is a https client request or not.

options.postData

Type: Object Default value: {}

A object value that is used to be sent to the server as the post data, default value is an empty object.

options.enhanceData

Type: Function Default value: function(postData, file, content)

A function value that is used to enhance or modify the post data before sent to a remote server. The first parameter will be the options.postData, the second parameter is the file path which is coming from the grunt build-in API this.filesSrc and the last parameter is the file content associated with that file.

options.delayTime

Type: Number Default value: 200

A number value that is used to specify the delay time betweening each batch files sent to the remote iCMS server. Default value is 200 millisecond.

options.batchFilesNum

Type: Number Default value: 100

A number value that is used to specify the total files number in each batch which will be sent to the remote iCMS server. Default value is 100.

Usage Examples

Custom Options

In this example, custom options are used to do something else with whatever else.

grunt.initConfig({
  cmsdeploy: {
    app:{
		options:{
			remoteServer: {
				"protocol": "https",
				"hostname": "localhost", 
				"port": 443,
				"path": "/",
				"method": "POST",
				"headers": {
					"target_host": "srwq03",
					"Authorization": "Bearer abcd1234",
					"Content-Type": "application/json"
				}
			},
			postData:{
				"metadata": {
					"release": "14.22"
				}
			},
			enhanceData: function(postData, filepath, content){
				var uri = '/resources/templates/',
					templatepath = '';
				
				if (filepath.indexOf('app-common') === 0 ) {
					templatepath = common + '/' + filepath.replace(/.*templates[^\w]*/i, '');
				}
				else {
					templatepath = appConfig.appName + '/' + filepath.replace(/.*templates[^\w]*/i, '');
				}
				
				postData.uri = uri + templatepath;
				postData.metadata.templateName = templatepath.replace(/\.dust/, '');
				postData.data = content;
				
				return postData;
			},
			delayTime: 200,
			batchFilesNum: 5
		},
		src: ['app/templates/**/*.dust', 'app-common/templates/**/*.dust']
	}
  },
});

Notes

Please note that the Content-Type here specified in the http.request options will be used in the remote server. By default when use JAVA Servlets and Tomcat as the web server and use request.getParameter method, you have to specify the Content-Type as the value application/x-www-form-urlencoded and use JSON.stringify in client side to stringify the JSON data which will be posted to the remote server in order to get the correct parameter vaule.

But if the Content-Type is application/json that does not means server side does not understand it, acutally it depends. For example if using the CXF framework and configuration is correct in server side then it can also get the parameter correctly, but by default you can specify any values for the Content-Type if the server read the raw binary data like the link below: Http Servlets Request Get Post Data

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

(Nothing yet)