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

protato

v0.2.8

Published

HMR. Auto-update parent module's child dependency when you update that child dependency's file

Downloads

4

Readme

protato logo

travis CI

HMR. Auto-update parent module's child dependency when you update that child dependency's file

FAQ

This is a summary of how Protato fits into my design/development flow.

The reason I went with yalc was because of the difficulty of installing or linking modules to a specific directory in a cross-platform way.

References

  • npm-folders
  • protato-lib/pull/6 for a play-by-play of the discovery process(all the things to not do)

Install (Optional)

If you'd rather not install, you can use npx

  • Install CLI globally npm install -g protato

  • Install CLI as dev dependency npm install -D protato

Usage

Watch your files and update your dependency tree automatically

protato watch

CLI Config

In order to watch your files, you need to supply protato with a config file. It must be named .protato.json

Example used in unit tests

{
	"parent": {
		"dir": "sandbox/node-starter"
	},
	"children": [
		{
			"dir": "sandbox/npm-starter-sample-module",
			"src": "src"
		},
		{
			"dir": "sandbox/library-genesis",
			"src": "src"
		}
	]
}

What differentiates this unit test example is I'm making the parent a subdirectory as well. Normally, your parent directory would be your root directory/cwd. The sandbox directory was initialized using repo-genesis

Abstract example

  • protato-cli
    • protato-lib
    • tacker

In this project example, I want "protato-cli" to update its dependencies whenever "protato-lib" or "tacker" are updated locally. Let's say I changed protato-lib/src/index.js, it would then trigger an update which would re-link the packages.

Breaking down the example

| Name | Category | Attributes Description | |:-------------|:----------------------|:--------------------------------------------------------------------------| | protato.json | Config file name | this file should be declared at the root of your project | | parent | Top-level key | this represents your entry point project; it relies on your child modules | | children | Top-level key | modules you are working on locally | | dir | Parent & Children key | root of children to watch or parent project to update; relative from cwd | | src | Children key | specific directory to watch |


Roadmap

CLI Commands

| Status | Name | Description | |:------------------------|:---------|:-----------------------------------------------------------------| | :white_check_mark: | watch | Begin watching your child modules for updates | | :ballot_box_with_check: | yalc | List your current packages; install yalc if directory not found. | | :ballot_box_with_check: | config | Generate an empty config if you don't have one in your CWD. |

CLI Flags

| Status | Name | Description | |:------------------------|:---------|:-----------------------------------------------------| | :white_check_mark: | --help | Print help menu | | :ballot_box_with_check: | --link | Add child package symlink in your parent project | | :ballot_box_with_check: | --add | Pull child package contents into your parent project |

Minor Features

  • Currently doesn't update child module builds before re-linking

TODO: Create CLI flag and library logic to parse "build" in package.json before updating dependency

  • Each child module relies on the same root directory. This is prohibitive.

TODO: Enable per-child-module cwd. Add object to config and handle parsing.

  • Currently, child modules cannot exist outside of the current "monolith". They assume they same CWD

TODO:This is fine if repo-genesis is being used. But it could be annoying for others. Fix to this is allow absolute pathing. Add a "cwd" object to the config to specify root directory. Override the cwd default (be that process.cwd() or process.env.configRootDir)

  • It'd be great to have a demo project.

TODO: Have to make some changes to repo-genesis (to allow auto-install modules)

  • process.env.configRootDir was added but never tested or discussed in readme

TODO: Write unit test and update readme accordingly

  • Especially in the case of newly cloned projects, it's annoying that protato will throw IF node_modules are missing.

CONTEXT: While npm install is an easy fix, it's obnoxious if there are multiple subdirectories being cloned via repo-genesis TODO: Add auto-install node_modules feature to protato-lib