Skip to content

Commit

Permalink
Merge pull request #52 from scramjetorg/feat/hello-world-ts
Browse files Browse the repository at this point in the history
hello world writen in ts
  • Loading branch information
a-tylenda committed May 24, 2023
2 parents f2f0163 + b08405d commit 8e3039e
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
24 changes: 24 additions & 0 deletions typescript/hello-world-ts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Hello world ts

Simple sequence that outputs "Hello world" written in typescript

## Running

Open the terminal and run the following commands:

```bash
# install dependencies
npm install

# transpile TS->JS to dist/
npm run build

# make a compressed package with Sequence
si seq pack dist

# send Sequence to transform hub, this will output Sequence ID
si seq send dist.tar.gz

# start a Sequence
si seq start -
```
15 changes: 15 additions & 0 deletions typescript/hello-world-ts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { PassThrough } from "stream";
import { ReadableApp } from "@scramjet/types";

const app: ReadableApp<any> = async function(_input) {
// create a clean output stream
const out = new PassThrough({ encoding: "utf-8" });

// write some data to the output stream
out.write("Hello World!");

// return the output stream so it can be consumed (e.g. by CLI client)
return out;
};

export default app;
26 changes: 26 additions & 0 deletions typescript/hello-world-ts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "hello-world-ts",
"version": "1.0.0",
"description": "Simple Sequence that prints out 'Hello World!' to the Instance output.",
"main": "index.js",
"scripts": {
"build": "tsc -p tsconfig.json",
"postbuild": "cp -r package.json dist/ && (cd dist && npm i --omit=dev)",
"clean": "rm -rf ./dist .bic_cache"
},
"keywords": [
"easy"
],
"engines": {
"node": ">=14"
},
"author": "piotrek6641",
"license": "ISC",
"devDependencies": {
"@scramjet/types": "^0.33.5",
"@types/node": "^20.2.3"
},
"dependencies": {
"typescript": "^5.0.4"
}
}
11 changes: 11 additions & 0 deletions typescript/hello-world-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"lib": [ "ESNext" ],
"target": "ESNext",
"module": "CommonJS",
"outDir": "./dist",
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true,
}
}

0 comments on commit 8e3039e

Please sign in to comment.