Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to reproduce throng issues with ts-node and yarn workspaces #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion example.ts

This file was deleted.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"dependencies": {
"ts-node": "latest",
"typescript": "latest"
}
"version": "1.0.0",
"private": true,
"workspaces": [
"workspace-a"
]
}
3 changes: 2 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ n lts
yarn

# Run ts-node
yarn ts-node ./example.ts
yarn workspace workspace-a start
yarn workspace workspace-a start:throng

echo "Process exited with code: $?"
echo
Expand Down
17 changes: 17 additions & 0 deletions workspace-a/bin/example.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const throng = require('throng')

console.log('Launching exmple.ts')

if (process.env.USE_THRONG) {
throng({
worker: startServer,
count: 1
})
} else {
startServer()
}

function startServer() {
console.log('server starting')
}

15 changes: 15 additions & 0 deletions workspace-a/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "1.0.0",
"name": "workspace-a",
"private": true,
"scripts": {
"start": "TS_NODE_DEBUG=1 ts-node-transpile-only bin/example",
"start:throng": "TS_NODE_DEBUG=1 USE_THRONG=1 ts-node-transpile-only bin/example"
},
"dependencies": {
"@types/node": "^15.12.1",
"throng": "^5.0.0",
"ts-node": "latest",
"typescript": "latest"
}
}