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

@arondilbe/monorepo-package-generator

v2.1.1

Published

The package 'monorepo-package-generator' goal is to provide an easy to use tool to generate packages for monorepo. The generated packages are based on sample files and folders.

Downloads

1,051

Readme

@arondilbe/monorepo-package-generator

Table of Contents

About @arondilbe/monorepo-package-generator

The main goal of @arondilbe/monorepo-package-generator is to provide a easy to use tool to generate packages for mono-repositories.

How does it work ?

The monorepo package generator use sample files and a small configuration to create new packages. It allows the user to generate packages based on some common files which will be used for all new packages and also some specific ones which will be added only if the package to create is from a certain type.

Adding the configuration

In order to use the command, you'll also need a .json configuration file containing some information:

{
  "destinationFolderPath": "./packages",
  "sampleFilesFolderPath": "./sampleFilesExample",
  "libraryName": "@arondilbe",
  "packageTypes": {
    "mainFolder": "packageTypes",
    "types": {
      "content": "content",
      "util": "util"
    }
  }
}

Note that the packageTypes property is optional. If not defined, all files will be copied for all new packages.

  • destinationFolderPath: string The path to the folder were the new packages will be created

  • sampleFilesFolderPath: string The path to the folder containing the files used as models for the new packages

  • libraryName: string A common part to be put before the package name in the package.json file

  • packageTypes: An object containing information about the package types:

    • mainFolder: string The name of the folder containing all the package type folders
    • types: Record<string,string>: An object containing pairs key/value pairs. The key is the package type and the value is the folder name. For instance if you have a package type named util which has its files contained in the folder utilPackage (the folder should be in the sample files folder), you'll have:
    "packageTypes": {
      "mainFolder": "packageTypes",
      "types": {
        "content": "content",
        "util": "util"
      }
    }

How to use the package generation command ?

To launch the package generation you can call the command generatePackage generate-package:

npm generatePackage generate-package --config pathToTheConfigFile
yarn generatePackage generate-package --config pathToTheConfigFile

Setting the package parameters

By using some command parameters you can define three settings for your package:

  • The name: --name The name of your package (mandatory)
  • The type: --type The type of your package (optional). The value should be one of the keys defined in packageTypes
  • The version: --packageVersion: The version of the package (optional)
yarn generatePackage generate-package --config pathToTheConfigFile --name newPackage --type myPackageType --packageVersion 0.10

For more information you check the command help by using the parameter --help:

yarn generatePackage generate-package --help

If you want more feedbacks during the package generation you can use the parameter --verbose:

yarn generatePackage generate-package --config pathToTheConfigFile --name newPackage --type myPackageType --packageVersion 0.10 --verbose

It will then return a information message after each step of the package generation.

Breakthrough

The package generation starts when you enter the command. It will then create a new folder with the name you gave and at the destination folder defined in the configuration file.

After that it will copy all common files (or all files if you didn't defined any package type ).

If you defined some package types and you specified the type of the new package it will also copy all files contained in the given package type folder. If some files with the same name and at the same final location exist for both common and specific files, the specific ones will replace the common ones.

If your new package contains a package.json file it will modify the package name and the package version (if you provided one in the command).