Socket
Socket
Sign inDemoInstall

to-esm-imports

Package Overview
Dependencies
18
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    to-esm-imports

Migrate typescript files to ESM style of import (with .js extension)


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

to-esm-imports

  • Simple script for transforming relative file imports to ESM-conformant ones (i.e. link to actual file with .js extension)
  • Works with TypeScript source files (.ts extension)
  • Can be used to transform single file or entire directory (recursively).
  • Will ignore dirs from local .gitignore (run this tool from project root).
  • Used to transform https://github.com/hyperledger/cacti sources (where other solutions failed), not tested on other repos (feel free to file an issue if more cases must be handled).
  • Tested on Linux only!

Usage


# Show help
to-esm-imports -h

# Convert local repository
to-esm-imports .

# Convert single file
to-esm-imports ./src/foo/bar.ts

# Use different logLevel
to-esm-imports --logLevel warn .

Build and install locally

npm install
npm run build
npm install -g .
# to-esm-imports CLI should be available

Keywords

FAQs

Last updated on 09 Feb 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc