# tscpaths

> Replace absolute paths to relative paths after typescript compilation

Latest version **0.0.9** (published 2019-05-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install tscpaths
pnpm add tscpaths
yarn add tscpaths
bun add tscpaths
```

Provides the command `tscpaths`.

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2019-05-09 |
| First published | 2018-08-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 40.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 266 |
| Author | Joon Ho Cho |
| Maintainers | joonhocho |
| Keywords | typescript, paths, alias, absolute path, relative path, compilation, tsc |

## Links

- npm: https://www.npmjs.com/package/tscpaths
- Repository: https://github.com/joonhocho/tscpaths
- Homepage: https://github.com/joonhocho/tscpaths#readme
- Issues: https://github.com/joonhocho/tscpaths/issues
- npm.io page: https://npm.io/package/tscpaths

## Dependencies (2)

- [globby](https://npm.io/package/globby.md) ^9.2.0
- [commander](https://npm.io/package/commander.md) ^2.20.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.0.9 (latest) — 2019-05-09
- 0.0.8 — 2019-05-09
- 0.0.7 — 2019-03-27
- 0.0.6 — 2018-10-14
- 0.0.5 — 2018-09-30
- 0.0.4 — 2018-09-30
- 0.0.3 — 2018-08-27
- 0.0.2 — 2018-08-27
- 0.0.1 — 2018-08-24

## README

# tscpaths
Replace absolute paths to relative paths after typescript compilation (tsc) during compile-time.

[![npm version](https://badge.fury.io/js/tscpaths.svg)](https://badge.fury.io/js/tscpaths)
[![Dependency Status](https://david-dm.org/joonhocho/tscpaths.svg)](https://david-dm.org/joonhocho/tscpaths)
[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)

## Comparison to [tsconfig-paths](https://github.com/dividab/tsconfig-paths)
\+ Compile time (no runtime dependencies)

## Getting Started
First, install tscpaths as devDependency using npm or yarn.

```sh
npm install --save-dev tscpaths
# or
yarn add -D tscpaths
```

## Add it to your build scripts in package.json
```json
"scripts": {
  "build": "tsc --project tsconfig.json && tscpaths -p tsconfig.json -s ./src -o ./out",
}
```

### Options
| flag         | description                                        |
| ------------ | -------------------------------------------------- |
| -p --project | project configuration file (tsconfig.json)         |
| -s --src     | source code root directory                         |
| -o --out     | output directory of transpiled code (tsc --outDir) |

You need to provide -s (--src) and -o (--out), because it's hard to predict source and output paths based on tsconfig.json.

I've tried a little and failed. :(

`tsc` does some magic to determine source and output paths and I haven't dived too deep to mimic it.

For now, it's simpler to provide the paths manually.

If you know how, Pull Requests are welcome!


# Disclaimer !!!!!
This is not a mature project yet.

It works for my setup so far.

It may not work correctly if your setup is too complicated, so please do some testing before pushing it to production!!!

---
_Source: https://npm.io/package/tscpaths · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
