🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@goldstack/utils-typescript-references

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@goldstack/utils-typescript-references

Utility for keeping TypeScript references in sync in the monorepo

0.1.6
Source
npm
Version published
Weekly downloads
2.4K
11.66%
Maintainers
1
Weekly downloads
 
Created
Source

TypeScript References Yarn Workspaces Sync Utility

This library ensures that project references in TypeScript tsconfig.js files are automatically kept up to date in a project using Yarn 2 workspaces.

Running this script will:

  • Add a list of all packages in the workspaces to the root tsconfig.json for the "references" attribute:
 "references": [
    {
      "path": "workspaces/apps"
    },
    {
      "path": "workspaces/docs"
    },
    {
      "path": "workspaces/templates"
    },
    {
      "path": "workspaces/templates-lib"
    }]
  }
  • Update all the "references" in the tsconfig.json for all packages in the workspace so that it includes all the packages that it declares as a dependency in package.json.

This package uses @monorepo-utils/workspaces-to-typescript-project-references.

Usage

Install as development dependency using

npm i @goldstack/utils-typescript-references --save-dev
-- or
yarn add -D @goldstack/utils-typescript-references

Add a script to your package.json

{
  "scripts": {
    "fix-typescript-references": "utils-typescript-references"
  }
}

Run the script using

npm run fix-typescript-references
-- or
yarn fix-typescript-references

Options

The following parameters can be passed when invoking the script:

utils-typescript-references --skipPackages

Will skip updating the references in tsconfig.json files for all packages in the project.

utils-typescript-references --skipRoot

Will skip updating the references in the tsconfig.json file for the project root.

Limitations

  • The root of the project and each workspace must contain a tsconfig.json. It is currently not able to specify an alternative file name for tsconfig.json.
  • The root tsconfig.json file needs to be a vanilla JSON document (so no comments)

If these limitations or anything else are an issues, please raise a ticket in GitHub for the Goldstack Monorepo.

See Also

Keywords

goldstack

FAQs

Package last updated on 24 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts