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-swagapi

v0.2.0

Published

Yeoman generator for swagger-based express application.

Downloads

11

Readme

generator-swagapi

Build Status Coverage Status

Yeoman generator for swagger-based express application.

See also:

Usage

Install yeoman's yo if you haven't already:

$ npm install -g yo

Install generator-swagapi:

$ npm install -g generator-swagapi

Create a project:

$ yo swagapi

CLI Options

  • --apiPath - specify the path to the swagger document.
  • --database - specify the name of MongoDB instance
  • --dry-run - show what files would be generated without making any changes

Using Vagrant

Start the VM:

vagrant up

Connect to the VM:

vagrant ssh

After making some changes within your IDE (sync your code to VM):

vagrant rsync

When using the docker run command below, the vagrant rsync will result in the changes being immediately available to the running container.

Using Docker

Why don't we just use official image directly?

The official images only provide the base installation of node and npm. To be useful you need a non-root user to install anything using npm install -g otherwise you will hit the dreaded EACCESS error.

What is included?

Each file simply adds a new user appy that has access to install files into the global distribution (/usr/local/lib/node_modules) using npm install -g and ownership of the application directory named /app. The custom group that nodejs selects on install has a group id of 500, and is named nodejs within the image for easy reference and assignment to our user appy.

How to use the images in development?

The run command:

docker run -it --rm -v $(pwd):/app/generator-swagapi kenjones/generator-swagapi /bin/bash

Do not forget to include generator-swagapi as part of the pathname otherwise yeoman will not pick up this as a generator and all testing will fail. See next block for more information.

From the yeoman documentation:

First, create a folder within which you'll write your generator. This folder must be named generator-name (where name is the name of your generator). This is important, as Yeoman relies on the file system to find available generators.

Basically the command will give you a command prompt within the running docker container with your current directory mounted inside at the /app location. Therefore when you do npm install the corresponding node_modules directory will continue to exist once you exit the container.

For more information on docker run read the following: https://docs.docker.com/reference/commandline/run/


Inspired by krakenjs/generator-swaggerize.