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

@cypress/deploy-bits

v1.8.0

Published

Reusable deployment utilities

Downloads

39

Readme

@cypress/deploy-bits

Reusable deployment utilities

NPM

ci status semantic-release js-standard-style

Install

Requires Node version 6 or above.

npm install --save @cypress/deploy-bits

Use

Debugging

To debug functions from this module, run the program with DEBUG=deploy-bits environment variable.

isCI

Returns true if the code is running on a common continuous integration server. Uses is-ci.

const {isCI} = require('@cypress/deploy-bits')
if (isCI) {
  // we are on CI
}

warnIfNotCI

Prints a console warning if the code is not running on CI. Often we prefer deploying from CI rather than running the deploy command locally.

const {warnIfNotCI} = require('@cypress/deploy-bits')
warnIfNotCI()

getDeployEnvironment

Returns target deployment environment staging or production

const {getDeployEnvironment} = require('@cypress/deploy-bits')
getDeployEnvironment()
  .then(env => ...)

If the user specified environment using CLI --environment <name> option, it will be used. Otherwise, user will be prompted to select one.

? Which environment are you deploying?
❯ Staging
  Production

You can pass list of arguments for this function to parse (by default it uses process.argv)

getDeployEnvironment(['--environment', 'staging']) // yields "staging"

and you can even pass minimist parsing options

const options = {
  alias: {
    environment: 'e'
  }
}
getDeployEnvironment(['-e', 'staging']) // yields "staging"

getBranch

Resolves with current branch.

const {getBranch} = require('@cypress/deploy-bits')
getBranch()
  .then(branch => ...)

checkBranchEnvFolder

Checks the branch to environment mapping. For some branches checks if the working directory is clean (no modified source files). Always returns input environment name. Curried.

const {checkBranchEnvFolder} = require('@cypress/deploy-bits')
// synchronous method
checkBranchEnvFolder('master')('production')
// returns "production"
// will throw an error if there are modified files

getS3Config

Returns S3 config loaded from environment variable or local file. If cannot find either, throws an error.

const {getS3Config} = require('@cypress/deploy-bits')
const config = getS3Config()

Typical config file in support/.aws-credentials.json contains

{
  "bucket-production": "<production S3 folder name>",
  "bucket-staging": "<staging S3 folder name>",
  "key": "AWS API key",
  "secret": "AWS API secret"
}

getS3Publisher

Returns an instance of gulp-awspublish

const {getS3Config, getS3Publisher} = require('@cypress/deploy-bits')
const config = getS3Config()
const publisher = getS3Publisher(config['bucket-production'], config.key, config.secret)

publishToS3

Uploads (diffs) a local folder to AWS S3 folder.

const {getS3Config, getS3Publisher, publishToS3} = require('@cypress/deploy-bits')
const config = getS3Config()
const publisher = getS3Publisher(config['bucket-production'], config.key, config.secret)
publishToS3('dist/public', publisher)
// returns a promise

Note: if a local folder contains build.json it will be uploaded with "no cache" headers.

uploadToS3

Normal local folder upload to S3 using above functions.

const {uploadToS3} = require('@cypress/deploy-bits')
uploadToS3('dist/public', 'production')
  .then(...)

Small print

Support: if you find any problems with this module, email / tweet / open issue on Github

MIT License

Copyright (c) 2017 Cypress.io

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.