go-tspath

command module
Version: v1.0.0-beta.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2019 License: Apache-2.0, MIT Imports: 1 Imported by: 0

README

Go TSPath Build Status codecov Go Report Card GoDoc

A fast Typescript paths replacer written in Go. ⚡

go-tspath replaces directly Typescript paths aliases into JS files with real paths based on tsconfig.json, no more runtime replacers.

go-tspath performing replacements in a production Typescript code base

Screenshot of go-tspath performing replacements in a Typescript code base project with more than 200 JS files and around 5857 lines of code.

Status

go-tspath was tested replacing custom path aliases in a Typescript medium size project with desired results (shown in screenshot above). But there are some features and more testing cases (community user feedback) to do. So, It can considered as Beta yet. Contributions will be very appreciated.

Installation

🚀 Download the latest go-tspath binary for your specific platform at go-tspath/releases.

Usage

# 1. Build TS files via tsc
# 2. Replace TS paths
go-tspath -config=./tsconfig.replace.json
# 3. Just run your app
# node main.js

Known limitations

  • No support for JSON5 format of tsconfig.json. But works using a dedicated tsconfig.json file with your custom path aliases. See sample/tsconfig.replace.json
  • Limited compilerOptions settings. Only baseUrl, paths and outDir are supported. See CompilerOptions struct.
  • No support for tsconfig.json features like extends, exclude or similar.

Typescript code example

See an example at sample directory.

API

~> go-tspath --help
Usage of go-tspath:
  -config string
    	Specifies the Typescript configuration file. (default "./tsconfig.json")

Contributions

Feel free to send some Pull request or issue.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Documentation

Overview

Command go-tspath is entry point to replace Typescript paths

Source Files

Directories

Path Synopsis
Package cmd process command line arguments
Package cmd process command line arguments
pkg
replacer
Package replacer replaces every TS path alias occurrence per file using a tsconfig.json
Package replacer replaces every TS path alias occurrence per file using a tsconfig.json
tsconfig
Package tsconfig reads a tsconfig.json content
Package tsconfig reads a tsconfig.json content

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL