Skip to content

Instantly share code, notes, and snippets.

@webstrand
Last active September 23, 2020 22:14
Show Gist options
  • Select an option

  • Save webstrand/689a8f17ac0938bdea87a0bd7fd10deb to your computer and use it in GitHub Desktop.

Select an option

Save webstrand/689a8f17ac0938bdea87a0bd7fd10deb to your computer and use it in GitHub Desktop.
Scriptisto example for running a typescript/node script
#!/usr/bin/env scriptisto
(await import("source-map-support")).default.install();
import * as fs from "fs";
fs.writeFileSync("/dev/stderr", "hello world!\n");
// scriptisto-begin
// script_src: main.ts
// build_once_cmd: npm install
// build_cmd: npx tsc -p .
// target_bin: main.js
// target_interpreter: >-
// /usr/bin/env node --experimental-specifier-resolution=node
// files:
// - path: package.json
// content: |
// {"type": "module", "dependencies": {
// "typescript": "^4.0.3",
// "source-map-support": "^0.5.19",
// "@types/source-map-support": "^0.5.3",
// "@types/node": "^13.13.0"
// }}
// - path: tsconfig.json
// content: |
// {"compilerOptions": {
// "allowSyntheticDefaultImports": true,
// "module": "ESNext",
// "moduleResolution": "node",
// "sourceMap": true,
// "strict": true,
// "target": "ES2019"
// }}
// scriptisto-end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment