-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add some hello world examples
Fixes #203 Signed-off-by: Gordon Smith <[email protected]>
- Loading branch information
1 parent
bd41149
commit 69a9dcf
Showing
12 changed files
with
793 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Hello World Example - CommonJS | ||
|
||
This example shows how to use the `@hpcc-js/wasm` package within a legacy commonjs TypeScript project. | ||
|
||
## Steps to build and test | ||
|
||
1. Install dependencies | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
2. Build the project | ||
|
||
```bash | ||
npm run build | ||
``` | ||
|
||
3. Execute in Node | ||
|
||
```bash | ||
node index.js | ||
``` | ||
|
||
## How this project was created | ||
|
||
1. Create a generic typescript project | ||
|
||
```bash | ||
mkdir hello-world | ||
cd hello-world | ||
npm init -y | ||
npm install --save-dev typescript | ||
npm install --save @types/node | ||
npx tsc --init | ||
``` | ||
|
||
2. Edit package.json | ||
|
||
```json | ||
{ | ||
... | ||
"scripts": { | ||
"build": "tsc -p tsconfig.json", | ||
"test": "npm run build && node ." | ||
}, | ||
... | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
async function render() { | ||
const { Graphviz } = await import("@hpcc-js/wasm"); | ||
const graphviz = await Graphviz.load(); | ||
console.log(graphviz.dot('digraph G { Hello -> World }')); | ||
} | ||
|
||
render(); |
204 changes: 204 additions & 0 deletions
204
examples/typescript/hello-world/commonjs/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "commonjs", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "tsc -p tsconfig.json", | ||
"test": "npm run build && node ." | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@hpcc-js/wasm": "^2.15.0" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^5.3.3" | ||
} | ||
} |
Oops, something went wrong.