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

ts-prm

v1.0.1

Published

CLI application to manage dependencies required by typescript sub-projects in a main project package.json

Downloads

2

Readme

ts-prm: TypeScript Project Reference Merge

Build Status

This CLI application is a helper for TypeScript's project reference feature when using "sub-projects" (nested TypeScript projects). As of now, this is simply a proof of concept.

Why?

The overall idea is that subprojects should be independently developable by multiple developers (maybe the subprojects are git submodules). A current limitation with nested project references is that any reference to a dependency in a nested node_modules folder will not resolve once the TypeScript project is built.

Take the following example:

main-project
│   .tsprm.json
│   package.json
│   tsconfig.json
|   node_modules
├───build
│       index.js
├───src
│       index.ts
├───subproject1
|   |   node_modules
│   │   package.json
│   │   tsconfig.json
│   ├───src
│   └───test
├───subproject2
|   |   node_modules
│   │   package.json
│   │   tsconfig.json
│   ├───src
│   └───test
├───subproject3
|   |   node_modules
│   │   package.json
│   │   tsconfig.json
│   ├───src
│   └───test
└───test

subproject1, subproject2, and subproject3 are all independently developable. They have their own specified dependencies and devlopment dependencies, both of which can be found in their respective package.json files and node_module folders. They also have their own tests and can be independently built by TypeScript.

When building the project, a dist/ or build/ (or whatever you specify as the outDir in the top-level tsconfig.json) folder with the compiled JavaScript of all subprojects + the main project will be created. The JavaScript in the build folder is still referencing node_modules dependencies from the subprojects. The top level node_modules will not contain the subproject node_modules dependencies.

ts-prm tries to fix that issue by merging the dependencies and devDependencies fields of multiple subproject package.json files into a single top-level package.json file.

Installation

With npm:

npm install -g ts-prm

with yarn

yarn global add ts-prm

Configuration File

ts-prm depends on a configuration file that is placed in the root directory of your project. All paths within the configuration file will be relative to the configuration file. The ts-prm configuraiton file will specify the TypeScript subprojects. The TypeScript subprojects must contain a package.json and tsconfig.json file.

Example Configuration File

{
  "version": "1.0.0",
  "projects: [
    {
      "rootPath": "subproject1/"
    },
    {
      "rootPath": "subproject2/"
    },
    {
      "rootPath": "subproject3/"
    }
  ]
}

Usage

ts-prm merge

Merge the dependencies (and devDependencies) of one or more TypeScript project references into a single upper-level package.json file.

ts-prm merge

Merge the dependencies of one or more subprojects (TypeScript project
references) into a single top-level package.json file

Options:
      --help                  Show help                                [boolean]
      --version               Show version number                      [boolean]
  -c, --configFile, --config  The path to the ts-prm config file (.tsprm.json)
                                                                        [string]
  -i, --install               Install node dependencies after merging the
                              typescript submodules.  [boolean] [default: false]
      --skipDev               If true, development dependencies will not be
                              merged.                 [boolean] [default: false]
      --packageManager        The node_modules package manager to use for
                              dependency installation.
                             [string] [choices: "yarn", "npm"] [default: "yarn"]

ts-prm validate

Validate a ts-prm configuration file.

ts-prm validate

Validate a configuration file

Options:
      --help                  Show help                                [boolean]
      --version               Show version number                      [boolean]
  -c, --configFile, --config  The path to the ts-prm config file (.tsprm.json)
                                                                        [string]

TODO: complete this