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

serverless-confirm-command

v1.2.2

Published

Serverless plugin to make commands (and provider-specific options) requiring confirmation before execution.

Downloads

443

Readme

Serverless Confirm Command

serverless npm package Build Status Code Coverage Language grade: JavaScript Known Vulnerabilities License

This Serverless Framework plugin allows you to define commands (as well as provider-specific options) that will require confirmation before being executed.

Features

  • Works with all cloud providers (and all runtimes)
  • Supports all CLI commands
  • Supports AWS stages and command/stage pairs

You can find a list of all serverless infrastructure providers (as well as their associated documentation) here.

Changelog

You can find the changelog here or in the releases section.

Disclaimer

One of the intentions of this plugin is to make it more difficult to accidentally deploy or remove a serverless application when it should not. Although it provides another layer of protection, it does not replace deployment and security policies for your applications. Please do not forget to set up and protect your deployments appropriately (especially your production environment).

Demonstration

GIF demo

Documentation

Prerequistes

  • Serverless Framework 1.0.0 or more recent
  • Node.js 6.4.0 or more recent

Installation

Install the plugin by running:

npm install serverless-confirm-command --save-dev

Alternatively, if you are using Yarn:

yarn add serverless-confirm-command --dev

Then add the plugin to your serverless.yml file plugin section:

plugins:
  - serverless-confirm-command

Configuration

You must configure the plugin in the custom section of your serverless.yml file, in a dedicated confirm section. All options (provider-agnostic or not) can be used at the same time.

Commands (provider-agnostic)

List the commands you want to confirm in a sub-section of the same name.

custom:
  confirm:
    commands:
      - 'deploy'
      - 'remove'

For instance, the configuration above will require both the deploy and remove commands to be confirmed.

List of commands

Please refer to the CLI reference of each provider for a complete list of available commands.

Additionally, it is important to note that each command possessing its own section in the documentation is considered a separate command. For instance, if you are using AWS as your cloud provider, deploy and deploy function are considered to be two different commands.

AWS options

In you are using AWS as your cloud provider, you can set up any stage and/or command/stage pair to require confirmation.

custom:
  confirm:
    aws:
      stages:
        - 'release'
      commandsForStages: # Must be listed as 'command:stage'
        - 'remove:prod'

For instance, the configuration above will require the following cases to be confirmed:

  • Any command using the stage release
  • The remove command used in combination with the prod stage

You can list as many stages and command/stage pairs as you want (as long as the command is supported by the plugin).

Usage

Once you have configured the plugin, you can continue to use the Serverless Framework exactly as you were before. The commands (and potentially the other options) you have configured will now need to be confirmed.

To confirm a command (or any option), you must provide the CLI option --confirm when using Serverless.

Example

Let us assume you want to configure the remove command to require confirmation to prevent accidental deletion of your application.

Configuration of the plugin:

custom:
  confirm:
    commands:
      - 'remove'

Using the command serverless remove will produce an error:

  Serverless Confirm Command Error ---------------------------------------

  Command not confirmed. Use [--confirm] or change the configuration of the plugin.

Using the command serverless remove --confirm will succeed!

License

Distributed under the MIT license.