Skip to content

Commit cd18816

Browse files
authored
Restructure project (#7)
* Restructure project * Add github actions * wip * Lerna link * Add internal packages as root deps * Commit package-lock * Make tests pass in ci * Disable npm cache * Add lint step * Fix c++ compilation * Cleanup github WF * Use npm 7 * Skip lerna bootstrap * Fix format * Final changes? * Build only node 12
1 parent 3acbc84 commit cd18816

File tree

133 files changed

+16580
-3563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+16580
-3563
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
node_modules
22
lib
3+
es2020
4+
commonjs

.eslintrc

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
{
22
"root": true,
33
"parser": "@typescript-eslint/parser",
4-
"plugins": [
5-
"@typescript-eslint"
6-
],
4+
"plugins": ["@typescript-eslint"],
75
"extends": [
86
"eslint:recommended",
97
"plugin:@typescript-eslint/eslint-recommended",
10-
"plugin:@typescript-eslint/recommended"
11-
]
8+
"plugin:@typescript-eslint/recommended",
9+
"prettier"
10+
],
11+
"rules": {
12+
"@typescript-eslint/no-explicit-any": 0,
13+
"@typescript-eslint/no-unused-vars": [
14+
1,
15+
{
16+
"argsIgnorePattern": "^_"
17+
}
18+
]
19+
}
1220
}

.github/workflows/ci.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: ci
2+
on: # rebuild any PRs and main branch changes
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
- 'releases/*'
8+
9+
jobs:
10+
build-lint-test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
node: [12]
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
submodules: recursive
20+
- uses: actions-rs/toolchain@v1
21+
with:
22+
toolchain: stable
23+
- uses: actions/setup-node@v1
24+
with:
25+
node-version: ${{ matrix.node }}
26+
- run: npm -g i npm@next-7
27+
- run: npm ci
28+
- run: npm run build
29+
- run: npm run lint
30+
- run: npm test

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
node_modules/
22
lib/
3-
proto/
43
workflow-lib/commonjs/
54
*.tsbuildinfo
65
build/
6+
commonjs/
7+
es2020/

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "sdk-core"]
2+
path = sdk-core
3+
url = git@github.com:temporalio/sdk-core.git

.prettierignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
build
3+
native
4+
sdk-core
5+
lib
6+
es2020
7+
commonjs

.prettierrc.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"printWidth": 120,
3+
"singleQuote": true
4+
}

README.md

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,42 @@
1-
# sdk-node
2-
Temporal NodeJS SDK
1+
# Temporal NodeJS SDK
2+
3+
## This is a work in progress, not ready for use yet
4+
5+
For more information see the [proposal](https://github.com/temporalio/proposals/blob/master/node/node-sdk.md).
36

47
### Development
8+
59
#### Environment set up
6-
* Clone [sdk-core](https://github.com/temporalio/sdk-core) as a sibling directory of this repository root
10+
711
```
8-
npm install
9-
npm run compile-proto
12+
git submodule init
13+
git submodule update
14+
npm ci
1015
```
1116

1217
#### Building
18+
1319
```
1420
npm run clean
1521
npm run build
1622
```
17-
-- OR --
23+
24+
#### Building with watch
25+
1826
```
1927
npm run clean
28+
npm run build # Must be run once before build.watch
2029
npm run build.watch
2130
```
2231

2332
#### Testing
33+
2434
```
2535
npm run test
2636
```
37+
2738
-- OR --
39+
2840
```
2941
npm run test.watch
3042
```

docs/workflow-scopes-and-cancellation.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
### Scopes and Cancellation
22

33
Temporal workflows have different types that can be cancelled:
4-
* A timer or an activity
5-
* An entire workflow
6-
* A workflow scope
4+
5+
- A timer or an activity
6+
- An entire workflow
7+
- A workflow scope
78

89
Workflows are represented internally by a tree of scopes where the `main` function runs in the root scope.
910
Cancellation propagates from outer scopes to inner ones and is handled by catching `CancellationError`s when `await`ing on `Promise`s.
@@ -53,6 +54,7 @@ export async function main() {
5354
In order to have fine-grained control over cancellation, the workflow library exports 2 methods for explicitly creating scopes.
5455

5556
The first is `cancellationScope` which when cancelled will propagate cancellation to all child scopes such as timers, activities and other scopes.
57+
5658
```ts
5759
import { CancellationError, cancellationScope, cancel, sleep } from '@temporal-sdk/workflow';
5860
import { httpGetJSON } from '@activities';

lerna.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": "3.22.1",
3+
"npmClient": "npm",
4+
"command": {
5+
"publish": {
6+
"ignoreChanges": ["ignored-file", "*.md"],
7+
"message": "chore(release): publish",
8+
"registry": "https://npm.pkg.github.com"
9+
},
10+
"bootstrap": {
11+
"npmClientArgs": ["--no-package-lock"]
12+
}
13+
},
14+
"packages": ["packages/*"]
15+
}

0 commit comments

Comments
 (0)