Open plinto
Docs›Languages

TypeScript and Node

Language·3 min read
In one sentence

NodeBuild compiles TypeScript with tsc, tests it with Node's own test runner, and lays out node_modules itself from what your group pins.

Build systemNodeBuild
Start oneplinto create node-service HelloNode (or node-lib)
Ships asa package, or an archive with its own Node

The project

Code and tests are in src/, tests as *.test.ts files next to the code. A library starts at src/index.ts, and a program at the file its main names; a project can be both. plinto writes package.json and tsconfig.json for the build, so you don't.

plinto.conf
{
  name = HelloNode
  version = 1.0
  build = NodeBuild
  # main = src/main.ts   a program: what `plinto run` starts

  build-dependencies: {
    NodeBuild = 1.0
    Node = 24
    TypeScript = 7
    TypesNode = 24
  }
  dependencies: {
    Picocolors = 1.1.1   # from npm
  }
}

Settings

A program's main and args are in plinto.conf, as in every language. NodeBuild's settings are sections of it:

Section What it does
run: { node-options = [...] } what plinto run passes to Node
typescript: { target, lib, jsx, compiler-options } what tsc compiles for

Libraries

npm packages come in through an import. Their install scripts never run, and each one is checked against the registry's integrity hash.

$ plinto import npm picocolors@1.1.1

What it releases

A package, HelloNode-1.0.tgz, and for a program an archive with the app and its platform's Node.