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 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-deploy-to-env

v0.1.5

Published

Automated application modification and deployment for multiple environments.

Downloads

5

Readme

NPM Build Status

grunt-deploy-to-env

Allows you to configure and deploy a project to multiple environments. grunt-deploy-to-env takes a folder of files, replaces some of the file contents (e.g. local.com => example.com) then deploys the changed files to a specific location, all without changing the original files. This makes it possible to have one common project and deploy it to multiple environments.

Usage

grunt.config(['deploy'], {
    live: {
        server:  '/Volumes/mounts/live_environment',
        source:  '/Users/foo/Desktop/my_project',
        path:    '/project-namespace',
        replacements: [
            {
                from: 'http://127.0.0.1:8000',
                to:   'http://example.com'
            },
            {
                from: 'Local',
                to:   'Live'
            }
        ],
        beforeDeployment: function (done) {
            // Perform some asynchronous checks before allowing deployment.
            // Just call the done() callback when you're done.
            done();
        }
    }
});

With this example, when you run grunt live you would:

  • Execute your beforeDeployment function
  • Iterate through the files at /Users/foo/Desktop/my_project
  • Replace 'http://127.0.0.1:8000' with 'http://example.com' and 'Local' with 'Live' wherever this is encoded in your project
  • Copy the edited project files to /Volumes/mounts/live_environment/project-namespace/my_project, creating the project-namespace directory if necessary, or overwriting the previous contents if they already existed.

Options

server

Absolute path to the location of your server mount.

source

Absolute path to the local project.

path

Relative path to append to the server path. This allows you to deploy to example.com/something, rather than just the root of example.com.

replacements

Array of strings to look for and strings to replace them with.

beforeDeployment

Callback function (optional) which is executed before the deployment steps are executed. You must call the passed callback (see example) to inform grunt-deploy-to-env that you've completed your pre-deployment steps.

Directory structure

  • bin/ - contains framework-specific configuration. For now, this is just grunt (grunt.js) but could support additional configuration files for Gulp or any other build framework.
  • lib/ - contains the pure Node encapsulating the business logic of the module. This is called by the configuration files in bin/.
  • test/ - contains unit tests for our Node.

Installation

Make sure you have NPM installed. Then it's just a simple case of:

npm install

Running tests

Run tests as follows:

node_modules/.bin/vows test/vows.js

Debugging

If tests hang on 'Waiting for tmp directory to clear...', chances are that there is an NPM dependency that is not being fulfilled. If you encounter this:

  • Manually delete the tmp directory
  • npm install
  • Run the tests again.

If you still have problems:

  • Manually delete the tmp directory
  • Comment out the tests
  • Uncomment and run one test at a time. Eventually you should see Error: Cannot find module 'X', in which case you should add it to package.json, run npm install, clear the tmp directory again and run the tests.