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 🙏

© 2026 – Pkg Stats / Ryan Hefner

mktree-cli

v0.8.2

Published

Build entire directory structures with ease.

Downloads

7

Readme

mktree-cli

Build entire directory structures with ease.

Instalation

About

Many times, developers have to deal with huge boilerplates to follow a pattern or because a framework requires it. This boilerplate often requires a specific directory structure, and even though this is an easy thing to do, it shouldn't take too long to do so.

This is where mktree enters. It was first meant to be used for personal projects, but I saw it could reach its full potential in the usage with starter tools.

Usage

CLI

mktree can be used with yaml files or with the output of the tree command. For example, lets imagine the following structure.yml:

- Redux:
    - Actions:
        - GenericAction.js
    - Reducers:
        - GenericReducer.js
        - Reducers.js
    - Store:
        - DefaultStore.js

With the command mktree structure.yml, this structure will be created in your current working directory.

But, only a simple directory structure would be easy to create with mkdir. What makes mktree special is the fact that you can also specify contents for the files you will be creating. Take the previous directory structure, for example:

- Redux:
    - Actions:
        - GenericAction.js: |
            const genericAction = values => dispatch =>
              dispatch({
                type: 'GENERIC_ACTION',
                payload: values
              });

            export { genericAction };
    - Reducers:
        - GenericReducer.js: |
            import { generic } from '../Store/DefaultStore';

            const GenericReducer = (store = generic, action) => {
              switch (action.type) {
                case 'GENERIC_ACTION':
                  return { ...store, ...action.payload };

                default:
                  return store;
              }
            };

            export default GenericReducer;
        - Reducers.js: |
            import { combineReducers } from 'redux';
            import genericReducer from '../Reducers/GenericReducer';

            const Reducers = combineReducers(
              {
                generic: genericReducer
              }
            );

            export default Reducers;
    - Store:
        - DefaultStore.js: |
            const generic = {
              data: null,
              otherData: null
            };

            export { generic };

Everything will be created, which allow the quick creation of projects that share the same boilerplate ~~yes react-redux, if it's not clear, I'm looking at you~~.

In Code

You can also use mktree in code. After installing it, you can require the cli file and call the run function.

Example:

const mktree = require('mktree/cli');
mktree.run(['structure.test.yml']);

Please, note that this function returns a Promise, so you may want to wrap them on async functions or resolve the promise.

Other features

Input from tree command

Sometimes you just happen to have the project structure and want to replicate it easily. With some tools you can easily see your directory structure as a tree. The following output is the output given with the usage of the tree command of lsd

Redux
├── Actions
│  └── GenericAction.js
├── Reducers
│  ├── GenericReducer.js
│  └── Reducers.js
└── Store
   └── DefaultStore.js

You can save it with lsd --tree src > structure.txt and then in your project just call mktree structure.txt.

The same rules of the yaml apply here, but unfortunately you won't be able to create boilerplates with content for your files if you chose this method.

Templating

What if you want to create a boilerplate with custom names? With mktree you can just use as many --var options as you need.

In your structure.yml file, where you want something to be replaced by variables just set it as $foo and call mktree as mktree structure.yml --var foo=bar. When the files are being created all occurences of $foo will be replaced by bar.

Please, note that this feature may change syntax in the future

Roadmap

  • Enable the definition of where the boilerplate must be created
  • Enable piping of stdin as input, making possible the usage of mktree such as tree src | mktree

License

MIT - see LICENSE