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

generator-serverless

v2.0.2

Published

Yeoman generator for creating serverless projects

Downloads

16

Readme

Generator Serverless

NPM Badge

Yeoman generator for a lambda Serverless project

Logo

Requirements

  • Node V6.x
  • Yeoman >= V1.8.5

Generator installation

First of all, you are going to need Yeoman:

npm install -g yo

Then get the generator:

npm i -g generator-serverless

Usage

Base generator

Once the link established, you can use it right away. Create a new directory where you want your project to be and run it:

mkdir my-awesome-lambda
cd my-awesome-lambda
yo serverless

It will prompt some questions you need to answer to configure your project. Default values are specified between parenthesis. You now have a starter skeleton for a lambda project!

Sub-generator

While working on your project, you can easily add a function/route by using the subgenerator. In the root directory of your project, type:

yo serverless:route

Just like the base generator, it will prompt you to give the function(s) name(s). It creates the handler files and modify the serverless.yml file according to.

Unit Testing

Generator unit tests

TODO

Project unit tests

For every route created with the generator, a corresponding unit test template file is added in the test directory.

Project features

These are all the features of the generated project:

| Feature | Summary | |----------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Code Linting | JavaScript code linting is done using ESLint. Uses ESLint with the coming soon Exaprint JavaScript style guide. | | Deploy Management tool | Deploy the server on AWS using Serverless Framework. | | Code Testing via Mocha throught Jenkin-Mocha (Mocha + Istanbul) | Single command to run your Mocha unit tests with both XUnit and LCov output (for Jenkins). | | ES6 Code Coverage via Istanbul throught Jenkin-Mocha (Mocha + Istanbul) | Supports code coverage of ES6 code using istanbul and mocha. Reports are Jenkins ready. | | Debugging via debug | Instead of inserting and deleting console.log you can replace it with the debug function and just leave it there. You can then selectively debug portions of your code by setting DEBUG env variable. If DEBUG env variable is not set, nothing is displayed to the console. | | Object validation via JOI | Object schema description language and validator for JavaScript objects. | | Uses yarn over npm | Uses new released yarn package manager by facebook. You can read more about it here | | Uses http-status to set http status code. | It is recommended to use httpStatus.INTERNAL_SERVER_ERROR instead of directly using 500 when setting status code. | | Has .editorconfig | It helps developers define and maintain consistent coding styles between different editors and IDEs.| | @use JSDoc to generate JS Documentation | JSDoc 3 is an API documentation generator for JavaScript, similar to JavaDoc or PHPDoc. You add documentation comments directly to your source code, right along side the code itself. The JSDoc Tool will scan your source code, and generate a complete HTML documentation website for you. | | Use Plato | Visualize JavaScript source complexity | | Use DotEnv | Dotenv is a zero-dependency module that loads environment variables from a .env file into process.env | | Use Winston JS for logging purpose | A multi-transport async logging library for Node.js | | Use Node Security Platform - NSP | nsp is the main command line interface to the Node Security Platform. It allows for auditing a package.json or npm-shrinkwrap.json file against the API. | | Use Serverless Mocha Plugin Enable it manually | A Serverless Plugin for the Serverless Framework which adds support for test driven development using mocha | | Use Serverless Offline Plugin Enable it manually | Emulate AWS λ and API Gateway locally when developing your Serverless project |

Changelog

V1.3.0

  • Added Settings variable into the default handler
  • Added Settings usage in default handler template
  • Modified parameter to a static one
  • Improve LambdaWrapper Error catching
  • Added verbose mode on full deployment
  • Created function-specific deployment script
  • Made stage environment changeable
  • Added usage documentation
  • Gitignores env.json instead of .env
  • Allow run() to handle data to be displayed via end()
  • Updated documentation for optional LoggedError arguments
  • Update package version