# @lekko/ts-transformer

> TypeScript transformer for Lekko config definitions

Latest version **0.2.3** (published 2024-07-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @lekko/ts-transformer
pnpm add @lekko/ts-transformer
yarn add @lekko/ts-transformer
bun add @lekko/ts-transformer
```

Provides the commands `ts-to-proto`, `lekko-repo-pull`, `lekko-repo-sync`.

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.3 |
| Published | 2024-07-22 |
| First published | 2024-03-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 181 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | passichenko, lekko_jonathan, davidsgk, konradlekko |
| Keywords | lekko, typescript, ts |

## Links

- npm: https://www.npmjs.com/package/@lekko/ts-transformer
- Repository: https://github.com/lekkodev/ts-tools
- Homepage: https://github.com/lekkodev/ts-tools#readme
- Issues: https://github.com/lekkodev/ts-tools/issues
- npm.io page: https://npm.io/package/@lekko/ts-transformer

## Dependencies (12)

- [yaml](https://npm.io/package/yaml.md) ^2.4.5
- [tslib](https://npm.io/package/tslib.md) ^2.6.2
- [rimraf](https://npm.io/package/rimraf.md) ^5.0.5
- [prettier](https://npm.io/package/prettier.md) ^3.2.5
- [ts-patch](https://npm.io/package/ts-patch.md) ^3.1.2
- [commander](https://npm.io/package/commander.md) ^12.0.0
- [typescript](https://npm.io/package/typescript.md) ~5.4.0
- [lodash.camelcase](https://npm.io/package/lodash.camelcase.md) ^4.3.0
- [lodash.kebabcase](https://npm.io/package/lodash.kebabcase.md) ^4.1.1
- [lodash.snakecase](https://npm.io/package/lodash.snakecase.md) ^4.1.1
- [lodash.upperfirst](https://npm.io/package/lodash.upperfirst.md) ^4.3.1
- [@commander-js/extra-typings](https://npm.io/package/@commander-js/extra-typings.md) ^12.0.1

## Alternatives

- [csv-to-markdown-table](https://npm.io/package/csv-to-markdown-table.md) — 47.0K weekly downloads
- [@sapphire/ratelimits](https://npm.io/package/@sapphire/ratelimits.md) — 4.4K weekly downloads
- [js-csvparser](https://npm.io/package/js-csvparser.md) — 2.0K weekly downloads
- [@adadapted/js-sdk](https://npm.io/package/@adadapted/js-sdk.md) — 251 weekly downloads
- [@grapecity/spread-sheets-sparklines](https://npm.io/package/@grapecity/spread-sheets-sparklines.md) — 103 weekly downloads

## Recent versions

- 0.2.3 (latest) — 2024-07-22
- 0.3.0-beta.3 (beta) — 2024-10-22
- 0.3.0-beta.2 — 2024-10-21
- 0.3.0-beta.1 — 2024-09-27
- 0.2.2 — 2024-07-18
- 0.2.2-beta.1 — 2024-07-16
- 0.2.1 — 2024-07-16
- 0.2.1-beta.2 — 2024-07-11
- 0.2.1-beta.1 — 2024-07-11
- 0.2.0 — 2024-07-10
- 0.2.0-beta.1 — 2024-07-05
- 0.1.0-beta.4 — 2024-07-03
- 0.1.0-beta.3 — 2024-07-02
- 0.1.0-beta.2 — 2024-07-02
- 0.1.0-beta.1 — 2024-07-01
- … 27 more at https://npm.io/package/@lekko/ts-transformer/versions

## README

# @lekko/ts-tools

## Requirements

An up-to-date version of the Lekko CLI installed on the system is required for most of this library's components for translating changes in TypeScript files to local config repos.

```bash
brew tap lekkodev/lekko
brew install lekko
```

## Packages

### @lekko/ts-transformer

Installation

```bash
npm install -D @lekko/ts-transformer
```

Usage

In `tsconfig.json`:

```json
{
  ...
  "compilerOptions": {
    ...
    "plugins": [
      { "transform": "@lekko/ts-transformer", "transformProgram": true }
    ]
  }
}
```

Then use with `tspc`

### @lekko/vite-plugin

Installation

```
npm install -D @lekko/vite-plugin
```

Usage

In `vite.config.js`:

```typescript
import lekko from "@lekko/vite-plugin";

export default defineConfig({
  plugins: [lekko(), react()],
  ...
});
```

## TODOs

### Full ruleslang

Other comparison operators, bucketing, etc.

### Automatic install script

Especially for Node projects, we should provide an automatic install script that updates users' `tsconfig.json`, `package.json`, etc. in one command.

### E2E tests

- Make the transformer testable, which also benefits "documenting" known, supported native lang syntaxes and different tsconfig options.
- Testing setup can remove dependency on CLIs and filesystem (but could start with them)
- In the long term with support for other languages we probably want a full conformance testing suite

### Performance

The end-to-end program transformation is quite slow at the moment and noticeably increases build times e.g. when using the Vite plugin. We should profile/benchmark this, but a few intuitive potential improvements:

- We make a lot of calls to executables e.g. Lekko CLI, Buf CLI
  - Especially for Lekko CLI, we should try to implement batch commands that can e.g. generate starlark for all configs in one go
  - We should investigate if we can call Buf's ES protoc plugin as a library rather than via the CLI
- We make a lot of synchronous fs I/O calls
  - See if there's things we can do virtually
  - See if we can refactor to be able to take advantage of async fs APIs
- For bundler plugins, we might want to look at implementing a watcher that can handle incremental changes instead of dealing with the whole transformed program on each build.

### HMR support

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