@gjsify/example-node-cli-deepkit-workflow 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @gjsify/example-cli-deepkit-workflow
|
|
2
|
+
|
|
3
|
+
This example demonstrates the type-safe workflow/state machine system of [@deepkit/workflow](https://deepkit.io/library/workflow) running on GJS via Gjsify.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
Models a Flatpak app installation pipeline (like GNOME Software) with 9 states:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
requested → downloading → verifying → installing → installed
|
|
11
|
+
↘ ↘ ↘
|
|
12
|
+
failed failed failed
|
|
13
|
+
|
|
14
|
+
installed → updating → installed
|
|
15
|
+
↓
|
|
16
|
+
removing → removed
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- **State transitions** — type-safe allowed transitions
|
|
20
|
+
- **Custom event classes** — carry domain data (app ID, checksum, error reason)
|
|
21
|
+
- **Event listeners** — react to state changes
|
|
22
|
+
- **Transition guards** — invalid transitions throw errors (can't skip verification)
|
|
23
|
+
- **Automatic pipeline** — `event.next()` chains the full install pipeline
|
|
24
|
+
- **Lifecycle management** — install, update, and uninstall flows
|
|
25
|
+
|
|
26
|
+
## Scenarios
|
|
27
|
+
|
|
28
|
+
1. **Happy path** — request → download → verify → install
|
|
29
|
+
2. **Network error** — download fails
|
|
30
|
+
3. **Invalid transition** — attempt to skip verification (throws error)
|
|
31
|
+
4. **One-click install** — single `apply()` triggers the full pipeline
|
|
32
|
+
5. **App update** — update an already installed app
|
|
33
|
+
6. **Uninstall** — remove an installed app
|
|
34
|
+
|
|
35
|
+
## Build & Run
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
yarn build
|
|
39
|
+
yarn start:node # Run on Node.js
|
|
40
|
+
yarn start:gjs # Run on GJS
|
|
41
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gjsify/example-node-cli-deepkit-workflow",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Demonstrates Deepkit workflow/state machine on GJS",
|
|
5
|
+
"main": "dist/index.gjs.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": "16",
|
|
12
|
+
"gjs": "1.72.x"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"clear": "rm -rf dist tsconfig.tsbuildinfo",
|
|
16
|
+
"check": "tsc --noEmit",
|
|
17
|
+
"start": "yarn start:node && yarn start:gjs",
|
|
18
|
+
"start:gjs": "gjs -m dist/index.gjs.js",
|
|
19
|
+
"start:node": "node dist/index.node.mjs",
|
|
20
|
+
"build": "yarn build:gjs && yarn build:node",
|
|
21
|
+
"build:gjs": "gjsify build src/index.ts --app gjs --outfile dist/index.gjs.js",
|
|
22
|
+
"build:node": "gjsify build src/index.ts --app node --outfile dist/index.node.mjs",
|
|
23
|
+
"test": "yarn start"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@deepkit/core": "^1.0.19",
|
|
27
|
+
"@deepkit/event": "^1.0.19",
|
|
28
|
+
"@deepkit/injector": "^1.0.19",
|
|
29
|
+
"@deepkit/stopwatch": "^1.0.19",
|
|
30
|
+
"@deepkit/type": "^1.0.19",
|
|
31
|
+
"@deepkit/workflow": "^1.0.19",
|
|
32
|
+
"@gjsify/cli": "^0.1.3",
|
|
33
|
+
"@gjsify/node-globals": "^0.1.3",
|
|
34
|
+
"@types/node": "^25.5.2",
|
|
35
|
+
"typescript": "^6.0.2"
|
|
36
|
+
},
|
|
37
|
+
"author": "Pascal Garber <pascal@artandcode.studio>",
|
|
38
|
+
"license": "MIT"
|
|
39
|
+
}
|