RudderTyper v1 Command Reference
- free
- growth
- enterprise
4 minute read
RudderTyper v1 (npm) is in maintenance mode and will not receive any new features.
For TypeScript, Kotlin, and Swift support, use RudderTyper v2.
Commands
| Command | Description |
|---|---|
Initialize$ npx rudder-typer init | Initializes RudderTyper with a quickstart guide to generate your RudderTyper client . |
Help$ npx rudder-typer help | Prints the help message describing different commands available with RudderTyper. |
Update plan$ npx rudder-typer update | u | * (default) | Syncs plan.json with RudderStack to pull the latest changes from your Tracking Plan and generates an updated development client. |
Build development client$ npx rudder-typer build | b | d | dev | development | Generates a development client from plan.json with runtime validation. |
Build production client$ npx rudder-typer prod | p | production | Generates a production client from plan.json without runtime validation . |
Print token configuration$ npx rudder-typer token | tokens | t | Prints the local RudderStack API token configuration. |
Print RudderTyper version$ npx rudder-typer version | Prints the RudderTyper CLI version. |
CLI arguments
Run the help command (npx rudder-typer help) to get the below list of CLI arguments that you can use with RudderTyper:
| Argument | Description |
|---|---|
config | Optional path to a ruddertyper.yml (or a directory with ruddertyper.yml). |
debug | Optional (hidden) flag to turn on/off debug mode. |
version / v | Prints the RudderTyper CLI version. |
help / h | Prints help on a command. |
RudderTyper modes
RudderTyper operates in two distinct modes: Development and Production mode. Each mode serves a specific purpose in the analytics implementation workflow. By utilizing the required mode, you can streamline the process of implementing and managing analytics with RudderTyper.
Development mode
This mode is designed to facilitate testing and validating your changes before the events go live.
This mode is suitable for local development and debugging and helps you:
- Validate the JSON schema to ensure correctness.
- Verify the tracking events against the defined Tracking Plan.
- Include additional validation logic to catch potential errors early.
Production mode
This mode is optimized for deployment and ensures seamless event tracking in live environments.
This mode is suitable for staging and production environments and helps you:
- Generate production-ready, optimized code.
- Adhere strictly to the validated schema to maintain consistency.
- Remove unnecessary validation and debugging logic for efficiency.
Configuration reference
RudderTyper stores its configuration in a ruddertyper.yml file in the root of your repository.
A sample configuration looks like the following:
# RudderStack RudderTyper configuration reference (https://github.com/rudderlabs/rudder-typer)
# Run `npx rudder-typer` to regenerate a client with the latest versions of these events.
scripts:
# You can supply a RudderStack service access token using a `scripts.token` command. The output of `script.token` command should be a valid RudderStack API token.
token: source .env; echo $RUDDERTYPER_TOKEN
# You can supply the email address linked to your workspace using a `scripts.email` command.The output of `script.email` command should be an email address registered with your workspace.
email: source .env; echo $EMAIL
# You can format any of RudderTyper's auto-generated files using a `scripts.after` command.
# See `Formatting Generated Files` below.
after: ./node_modules/.bin/prettier --write analytics/plan.json
client:
# The RudderStack SDK you are generating the client for
# Valid values: analytics.js, analytics-node, analytics-ios, analytics-android.
sdk: analytics.js
# The target language for your RudderTyper client.
# Valid values: javascript, typescript, objective-c, swift, java.
language: typescript
# JavaScript Transpilation Settings
# Valid values: 'ES3','ES5','ES2015','ES2016','ES2017','ES2018','ES2019','ESNext','Latest'
scriptTarget: "ES5"
# Valid values: 'CommonJS','AMD','UMD','System','ES2015','ESNext'
moduleTarget: "ESNext"
trackingPlans:
# The RudderStack Tracking Plan that you are generating a client for.
# Provide your workspace slug and Tracking Plan id
# You also need to supply a path to a directory to save your RudderTyper client.
- id: <TRACKING_PLAN_ID>
workspaceSlug: rudderstack-demo
path: ./analytics
# Valid values: v1 (old Tracking Plan), v2 (new Tracking Plan format)
APIVersion: v2Note the following:
- Store
tokenandemailin a.envfile created in the same directory asruddertyper.ymlto ensure the scripts automatically use these values. A sample.envfile is shown below:
RUDDERTYPER_TOKEN=<SERVICE_ACCESS_TOKEN>
EMAIL=<EMAIL_ADDRESS>- You can get the
idfield by going to the Tracking Plan in the RudderStack dashboard. For example,https://app.rudderstack.com/trackingPlans/<TRACKING_PLAN_ID>.
See more
- RudderTyper v1: What v1 generates, and how validation works
- RudderTyper v1 Quickstart: Generate a client and connect it to an SDK
- RudderTyper v2 Command Reference:
rudder-cli typercommands and flags