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

@tradie/node-package-scripts

v1.1.8

Published

An opinionated set of scripts for creating and maintaining node packages.

Downloads

27

Readme


@tradie/node-package-scripts

An opinionated set of scripts for creating and maintaining node packages.

Feel like you spend more time setting up and updating the tools to build, test and maintain your project? @tradie/node-package-scripts lets you focus on writing code and spend less time setting up and updating the tools to build, test and maintain your project. It provides you with a way to keep tooling consistent across multiple packages with minimal effort.

Usage

Create a new folder for your project:

mkdir my-package && cd my-package

Create the files for your project:

npx --package @tradie/node-package-scripts tradie create

Files

  coverage/
  examples/
  lib/
  src/
  test/
  .flowconfig
  .gitignore
  package.json

coverage/

This folder contains the coverage report generated by tradie test --coverage. This folder should be added to your .gitignore file. This folder is removed by tradie clean.

examples/

This folder contains scripts that demonstrate the functionality of your package. These scripts can be run using the tradie example <module> command.

lib/

This folder contains the transpiled sources generated by tradie build. This folder should be added to your .gitignore file. This folder is removed by tradie clean.

src/

This folder contains the source code and the unit tests for your package.

test/

This folder contains other tests e.g. integration etc

.flowconfig

This file contains your config for flowtype. Typings are optional.

.gitignore

This file excludes files from your version control system. It should at least exclude the generated files and folders. For example:

lib
coverage
node_modules

package.json

This is your package manifest. You should specify your package's main script and which files will should be included in the package.

{
  "main": "lib/index.js",
  "files": ["lib", ".flowconfig"]
}

Commands

tradie clean

Remove generated files and folders.

tradie clean

tradie lint

Lint sources, tests and examples.

tradie lint [--watch]

This command doesn't enforce any stylistic rules. Use prettier instead.

tradie build

Transpile sources and export their types.

tradie build [--watch]

tradie test

Run tests.

tradie test [--watch] [--coverage]

tradie example

Run examples.

tradie example [module]

FAQ*

*Questions that I think will be frequently asked.

Can I use the latest language features?

Yes. The following Babel presets and plugins are configured:

  • babel-preset-env
  • babel-plugin-transform-class-properties
  • babel-plugin-transform-object-rest-spread
  • babel-plugin-transform-dynamic-import-node

What versions of node will my package support?

By default your sources will be transpiled to support Node >=4. You can change the target Node version by using the engines key in your package.json. For example:

{
  "engines": {
    "node": "v8"
  }
}

Can I use types?

Yes! Create a .flowconfig and add // @flow comments to the top of your files. Type information will be exported to ./lib.

You should ignore the ./lib directory. For example:

.flowconfig:

[ignore]
<PROJECT_ROOT>/lib