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

@pingy/init

v7.1.0

Published

Initialize a project for use with Pingy CLI

Downloads

69

Readme

Init

npm version Build Status Coverage Status

Scaffold a project for use with Pingy Middleware and Pingy Export.

Getting Started

To install:

npm install @pingy/init

To scaffold out a project using html, scss, babel, you could do:

var init = require('@pingy/init');

var initDir = '/path/to/dir';
var options = {
  styles: { type: 'scss' },
  scripts: { type: 'babel' },
  whitespaceFormatting: 2,
  babelPolyfill: true,
  normalizeCss: true,
};

init(initDir, options).then([successFn],[errorFn]);
// [successFn] will be passed an array of the files that were created during the scaffold

This will scaffold a project that has the following directory structure:

/path/to/dir
├─┬ scripts
│ ├── main.babel.js
│ └── polyfill.js
├─┬ styles
│ ├── main.scss
│ └── normalize.css
└ index.html

And here is a truncated version of the html file:

<!DOCTYPE html>
  <head>
    <!-- ... -->
    <link rel="stylesheet" href="styles/normalize.css">
    <link rel="stylesheet" href="styles/main.css">
  </head>
  <body>
    <!-- ... -->
    <script src="scripts/polyfill.js"></script>
    <script src="scripts/main.js"></script>
  </body>
</html>

Options

  • html

    • type (String, default = 'html'): Which languages to use for html documents. Possibilities: 'html', 'jade'.

    • file (String, default = 'index'): Filename (without extension) for main html document.

  • styles

    • type (String, default = 'css'): Which languages to use for stylesheets. Possibilities: 'css', 'scss', 'sass', 'less', 'styl'.

    • file (String, default = 'main'): Filename (without extension) for main style file.

    • folder (String, default = 'styles'): folder where style files are stored.

  • scripts

    • type (String, default = 'js'): Which languages to use for javascript. Possibilities: 'js', 'babel', 'coffee'.

    • file (String, default = 'main'): Filename (without extension) for main script files.

    • folder (String, default = 'styles'): folder where script files are stored.

  • babelPolyfill (Boolean): Include and reference the babel polyfill.

  • normalizeCss (Boolean): Include and reference normalize.css.

  • whitespaceFormatting (Number/String, default = 'tabs'): Formatting for whitespace. If not specified then tabs will be used, otherwise you can pass a number (e.g. 2, 4, 8) and the corresponding number of spaces will be used

Here is a full list of the defaults:

{
  html: {
    file: 'index',
    type: 'html', // or 'jade'
  },
  styles: {
    folder: 'styles',
    file: 'main',
    type: 'css', // or 'scss', 'sass', 'less', 'styl'
  },
  scripts: {
    folder: 'scripts',
    file: 'main',
    type: 'js', // or 'babel', 'coffee'
  },
  babelPolyfill: false,
  normalizeCss: false,
  whitespaceFormatting: 'tabs',
}