A fast and persistent Typescript paths replacer written in Go. :zap:
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Jose Quintana 4aa02f6db1
fix: remove travis go version 1.12.x
1 month ago
.vscode init 6 months ago
cmd fix: prealocate replacements slice 1 month ago
pkg fix: prealocate replacements slice 1 month ago
sample chore: add testing 3 months ago
.drone.yml chore: add platform in ci pipeline config 1 month ago
.gitignore chore: add testing 3 months ago
.goreleaser.yaml feat: add drone support (#11) 1 month ago
.travis.yml fix: remove travis go version 1.12.x 1 month ago
LICENSE-APACHE feat: add drone support (#11) 1 month ago
LICENSE-MIT feat: add drone support (#11) 1 month ago
Makefile chore: extend GOPROXY list 1 month ago
README.md docs: update license section 1 month ago
go-tspath.go docs: add package docs 3 months ago
go.mod chore: add lint support 1 month ago
go.sum chore: update redel dependency to v3.0.0 3 months ago
preview.png docs: improve project description and status 3 months ago
refresh.yaml chore: update development tooling 4 months ago

README.md

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

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

Feel free to send some Pull request or issue.

License

This work is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

© 2019 Jose Quintana