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

@mixt/commands

v2.0.29

Published

Commands for Mixt monorepo

Downloads

15

Readme

CLI Commands

Here is a complete list of commands available through the Mixt command line tool.

To install the CLI tool, please run

npm install -g @mixt/core

Note: if you had been using the previous Mixt version from the mixt package, make sure to run npm rm -g mixt before installing @mixt/core

General commands

mixt --help, mixt -h :

Prints a standard help output about the tool, listing the various options

mixt [command] --help, mixt [command] -h :

Prints the help page for a specific command

mixt --version, mixt -V

Prints the currently installed version number

Monorepo Management commands:

Mixt provides a set of CLI commands for managing your monorepo.

mixt init :

Description

Initializes a repository following Mixt's structure. It calls npm init internally for you.

Available options

-c, --config <config> : How to generate config file. "true" generates a "mixt.json" file. "embed" adds the config to "package.json". "false" does not store configuration. (default: true)

-s, --sources <sources> : Comma-separated list of source folders. Will be added to configuration.

-r, --resolve <resolve> : Resolve method to use from full|cheap|all|none. Defaults to full. Will be saved to configuration. Values are :

  • "full" : check inside source files to extract all used dependencies. Most robust, but can be long on big projects.

  • "cheap" : only add dependencies referred to in the module's package.json. The wildcard "*" can be used as version to fetch the root's package.json dependency.

  • "all" : add all dependencies from the root's package.json.

  • "none" : keep the local package.json as-is

    -p, --prefix <prefix> : Prefix for preferred npm scripts. Defaults to "mixt:". Will be saved to configuration.

    -b, --git-branch <branch> : Specify the Git branch from which publishing is allowed. Defaults to "master". Will be saved to configuration.

    -t, --git-tag-prefix <tagPrefix> : Append a custom prefix for generated Git tags. Defaults to none. Will be saved to configuration.

mixt add [source] <package> :

Description

Adds a new package to your sources. There again, it calls npm init from within the new package's root directory.

If the source parameter is omitted, the package will be added to the first source folder configured.

Available options

-r, --resolve <resolve> : Resolve method to use from full|cheap|all|none. Defaults to full. Will be added to local config.

-p, --prefix <prefix> : Prefix for preferred npm scripts. Defaults to "mixt:". Will be added to local config.

-d, --dist <dist> : Subdirectory holding the built package. Defaults to "./". Will be added to local config.

mixt list :

Description

List all packages handled by Mixt and display basic information about them

Available options

-s, --sources <sources>: Comma-separated list of source folders. Will only list packages in those sources.

mixt hoist [packages...] :

Description

Get all Mixt-managed packages and add them to the root's package.json as file: dependency

If you specify a list of packages names as variadic argument, only those packages will be hoisted.

Available options

-s, --sources <sources>: Comma-separated list of source folders. Will only hoist packages in those sources.

mixt stub [packages...] :

Description

Create an empty package.json at the dist root of each package, if it does not exist.

Useful for CI environment where build requires npm ci, but npm ci requires packages to exist.

Available options

-s, --sources <sources>: Comma-separated list of source folders. Will only stub packages in those sources.

Cross-packages script handling commands:

Mixt makes it easy to run commands in one or multiple managed packages.

mixt run <script> [packages...] :

Description

Go through all managed packages (or packages given to the command), and execute the given NPM script if found.

All packages are checked sequentially, so only one script ever runs at a time.

Available options

-s, --sources <sources> : Comma-separated list of source folders. Will limit scope to those sources

-q, --quiet : Turn off logging for scripts

-o, --options : Command-line options to pass to the script (equivalent to -- syntax for npm run)

mixt exec <command> [packages...] :

Description

Behaves just like mixt run, but takes a bash command to run in each packages instead of an NPM script name.

Available options

-s, --sources <sources> : Comma-separated list of source folders. Will limit scope to those sources

-q, --quiet : Turn off logging for scripts

Shorthands commands

mixt ci [packages...] :

Description

Shorthand for mixt exec "npm ci".

Available options

-s, --sources <sources> : Comma-separated list of source folders. Will limit scope to those sources

-q, --quiet : Turn off logging for scripts

mixt i [packages...] :

Description

Shorthand for mixt exec "npm i". Can also be used as mixt install [packages...]

Available options

-s, --sources <sources> : Comma-separated list of source folders. Will limit scope to those sources

-q, --quiet : Turn off logging for scripts

mixt build [packages...] :

Description

Shorthand for mixt run build. Will also match mixt:build scripts.

Available options

-s, --sources <sources> : Comma-separated list of source folders. Will limit scope to those sources

-q, --quiet : Turn off logging for scripts

-o, --options : Command-line options to pass to the script (equivalent to -- syntax for npm run)

mixt watch [packages...] :

Description

Shorthand for mixt run watch. Will also match mixt:watch, mixt:dev and dev scripts.

Available options

-s, --sources <sources> : Comma-separated list of source folders. Will limit scope to those sources

-q, --quiet : Turn off logging for scripts

-o, --options : Command-line options to pass to the script (equivalent to -- syntax for npm run)

mixt start [packages...] :

Description

Shorthand for mixt run start. Will also match mixt:start scripts.

Available options

-s, --sources <sources> : Comma-separated list of source folders. Will limit scope to those sources

-q, --quiet : Turn off logging for scripts

-o, --options : Command-line options to pass to the script (equivalent to -- syntax for npm run)

mixt test [packages...] :

Description

Shorthand for mixt run test. Will also match mixt:test scripts.

Available options

-s, --sources <sources> : Comma-separated list of source folders. Will limit scope to those sources

-q, --quiet : Turn off logging for scripts

-o, --options : Command-line options to pass to the script (equivalent to -- syntax for npm run)

Release related commands:

mixt status [packages...] :

Description

Check against the latest Git tag to see which packages have been modified since. If no tag is found, all packages are marked as changed by default.

Available options

-s, --sources <sources> : Comma-separated list of source folders. Will limit scope to those sources

mixt release [packages...] :

Description

Helper command for gracefully handling your package releases. It provides a CLI workflow for bumping your packages versions, optionally builds your packages before release, etc... Here is the complete Mixt release flow:

  • Check repository: only allow releases from the configured branch
  • Get modified packages: find packages in need of a new release
  • Bump packages versions: ask you for the next version of each packages
  • Build packages (optional): build all packages before releasing
  • Resolve dependencies: inject all root dependency to the local package.json, injecting the correct version for local packages
  • Execute release script: look for a mixt:release or release script in each package and execute it
  • Commit releases (optional): create a release commit with all released packages names and versions
  • Create tags (optional): create a Git tag for each released package
  • Revert dependency resolve: revert your local package.json to their original state (except version)
  • Commit revert (optional): commit again to store the revert of local dependency

That is quite a lot, but it is what is most often needed for any releases. Here all is taken care of for you in one simple command.

Available options

-s, --sources <sources> : Comma-separated list of source folders. Will only release packages inside those sources

-a, --all : Whether to release packages that have not changed on Git

-r, --resolve <resolve> : Resolve method to use from full|cheap|all|none. Defaults to full

-B, --no-build : Do not build packages before releasing (not recommended)

-T, --no-tag : Do not add Git tag after releasing

-C, --no-commit : Do not commit release to Git, only run scripts. Automatically adds "no-tag" flag

-t, --git-tag-prefix <tagPrefix> : Append a custom prefix for generated Git tags. Defaults to none

-b, --git-branch <branch> : Specify the Git branch from which publishing is allowed. Defaults to "master"

-q, --quiet : Turn off logging for scripts

mixt bundle [package] :

Description

Helper command for bundling a package with all its dependency cleanly hoisted to its level. This command is aimed at helping create a container (i.e. Docker) aimed at a single application inside a monorepo. It does not transpile the code in any way, it only isolates a package from the rest of the repository while keeping it launchable.

Here is the complete Mixt bundle flow:

  • Copy dist to bundle: copy the built and resolved dist package to a bundle folder. Will crash if the bundle folder already exists
  • Merge node_modules: merge the package and dist node_modules
  • Resolve dependencies: find all dependencies of the copied dist package
  • Copy local dependencies: local dependencies dist are copied to a local_modules folder inside bundle
  • Copy common dependencies: copy common dependencies from the root's node_modules to the bundle's node_modules. This uses package-lock.json in order to find nested dependencies
  • Resolve local dependencies: repeat steps 2-4 for each local dependency

This way, all dependencies are hoisted up to the bundle folder, which can then be safely packaged in a container or shipped individually.

Available options

-s, --sources <sources> : Comma-separated list of source folders. Will search for the package to bundle inside those sources

-r, --resolve <resolve> : Resolve method to use from full|cheap|all|none. Defaults to full

-q, --quiet : Turn off logging for scripts