{"id":19437793,"url":"https://github.com/architect/plugin-typescript","last_synced_at":"2025-04-24T21:32:12.926Z","repository":{"id":42491382,"uuid":"449399443","full_name":"architect/plugin-typescript","owner":"architect","description":"TypeScript custom runtime + workflow integration for Architect","archived":false,"fork":false,"pushed_at":"2024-03-26T21:21:52.000Z","size":44,"stargazers_count":17,"open_issues_count":5,"forks_count":8,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-13T11:41:48.018Z","etag":null,"topics":["architect","aws-lambda","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@architect/plugin-typescript","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/architect.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":".github/contributing.md","funding":null,"license":null,"code_of_conduct":".github/code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-18T18:23:24.000Z","updated_at":"2025-01-12T12:22:32.000Z","dependencies_parsed_at":"2024-02-16T05:33:49.896Z","dependency_job_id":"11838263-5178-4af5-b784-8a4a1fb7969b","html_url":"https://github.com/architect/plugin-typescript","commit_stats":{"total_commits":37,"total_committers":6,"mean_commits":6.166666666666667,"dds":0.2702702702702703,"last_synced_commit":"a88a0be89444b3f07649280b21121250a1138529"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/architect%2Fplugin-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/architect%2Fplugin-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/architect%2Fplugin-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/architect%2Fplugin-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/architect","download_url":"https://codeload.github.com/architect/plugin-typescript/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250597735,"owners_count":21456426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["architect","aws-lambda","typescript"],"created_at":"2024-11-10T15:15:54.998Z","updated_at":"2025-04-24T21:32:12.671Z","avatar_url":"https://github.com/architect.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/architect/assets.arc.codes/raw/main/public/architect-logo-light-500b%402x.png\"\u003e\n  \u003cimg alt=\"Architect Logo\" width=\"500px\" src=\"https://github.com/architect/assets.arc.codes/raw/main/public/architect-logo-500b%402x.png\"\u003e\n\u003c/picture\u003e\n\u003c/p\u003e\n\n## [`@architect/plugin-typescript`](https://www.npmjs.com/package/@architect/plugin-typescript)\n\n\u003e TypeScript support and workflow integration for Architect\n\n[![GitHub CI status](https://github.com/architect/plugin-typescript/workflows/Node%20CI/badge.svg)](https://github.com/architect/plugin-typescript/actions?query=workflow%3A%22Node+CI%22)\n\n\n## Install\n\nInto your existing Architect project:\n\n```sh\nnpm i @architect/plugin-typescript --save-dev\n```\n\nAdd the following to your Architect project manifest (usually `app.arc`):\n\n```arc\n@aws\nruntime typescript # sets TS as the the default runtime for your entire project\n\n@plugins\narchitect/plugin-typescript\n```\n\nOr, if you'd prefer to add a single TS Lambda to start, forego the above `runtime typescript` setting in your project manifest, and add the following to a single Lambda:\n\n```arc\n# src/http/get-index/config.arc\n@aws\nruntime typescript\n```\n\n\n## Usage\n\nNow, simply author and port Lambdas in the `src` tree with `index.ts` handlers. For example:\n\n```ts\n// src/http/get-index/index.ts\nimport { Context, APIGatewayProxyResult, APIGatewayEvent } from 'aws-lambda'\n\nexport const handler = async (event: APIGatewayEvent, context: Context): Promise\u003cAPIGatewayProxyResult\u003e =\u003e {\n  console.log(`Event:`, event)\n  console.log(`Context:`, context)\n  return { statusCode: 200, body: JSON.stringify({ message: 'Hello world!' }) }\n}\n```\n\nThe above function will be automatically transpiled by Architect to `./.build/http/get-index.js`. (The destination build directory is configurable, [see below](#configuration).)\n\nWhen working locally, Sandbox automatically detects changes to your TypeScript handlers and re-transpiles them for you.\n\n\n## Configuration\n\n### `tsconfig.json`\n\nBy default, Architect TypeScript will pass your `tsconfig.json` along to the transpiler,[`esbuild`](https://esbuild.github.io/)[^1].\n\nIf you have a unique `tsconfig.json` file for a single Lambda (e.g. `src/http/get-index/tsconfig.json`), that will be given priority over your project-level TSConfig in the root of your project.\n\n\n### Project manifest settings\n\nThe following higher-level settings are also available in your Architect project manifest with the `@typescript` settings pragma:\n- `build` - customize the build directory; defaults to `.build`\n  - Note: make sure you add this directory to your `.gitignore`\n- `sourcemaps` - enable sourcemaps for Architect environments; defaults to `testing` + `staging`\n  - List of `testing`, `staging`, and/or `production` environment in which to add sourcemaps, or disable all sourcemaps with `false`\n  - We strongly advise you do not add sourcemaps to your `production` environment as it may have a meaningful impact on end-user performance and coldstart time\n- `esbuild-config` - add arbitrary [esbuild configuration](https://esbuild.github.io/api/) options\n  - Value is a relative path to a CJS file that exports an object of esbuild options; these options will be passed to the build\n  - Any options that conflict with this plugin's defaults will be ignored\n- `base-runtime` - set a different base Node.js version; defaults to `nodejs20.x`\n  - See [the list of Lambda-supported Node runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html)\n\nExample:\n\n```arc\n@typescript\n# Build into `./dist`\nbuild dist\n\n# Disable sourcemaps in `staging`, but add them to `production`; you probably shouldn't actually do this though\nsourcemaps testing production\n\n# Add esbuild plugins\nesbuild-config esbuild-config.js\n\n# Set the Lambda base runtime to Node.js 18\nbase-runtime nodejs18.x\n```\n\n\n## Caveats\n\nArchitect TypeScript, which uses [`esbuild`](https://esbuild.github.io/), bundles to CommonJS to avoid issues surrounding [transpiling to ESM with second-order dynamic requires](https://github.com/evanw/esbuild/issues/1921). However, due to ongoing [issues surrounding top-level await in esbuild, TypeScript, V8, etc.](https://github.com/evanw/esbuild/issues/253), top-level await is not yet supported.\n\nIf you need top-level await, we suggest authoring in plain JavaScript for the time being.\n\n\n[^1]: Head here for more information about [how `esbuild` makes use of TSConfig](https://esbuild.github.io/api/#tsconfig)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchitect%2Fplugin-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farchitect%2Fplugin-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchitect%2Fplugin-typescript/lists"}