Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@naturalcycles/linked

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@naturalcycles/linked

> `npm link` for TypeScript projects.

  • 1.1.3
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
3
Weekly downloads
 
Created
Source

@naturalcycles/linked

npm link for TypeScript projects.

npm code style: prettier

Problem

npm link is good, but TypeScript projects require a build step (transpilation from *.ts to *.js), otherwise your project will use stale *.js files.

Running compile/watch in a separate terminal is an extra step, which may fail and again result in stale .js file being used. One terminal window with watcher needed for each linked project.

Problem 2

Sometimes you want to create a universal module, to be consumed by both Node and Browser.

You will have a hard choice to define a tsconfig compilation target.

For Node you want it high, e.g es2018. You don't want to transpile down e.g async/await, cause it creates weird stacktraces, compared to native stacktraces with es2018.

For Browser you want to be safe and transpile down to es2015 or even es5 (really?). This means, e.g transpiling down async/await and getting weird stacktraces in Node as a result.

Isn't it better if you can just publish source files (*.ts in this case) and let the target project decide how to transpile it?

Solution

You may have your dependencies in 2 modes:

  • unlinked mode (default)
  • linked mode (similar to npm link)

Projects are installed under /src/@linked.

In linked mode - symlink is created from the source dir of your project (e.g ../../SomeProject).

In unlinked mode - files are copied from node_modules/SomeProject.

API

yarn linked - enable linked mode

yarn unlinked - disable linked mode

yarn linked postinstall - needs to be called in your project's postinstall AND after each yarn upgrade of linked project.

Keywords

FAQs

Package last updated on 16 Aug 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc