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

npm-ws

v0.9.7

Published

Workspaces for npm: a multi-package build manager

Downloads

4

Readme

npm-ws - Workspaces for npm

A multi-package project manager for npm.

This is a tool to easily build, test and publish your javascript products that contains multiple inter-dependent npm packages inside a single source repository.

npm-ws was initially created to manage the development life cycle of Qute.

Features

  • Provides basic tasks for npm package development like build, test, publish, version etc.
  • Extensible task registry: you can define simple tasks directly in the root package.json or more complex tasks using javascript files.
  • Can easily be integrate with any javascript bundler and tester.
  • Built-in integration with rollup and mocha
  • Integrated development server (with live reload support over multiple dependent packages)

Prerequisites

Node version 10 is required.

Usage

To install:

npm install -g npm-ws

Then add a build entry in your package.json to define your repository layout, custom tasks and other build configuration.

The root package of a monorepo product is not publishable (you must use private: true in your root package.json). The root package only serves as a container for publishable packages.

The root package is the workspace. The workspace can contain one or more npm packages (or projects). A workspace is respnsible to run tasks on its projects.

Tasks are of two types:

  1. global tasks - which runs at workspace level. Example: help, projects etc.
  2. project tasks - which are run on each project respecting the dependency order between projects (i.e. projects required by another project will be processed first).

Syntax:

ws [project] [task] [task arguments ...]

Arguments:

  1. project - an optional package name. For scoped packages you can use the local name too. When specified the task will run only on that project. Otherwise the task is run on all the workspace projects.
  2. task - an optional task. If not specified the help task will be run.
  3. All the other arguments will be passed to the task as arguments.

When running ws inside a project directory it will run the tasks only on that project (as if the project argument was given)

Tasks

Not all the build configuration and tasks are documented. To see an example of how to configure a workspace look into the root package.json of Qute;

More documentation is comming soon.

install

Install the workspace (and contained projects) dependencies. Dependency projects will be linked in the node_modules directory of the dependent project.

You must use this command to initialize the dependencies and not npm install.

ws install

uninstall

Remove all generated node_modules directories

ws uninstall

shell

Run a shell command against all the projects.

Example:

ws shell ls -1

will list the content of each project

ws subproject shell ls -1

will list the content of the given subproject

build

Run the build (against all projects). This task requires some additional configuration. If you are using rollup as the bundler - you only need to specify a rollup config file (or one per project type). If you don't use rollup then you need to write a script to integrate the bundler.

ws build

test

Run the tests (against all projects). This task requires some additional configuration. By default mocha will be used as the tester. If you want to use another tester then you need to write an integration script.

ws test

run

Run a set of tasks against all projects.

Each task will be run on each of the workspace projects. After a task completes then the next task is run on each of the workspace projects.

Example:

ws run build test

To specify arguments for a task in the run list use quotes or double quotes:

ws run "build prod" test

version

Update version of all projects (including workspace package.json) to the given version.

ws version 'version'

where version is:

  1. an explicit version. Example: 1.1.0.
  2. the string 'major'
  3. the string 'minor'
  4. the string 'patch'

publish

Publish all publishable projects.

The arguments passed to publish task are passed down to npm publish.

Example:

ws publish --dry-run

start

Start the development server. Usually used in conjunction with watch.

Example:

ws start

watch

Watch for file changes and rebuild. Usually used in conjunction with start

Example:

ws run "build dev" watch start

projects

List the projects in the workspace

ws projects

help

Display the help screen.s

ws help

link

Link dependent projects

ws link

unlink

Remove dependent project links

ws unlink

rm

Remove files (with glob support). Usually called from another tasks (like clean)

License

MIT

Authors

Bogdan Stefanescu - Intial Work - Quandora