fix(docs): Update README with expanded docs and examples; add pnpm and CI tooling configs

This commit is contained in:
2025-10-13 21:28:27 +00:00
parent 2bba5f75e6
commit 4cd8bf5c1a
8 changed files with 4294 additions and 812 deletions

186
readme.md
View File

@@ -1,50 +1,172 @@
# @gitzone/tsrun
# @git.zone/tsrun
run typescript programs efficiently
> Run TypeScript files instantly, without the compilation hassle ⚡
## Availabililty and Links
Execute TypeScript programs on-the-fly with zero configuration. Perfect for scripts, prototyping, and development workflows.
- [npmjs.org (npm package)](https://www.npmjs.com/package/@gitzone/tsrun)
- [gitlab.com (source)](https://gitlab.com/gitzone/tsrun)
- [github.com (source mirror)](https://github.com/gitzone/tsrun)
- [docs (typedoc)](https://gitzone.gitlab.io/tsrun/)
## What is tsrun?
## Status for master
**tsrun** is a lightweight TypeScript execution tool that lets you run `.ts` files directly—no build step required. It's like running JavaScript with `node`, but for TypeScript. Under the hood, tsrun uses [tsx](https://github.com/esbuild-kit/tsx) for lightning-fast execution while keeping your workflow simple and efficient.
| Status Category | Status Badge |
| ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| GitLab Pipelines | [![pipeline status](https://gitlab.com/gitzone/tsrun/badges/master/pipeline.svg)](https://lossless.cloud) |
| GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/gitzone/tsrun/badges/master/coverage.svg)](https://lossless.cloud) |
| npm | [![npm downloads per month](https://badgen.net/npm/dy/@gitzone/tsrun)](https://lossless.cloud) |
| Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/gitzone/tsrun)](https://lossless.cloud) |
| TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud) |
| node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) |
| Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) |
| PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@gitzone/tsrun)](https://lossless.cloud) |
| PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@gitzone/tsrun)](https://lossless.cloud) |
| BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@gitzone/tsrun)](https://lossless.cloud) |
## Installation
```bash
npm install -g @git.zone/tsrun
```
Or as a project dependency:
```bash
npm install --save-dev @git.zone/tsrun
```
## Usage
Use TypeScript for best in class instellisense.
### 🚀 CLI Usage
To simply run a TypeScript file on the fly type
Simply run any TypeScript file:
```typescript
tsrun myfiletorun.ts
```bash
tsrun myScript.ts
```
There are options available:
Pass arguments to your script transparently:
- `--web` will inject browser types. this is useful when testing code with polyfills on node, but that is meant for the browser later on.
```bash
tsrun myScript.ts --config production --verbose
```
## Contribution
All arguments are passed through to your TypeScript program, just as if you were running it with `node`.
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
### 💻 Programmatic API
For further information read the linked docs at the top of this readme.
Import tsrun in your code for dynamic TypeScript execution:
## Legal
```typescript
import { runPath, runCli } from '@git.zone/tsrun';
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
// Run a TypeScript file from an absolute or relative path
await runPath('./scripts/myScript.ts');
// Run with path resolution relative to a file URL
await runPath('./myScript.ts', import.meta.url);
// Run in CLI mode programmatically (respects process.argv)
await runCli('./myScript.ts');
```
## Features
**Zero Configuration** - Just point and shoot. No tsconfig tweaking required.
**Fast Execution** - Powered by tsx for near-instant TypeScript execution.
🔄 **Transparent Arguments** - Command line arguments pass through seamlessly to your scripts.
📦 **Dual Interface** - Use as a CLI tool or import as a library in your code.
🎯 **TypeScript Native** - Full TypeScript support with excellent IntelliSense.
## Why tsrun?
Sometimes you just want to run a TypeScript file without setting up a build pipeline, configuring webpack, or waiting for `tsc` to compile. That's where tsrun shines:
- **Quick Scripts**: Write and run TypeScript scripts as easily as bash scripts
- **Prototyping**: Test ideas without project setup overhead
- **Development Workflows**: Integrate TypeScript execution into your tooling
- **CI/CD**: Run TypeScript-based build scripts without pre-compilation
## Examples
### Simple Script
```typescript
// hello.ts
console.log('Hello from TypeScript! 🎉');
const greet = (name: string): string => {
return `Welcome, ${name}!`;
};
console.log(greet('Developer'));
```
Run it:
```bash
tsrun hello.ts
# Output:
# Hello from TypeScript! 🎉
# Welcome, Developer!
```
### With Command Line Arguments
```typescript
// deploy.ts
const environment = process.argv[2] || 'development';
const verbose = process.argv.includes('--verbose');
console.log(`Deploying to ${environment}...`);
if (verbose) {
console.log('Verbose mode enabled');
}
```
Run it:
```bash
tsrun deploy.ts production --verbose
# Output:
# Deploying to production...
# Verbose mode enabled
```
### Programmatic Execution
```typescript
// runner.ts
import { runPath } from '@git.zone/tsrun';
const scripts = [
'./scripts/setup.ts',
'./scripts/migrate.ts',
'./scripts/seed.ts'
];
for (const script of scripts) {
console.log(`Running ${script}...`);
await runPath(script, import.meta.url);
console.log(`✓ ${script} completed`);
}
```
## Package Information
- **npmjs**: [@git.zone/tsrun](https://www.npmjs.com/package/@git.zone/tsrun)
- **Source**: [git.zone](https://git.zone/lossless/tsrun) | [GitLab Mirror](https://gitlab.com/gitzone/tsrun) | [GitHub Mirror](https://github.com/gitzone/tsrun)
- **Documentation**: [TypeDoc](https://gitzone.gitlab.io/tsrun/)
## Requirements
- **Node.js**: >= 16.x
- **TypeScript**: >= 3.x (automatically handled by tsx)
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.