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

@unly/serverless-scripts-env

v1.0.2-beta.0

Published

plugin serverless to help process.env with nextjs

Downloads

3

Readme

Build Status Maintainability Test Coverage

Serverless Scripts Env

Introduction

This plugin aims to answer a specific need and to simplify the assignment of environment variables with serverless either front-end or back-end.

Installation

Install the plugin using either Yarn or NPM. (we use Yarn)

NPM:

npm install @unly/serverless-scripts-env

YARN:

yarn add @unly/serverless-scripts-env

Usage

Step 1: Load the Plugin

The plugin determines your environment during deployment and adds all environment variables to your Lambda function. All you need to do is to load the plugin:

Must be declared before serverless-webpack, despite what their officially doc says

plugins:
  - '@unly/serverless-scripts-env' # Must be first, even before "serverless-webpack", see https://github.com/UnlyEd/serverless-scripts-env
  - serverless-webpack # Must be second, see https://github.com/99xt/serverless-dynamodb-local#using-with-serverless-offline-and-serverless-webpack-plugin

Step 2: Configure your serverless.yml

Set the slsScripts object configuration as follows (list of all available options below):

custom:
  slsScripts:
    offline:
      logName: client # name of the command that appears in the terminal being executed
      script:
        cmd: next # command to execute
        args:
          - -p 3001
      path: # Absolute path to run the command by default take root folder
      env:
        exclude: # list of environment variables present that will not be provided at launch time in the child process
          - SECRET_KEY

provider:
  name: aws
  runtime: nodejs6.10
  environment:
    GROUP_NAME: staging
    SECRET_KEY: f08ed2dc-edeb-45f4-9cac-56012820a384

Configuration of slsScripts object:

| Attributes | Type | Required | Description | |------------|:------:|:--------:|------------------------------------------------------------------| | offline | Object | false | script to run before cli serverless-offline start | | build | Object | false | script to run before cli serverless deploy or serverless package |

offline & build object:

| Attributes | Type | Required | Default | Description | |------------|:------:|----------|---------------------------|-----------------------------------------------------------------| | logName | String | false | Serverless-scripts-env | name of the command that appears in the terminal being executed | | script | Object | true | | | | path | String | false | current working directory | Absolute Path to run the script | | env | Object | false | | |

script object :

| Attributes | Type | Required | Default | Description | |------------|:------:|----------|:-------:|------------------------------| | cmd | String | true | | command to execute | | args | Array of String | false | [ ] | command arguments to execute |

env object :

| Attributes | Type | Required | Default | Description | |------------|:---------------:|----------|---------|------------------------------------| | exclude | Array of String | false | | environment variables to blacklist |

Try it out yourself

To test this plugin, you can clone this repository. Go to examples/, and follow the README.


API

API


Contributing

We gladly accept PRs, but please open an issue first so we can discuss it beforehand.

Getting started

yarn start # Shortcut - Runs linter + tests in concurrent mode (watch mode)

OR run each process separately for finer control

yarn lint
yarn test

Test

yarn test # Run all tests, interactive and watch mode
yarn test:once
yarn test:coverage

Releasing and publishing

yarn releaseAndPublish # Shortcut - Will prompt for bump version, commit, create git tag, push commit/tag and publish to NPM

yarn release # Will prompt for bump version, commit, create git tag, push commit/tag
npm publish # Will publish to NPM

Node support

This plugin officially supports Node.js 6.10 and 8.10.

License

MIT