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
Update examples/with-temporal #33674
Changes from 5 commits
58fc36e
85b7193
0a801ee
42dd292
224780d
e312a1b
9820d96
76f34ba
1735149
9d8a690
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.next/ | ||
lib/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't want to include prettier in examples by default, can we remove this? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,23 +5,42 @@ | |
"build": "next build", | ||
"start": "next start", | ||
"type-check": "tsc", | ||
"build-worker": "tsc --build temporal/src/worker/tsconfig.json", | ||
"build-worker.watch": "tsc --build --watch temporal/src/worker/tsconfig.json", | ||
"start-worker": "nodemon -w temporal/lib/ -x 'node temporal/lib/worker || (sleep 5; touch temporal/lib/worker/index.js)'" | ||
"build:worker": "tsc --build temporal/tsconfig.json", | ||
"build:worker.watch": "tsc --build --watch temporal/tsconfig.json", | ||
"start:worker": "cross-env TS_NODE_PROJECT=\"temporal/tsconfig.json\" node --loader ts-node/esm temporal/src/worker.ts", | ||
"start:worker.watch": "cross-env TS_NODE_PROJECT=\"temporal/tsconfig.json\" nodemon temporal/src/worker.ts" | ||
}, | ||
"dependencies": { | ||
"next": "latest", | ||
"node-fetch": "^3.0.0", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"temporalio": "^0.3.0" | ||
"temporalio": "^0.17.2" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.15.0", | ||
"@tsconfig/node14": "^1.0.0", | ||
"@tsconfig/node16": "^1.0.0", | ||
"@types/node": "^12.12.21", | ||
"@types/node-fetch": "^3.0.3", | ||
"@types/react": "^17.0.2", | ||
"@types/react-dom": "^17.0.1", | ||
"@typescript-eslint/eslint-plugin": "^5.3.0", | ||
"@typescript-eslint/parser": "^5.3.0", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^7.32.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-deprecation": "^1.2.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also remove eslint as we don't want to include it by default related example guidelines can be seen here https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples
balazsorban44 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"nodemon": "^2.0.12", | ||
"typescript": "^4.3.5" | ||
"ts-node": "^10.2.1", | ||
"typescript": "^4.4.2" | ||
}, | ||
"nodemonConfig": { | ||
"execMap": { | ||
"ts": "node --loader ts-node/esm" | ||
}, | ||
"ext": "ts", | ||
"watch": [ | ||
"temporal/src" | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "module" | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Worker } from '@temporalio/worker' | ||
import { URL } from 'url' | ||
import path from 'path' | ||
import * as activities from './activities.js' | ||
|
||
// Support running both complied code and ts-node/esm loader | ||
const workflowsPath = new URL( | ||
`./workflows${path.extname(import.meta.url)}`, | ||
import.meta.url | ||
).pathname | ||
|
||
const worker = await Worker.create({ | ||
workflowsPath, | ||
activities, | ||
taskQueue: 'my-nextjs-project', | ||
}) | ||
|
||
await worker.run() |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": "@tsconfig/node16/tsconfig.json", | ||
"version": "4.4.2", | ||
"compilerOptions": { | ||
"target": "es2017", | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"declaration": true, | ||
"declarationMap": true, | ||
"sourceMap": true, | ||
"rootDir": "./src", | ||
"outDir": "./lib" | ||
}, | ||
"include": ["src/**/*.ts"] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be added in the example code instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that, but didn't work! Looks like prettier only looks at the root
.prettierignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add it there in addition, so it's in the
create-next-app -e with-temporal
repo.