@powerhousedao/academy 5.0.0-staging.9 → 5.0.1-staging.2

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.
Files changed (108) hide show
  1. package/.vscode/settings.json +1 -1
  2. package/CHANGELOG.md +400 -0
  3. package/README.md +3 -3
  4. package/babel.config.js +1 -1
  5. package/blog/BeyondCommunication-ABlueprintForDevelopment.md +25 -24
  6. package/blog/TheChallengeOfChange.md +21 -21
  7. package/docs/academy/01-GetStarted/00-ExploreDemoPackage.mdx +67 -30
  8. package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +38 -21
  9. package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +24 -19
  10. package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +44 -41
  11. package/docs/academy/01-GetStarted/04-BuildToDoListEditor.md +10 -10
  12. package/docs/academy/01-GetStarted/05-VetraStudio.md +164 -0
  13. package/docs/academy/01-GetStarted/06-ReactorMCP.md +58 -0
  14. package/docs/academy/01-GetStarted/home.mdx +185 -90
  15. package/docs/academy/01-GetStarted/images/Modules.png +0 -0
  16. package/docs/academy/01-GetStarted/images/VetraStudioDrive.png +0 -0
  17. package/docs/academy/01-GetStarted/styles.module.css +5 -5
  18. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/01-Prerequisites.md +46 -18
  19. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-StandardDocumentModelWorkflow.md +118 -68
  20. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +75 -33
  21. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/_category_.json +6 -6
  22. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/01-WhatIsADocumentModel.md +30 -21
  23. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/02-SpecifyTheStateSchema.md +41 -37
  24. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md +29 -25
  25. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md +36 -37
  26. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md +128 -109
  27. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +95 -86
  28. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md +7 -9
  29. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/_category_.json +6 -6
  30. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md +65 -47
  31. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/02-ConfiguringDrives.md +77 -62
  32. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/03-BuildingADriveExplorer.md +360 -349
  33. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/00-DocumentToolbar.mdx +16 -10
  34. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/01-OperationHistory.md +10 -7
  35. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/02-RevisionHistoryTimeline.md +25 -17
  36. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/_category_.json +6 -6
  37. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/01-RenownAuthenticationFlow.md +14 -7
  38. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/02-Authorization.md +0 -1
  39. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/_category_.json +5 -5
  40. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/_category_.json +1 -1
  41. package/docs/academy/02-MasteryTrack/04-WorkWithData/01-GraphQLAtPowerhouse.md +45 -33
  42. package/docs/academy/02-MasteryTrack/04-WorkWithData/02-UsingTheAPI.mdx +61 -18
  43. package/docs/academy/02-MasteryTrack/04-WorkWithData/03-UsingSubgraphs.md +50 -54
  44. package/docs/academy/02-MasteryTrack/04-WorkWithData/04-analytics-processor.md +126 -110
  45. package/docs/academy/02-MasteryTrack/04-WorkWithData/05-RelationalDbProcessor.md +75 -45
  46. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/GraphQL References/QueryingADocumentWithGraphQL.md +23 -21
  47. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/best-practices.md +9 -9
  48. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/index.md +11 -23
  49. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/integration.md +25 -9
  50. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/intro.md +10 -10
  51. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/benchmarks.md +1 -1
  52. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/index.md +16 -11
  53. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/memory.md +6 -5
  54. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/schema.md +2 -2
  55. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/utilities.md +7 -5
  56. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/maker.md +32 -58
  57. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/processors.md +1 -1
  58. package/docs/academy/02-MasteryTrack/04-WorkWithData/07-drive-analytics.md +105 -71
  59. package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_01-SetupBuilderEnvironment.md +22 -0
  60. package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_02-CreateNewPowerhouseProject.md +9 -8
  61. package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_03-GenerateAnAnalyticsProcessor.md +28 -32
  62. package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_04-UpdateAnalyticsProcessor.md +25 -26
  63. package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_category_.json +1 -1
  64. package/docs/academy/02-MasteryTrack/04-WorkWithData/_category_.json +7 -7
  65. package/docs/academy/02-MasteryTrack/05-Launch/01-IntroductionToPackages.md +3 -4
  66. package/docs/academy/02-MasteryTrack/05-Launch/02-PublishYourProject.md +69 -45
  67. package/docs/academy/02-MasteryTrack/05-Launch/03-SetupEnvironment.md +70 -40
  68. package/docs/academy/02-MasteryTrack/05-Launch/04-ConfigureEnvironment.md +1 -0
  69. package/docs/academy/02-MasteryTrack/05-Launch/_category_.json +7 -7
  70. package/docs/academy/02-MasteryTrack/_category_.json +6 -6
  71. package/docs/academy/03-ExampleUsecases/Chatroom/02-CreateNewPowerhouseProject.md +5 -3
  72. package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +38 -37
  73. package/docs/academy/03-ExampleUsecases/Chatroom/04-ImplementOperationReducers.md +45 -41
  74. package/docs/academy/03-ExampleUsecases/Chatroom/05-ImplementChatroomEditor.md +14 -14
  75. package/docs/academy/03-ExampleUsecases/Chatroom/06-LaunchALocalReactor.md +6 -6
  76. package/docs/academy/03-ExampleUsecases/Chatroom/_category_.json +1 -1
  77. package/docs/academy/04-APIReferences/00-PowerhouseCLI.md +104 -43
  78. package/docs/academy/04-APIReferences/01-ReactHooks.md +177 -129
  79. package/docs/academy/04-APIReferences/04-RelationalDatabase.md +121 -113
  80. package/docs/academy/04-APIReferences/05-PHDocumentMigrationGuide.md +48 -41
  81. package/docs/academy/04-APIReferences/_category_.json +6 -6
  82. package/docs/academy/05-Architecture/00-PowerhouseArchitecture.md +1 -2
  83. package/docs/academy/05-Architecture/01-WorkingWithTheReactor.md +11 -8
  84. package/docs/academy/05-Architecture/05-DocumentModelTheory/_category_.json +1 -1
  85. package/docs/academy/05-Architecture/_category_.json +6 -6
  86. package/docs/academy/06-ComponentLibrary/00-DocumentEngineering.md +25 -23
  87. package/docs/academy/06-ComponentLibrary/02-CreateCustomScalars.md +105 -93
  88. package/docs/academy/06-ComponentLibrary/03-IntegrateIntoAReactComponent.md +1 -0
  89. package/docs/academy/06-ComponentLibrary/_category_.json +7 -7
  90. package/docs/academy/07-Cookbook.md +268 -35
  91. package/docs/academy/08-Glossary.md +7 -1
  92. package/docs/bookofpowerhouse/01-Overview.md +2 -2
  93. package/docs/bookofpowerhouse/02-GeneralFrameworkAndPhilosophy.md +1 -7
  94. package/docs/bookofpowerhouse/03-PowerhouseSoftwareArchitecture.md +10 -7
  95. package/docs/bookofpowerhouse/04-DevelopmentApproaches.md +10 -4
  96. package/docs/bookofpowerhouse/05-SNOsandANewModelForOSSandPublicGoods.md +23 -30
  97. package/docs/bookofpowerhouse/06-SNOsInActionAndPlatformEconomies.md +0 -7
  98. package/docusaurus.config.ts +64 -66
  99. package/package.json +9 -7
  100. package/scripts/generate-combined-cli-docs.ts +43 -13
  101. package/sidebars.ts +2 -0
  102. package/src/components/HomepageFeatures/index.tsx +171 -78
  103. package/src/components/HomepageFeatures/styles.module.css +1 -2
  104. package/src/css/custom.css +89 -89
  105. package/src/pages/_archive-homepage.tsx +17 -16
  106. package/src/theme/DocCardList/index.tsx +9 -8
  107. package/static.json +6 -6
  108. package/tsconfig.tsbuildinfo +1 -0
@@ -1,18 +1,20 @@
1
- # Prerequisites
1
+ # Prerequisites
2
2
 
3
3
  Let's set up your machine to start building your first Document Model. Don't worry if this is your first time setting up a development environment - we'll guide you through each step!
4
4
 
5
5
  :::info
6
6
  If you've already set up **Git, Node, and pnpm**, your most important step is to install the **Powerhouse CLI** with the command: `pnpm install ph-cmd`. A global install is recommended if you want to use the command from any directory as a power user. In this case use `pnpm install -g ph-cmd`. The Powerhouse CLI is used to create, build, and run your Document Models and gives you direct access to a series of Powerhouse Builder Tools. Move to the end of this page to [verify your installation.](#verify-installation)
7
7
  :::
8
- ___
8
+
9
+ ---
9
10
 
10
11
  ## Overview
11
12
 
12
- Before we begin building our Document Model, we need to install some software on your machine. We'll need three main tools:
13
+ Before we begin building our Document Model, we need to install some software on your machine. We'll need three main tools:
14
+
13
15
  - Node.js 22, which helps us run our code.
14
16
  - Visual Studio Code (VS Code), which is where we'll write our code
15
- - Git, which helps us manage our code.
17
+ - Git, which helps us manage our code.
16
18
 
17
19
  Follow the steps below based on your computer's operating system.
18
20
 
@@ -21,14 +23,17 @@ Follow the steps below based on your computer's operating system.
21
23
  node.js 22 is a tool that lets us run our application. Let's install it step by step.
22
24
 
23
25
  #### For Windows:
26
+
24
27
  1. **Set up PowerShell for running commands:**
25
28
  - Press the Windows key
26
29
  - Type "PowerShell"
27
30
  - Right-click on "Windows PowerShell" and select "Run as administrator"
28
31
  - In the PowerShell window, type this command and press Enter:
32
+
29
33
  ```powershell
30
34
  Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
31
35
  ```
36
+
32
37
  - Type 'A' when prompted to confirm
33
38
  - You can now close this window and open PowerShell normally for the remaining steps
34
39
 
@@ -41,6 +46,7 @@ node.js 22 is a tool that lets us run our application. Let's install it step by
41
46
  3. **Install pnpm:**
42
47
  - Open PowerShell (no need for admin mode)
43
48
  - Type this command and press Enter:
49
+
44
50
  ```powershell
45
51
  npm install -g pnpm
46
52
  ```
@@ -52,25 +58,32 @@ node.js 22 is a tool that lets us run our application. Let's install it step by
52
58
  node --version
53
59
  pnpm --version
54
60
  ```
61
+
55
62
  - You should see version numbers appear after each command (e.g., v18.17.0). If you do, congratulations - Node.js and pnpm are installed!
56
63
 
57
64
  > **Note**: If node.js 22 commands don't work in VS Code, restart VS Code to refresh environment variables.
58
65
 
59
66
  #### For macOS:
67
+
60
68
  1. **Install Homebrew:**
61
69
  - Open Terminal (press Command + Space and type "Terminal")
62
70
  - Copy and paste this command into Terminal and press Enter:
71
+
63
72
  ```bash
64
73
  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
65
74
  ```
75
+
66
76
  - Follow any additional instructions that appear
67
77
 
68
78
  2. **Install node.js 22:**
69
79
  - In the same Terminal window, type this command and press Enter:
80
+
70
81
  ```bash
71
82
  brew install node@22
72
83
  ```
84
+
73
85
  - Then, install pnpm:
86
+
74
87
  ```bash
75
88
  brew install pnpm
76
89
  ```
@@ -81,19 +94,23 @@ node.js 22 is a tool that lets us run our application. Let's install it step by
81
94
  node --version
82
95
  pnpm --version
83
96
  ```
97
+
84
98
  - If you see version numbers, you've successfully installed Node.js and pnpm!
85
99
 
86
100
  #### For Linux (Ubuntu/Debian):
101
+
87
102
  1. **Open Terminal:**
88
103
  - Press Ctrl + Alt + T on your keyboard, or
89
104
  - Click the Activities button and type "Terminal"
90
105
 
91
106
  2. **Update Package List:**
107
+
92
108
  ```bash
93
109
  sudo apt update
94
110
  ```
95
111
 
96
112
  3. **Install node.js 22 and pnpm:**
113
+
97
114
  ```bash
98
115
  sudo apt install nodejs pnpm
99
116
  ```
@@ -104,6 +121,7 @@ node.js 22 is a tool that lets us run our application. Let's install it step by
104
121
  node --version
105
122
  pnpm --version
106
123
  ```
124
+
107
125
  - If you see version numbers, you're all set!
108
126
 
109
127
  ### Installing Visual Studio Code
@@ -111,6 +129,7 @@ node.js 22 is a tool that lets us run our application. Let's install it step by
111
129
  VS Code is the editor we'll use to write our code. Here's how to install it:
112
130
 
113
131
  #### For Windows:
132
+
114
133
  1. Visit the [Visual Studio Code website](https://code.visualstudio.com/)
115
134
  2. Click the blue "Download for Windows" button
116
135
  3. Once the installer downloads, double-click it
@@ -121,6 +140,7 @@ VS Code is the editor we'll use to write our code. Here's how to install it:
121
140
  8. When installation is complete, click "Finish"
122
141
 
123
142
  #### For macOS:
143
+
124
144
  1. Visit the [Visual Studio Code website](https://code.visualstudio.com/)
125
145
  2. Click the blue "Download for Mac" button
126
146
  3. Once the .zip file downloads, double-click it to extract
@@ -132,6 +152,7 @@ VS Code is the editor we'll use to write our code. Here's how to install it:
132
152
  - Type "shell command" and select "Shell Command: Install 'code' command in PATH"
133
153
 
134
154
  #### For Linux (Ubuntu/Debian):
155
+
135
156
  1. Open Terminal (Ctrl + Alt + T)
136
157
  2. First, update the packages list:
137
158
  ```bash
@@ -160,6 +181,7 @@ VS Code is the editor we'll use to write our code. Here's how to install it:
160
181
  ### Install Git
161
182
 
162
183
  #### For Windows
184
+
163
185
  1. Open PowerShell (press Windows key, type "PowerShell", and press Enter)
164
186
  2. Visit the [Git website](https://git-scm.com/)
165
187
  3. Download the latest version for Windows
@@ -170,6 +192,7 @@ VS Code is the editor we'll use to write our code. Here's how to install it:
170
192
  ```
171
193
 
172
194
  #### For macOS
195
+
173
196
  1. Install using Homebrew:
174
197
  ```bash
175
198
  brew install git
@@ -180,6 +203,7 @@ VS Code is the editor we'll use to write our code. Here's how to install it:
180
203
  ```
181
204
 
182
205
  #### For Linux (Ubuntu/Debian)
206
+
183
207
  1. Update package list:
184
208
  ```bash
185
209
  sudo apt update
@@ -196,6 +220,7 @@ VS Code is the editor we'll use to write our code. Here's how to install it:
196
220
  ### Configure Git (All Systems)
197
221
 
198
222
  After installation, set up your identity:
223
+
199
224
  ```bash
200
225
  git config --global user.name "Your Name"
201
226
  git config --global user.email "your.email@example.com"
@@ -204,11 +229,13 @@ git config --global user.email "your.email@example.com"
204
229
  ### Install the Powerhouse CLI
205
230
 
206
231
  The Powerhouse CLI (installed via the `ph-cmd` package) is a command-line interface tool. It provides the `ph` command, which is essential for managing Powerhouse projects. You can get access to the Powerhouse Ecosystem tools by installing them globally using:
232
+
207
233
  ```bash
208
234
  pnpm install -g ph-cmd
209
- ```
235
+ ```
210
236
 
211
237
  Key commands include:
238
+
212
239
  - `ph connect` for running the Connect application locally
213
240
  - `ph switchboard` or `ph reactor` for starting the API service
214
241
  - `ph init` to start a new project and build a document model
@@ -221,24 +248,26 @@ This tool will be fundamental on your journey when creating, building, and runni
221
248
 
222
249
  When installing or using the Powerhouse CLI commands you can use the dev & staging branches. These branches contain more experimental features than the latest stable release the PH CLI uses by default. They can be used to get access to a bug fix or features under development.
223
250
 
224
- | Command | Description |
225
- |---------|-------------|
226
- | **pnpm install -g ph-cmd** | Install latest stable version |
227
- | **pnpm install -g ph-cmd@dev** | Install development version |
228
- | **pnpm install -g ph-cmd@staging** | Install staging version |
229
- | **ph init** | Use latest stable version of the boilerplate |
230
- | **ph init --dev** | Use development version of the boilerplate |
231
- | **ph init --staging** | Use staging version of the boilerplate |
232
- | **ph use** | Switch all dependencies to latest production versions |
233
- | **ph use dev** | Switch all dependencies to development versions |
234
- | **ph use prod** | Switch all dependencies to production versions |
251
+ | Command | Description |
252
+ | ---------------------------------- | ----------------------------------------------------- |
253
+ | **pnpm install -g ph-cmd** | Install latest stable version |
254
+ | **pnpm install -g ph-cmd@dev** | Install development version |
255
+ | **pnpm install -g ph-cmd@staging** | Install staging version |
256
+ | **ph init** | Use latest stable version of the boilerplate |
257
+ | **ph init --dev** | Use development version of the boilerplate |
258
+ | **ph init --staging** | Use staging version of the boilerplate |
259
+ | **ph use** | Switch all dependencies to latest production versions |
260
+ | **ph use dev** | Switch all dependencies to development versions |
261
+ | **ph use prod** | Switch all dependencies to production versions |
235
262
 
236
263
  Please be aware that these versions can contain bugs and experimental features that aren't fully tested.
264
+
237
265
  </details>
238
266
 
239
267
  ### Verify Installation
240
268
 
241
269
  Open your terminal (command prompt) and run the following commands to verify your setup:
270
+
242
271
  ```bash
243
272
  node --version
244
273
  pnpm --version
@@ -255,10 +284,9 @@ v22.16.0
255
284
  % pnpm --version
256
285
  10.10.0
257
286
  % git --version
258
- git version 2.39.3
287
+ git version 2.39.3
259
288
  % ph --version
260
289
  PH CMD version: 0.43.18
261
290
  -------------------------------------
262
291
  PH CLI is not available, please run `ph setup-globals` to generate the default global project
263
292
  ```
264
-
@@ -1,8 +1,8 @@
1
1
  # Create Powerhouse packages
2
2
 
3
3
  :::warning
4
- **This tutorial is a summary for builders that are already familiar with building document models**.
5
- It provides a summary from initial setup up to publishing a distributable package.
4
+ **This tutorial is a summary for builders that are already familiar with building document models**.
5
+ It provides a summary from initial setup up to publishing a distributable package.
6
6
 
7
7
  Please start with the '**Get Started**' Chapter or '**Document Model Creation**' section if you are unfamiliar with building a document model.
8
8
  :::
@@ -10,35 +10,41 @@ Please start with the '**Get Started**' Chapter or '**Document Model Creation**'
10
10
  <details>
11
11
  <summary>Key commands that you'll use in this flow</summary>
12
12
 
13
- - `pnpm install -g ph-cmd`: Installs the Powerhouse CLI globally.
14
- - `ph init`: Initializes a new Powerhouse project or sets up the local environment.
15
- - `ph connect`: Runs Connect in Studio Mode for local development and testing.
16
- - `ph generate <YourModelName.phdm.zip>`: Generates scaffolding code from an exported document model specification.
17
- - `ph generate --editor YourModelName --document-types powerhouse/YourModelName`: Generates an editor template for a document model.
18
- - `pnpm build`: Builds the project for production.
19
- - `pnpm run test`: Runs unit tests.
20
- - `npm login`: Logs into your NPM account.
21
- - `npm publish`: Publishes your package to NPM.
22
- - `ph install @your-org-ph/your-package-name`: Installs a published package into a local Powerhouse environment.
13
+ - `pnpm install -g ph-cmd`: Installs the Powerhouse CLI globally.
14
+ - `ph init`: Initializes a new Powerhouse project or sets up the local environment.
15
+ - `ph connect`: Runs Connect in Studio Mode for local development and testing.
16
+ - `ph generate <YourModelName.phdm.zip>`: Generates scaffolding code from an exported document model specification.
17
+ - `ph generate --editor YourModelName --document-types powerhouse/YourModelName`: Generates an editor template for a document model.
18
+ - `pnpm build`: Builds the project for production.
19
+ - `pnpm run test`: Runs unit tests.
20
+ - `npm login`: Logs into your NPM account.
21
+ - `npm publish`: Publishes your package to NPM.
22
+ - `ph install @your-org-ph/your-package-name`: Installs a published package into a local Powerhouse environment.
23
23
 
24
24
  </details>
25
25
 
26
26
  ## Phase 1: Setup and initialization
27
27
 
28
28
  ### 1.1. Install Powerhouse CLI
29
+
29
30
  Ensure you have the Powerhouse Command Line Interface (`ph-cmd`) installed. This tool is crucial for managing your Powerhouse projects.
31
+
30
32
  ```bash
31
33
  pnpm install -g ph-cmd
32
34
  ```
35
+
33
36
  :::info **Prerequisites**
34
37
  The [Prerequisites](/academy/MasteryTrack/BuilderEnvironment/Prerequisites) guide for detailed installation instructions for Node.js, pnpm, and Git if you haven't set them up yet.
35
38
  :::
36
39
 
37
40
  ### 1.2. Initialize your project environment
41
+
38
42
  Before creating a specific project, or if you're setting up your environment for the first time to use Connect Studio Mode, initialize the Powerhouse environment. This command prepares your local setup, including a local Reactor configuration.
43
+
39
44
  ```bash
40
45
  ph init
41
46
  ```
47
+
42
48
  If you are starting a new project to be packaged, this command will also prompt you for a project name. This name will be used for your package.
43
49
 
44
50
  <details>
@@ -46,26 +52,30 @@ If you are starting a new project to be packaged, this command will also prompt
46
52
 
47
53
  When installing or using the Powerhouse CLI commands you are able to make use of the dev & staging branches. These branches contain more experimental features then the latest stable release the PH CLI uses by default. They can be used to get access to a bugfix or features under development.
48
54
 
49
- | Command | Description |
50
- |---------|-------------|
51
- | **pnpm install -g ph-cmd** | Install latest stable version |
52
- | **pnpm install -g ph-cmd@dev** | Install development version |
53
- | **pnpm install -g ph-cmd@staging** | Install staging version |
54
- | **ph init** | Use latest stable version of the boilerplate |
55
- | **ph init --dev** | Use development version of the boilerplate |
56
- | **ph init --staging** | Use staging version of the boilerplate |
57
- | **ph use** | Switch all dependencies to latest production versions |
58
- | **ph use dev** | Switch all dependencies to development versions |
59
- | **ph use prod** | Switch all dependencies to production versions |
55
+ | Command | Description |
56
+ | ---------------------------------- | ----------------------------------------------------- |
57
+ | **pnpm install -g ph-cmd** | Install latest stable version |
58
+ | **pnpm install -g ph-cmd@dev** | Install development version |
59
+ | **pnpm install -g ph-cmd@staging** | Install staging version |
60
+ | **ph init** | Use latest stable version of the boilerplate |
61
+ | **ph init --dev** | Use development version of the boilerplate |
62
+ | **ph init --staging** | Use staging version of the boilerplate |
63
+ | **ph use** | Switch all dependencies to latest production versions |
64
+ | **ph use dev** | Switch all dependencies to development versions |
65
+ | **ph use prod** | Switch all dependencies to production versions |
60
66
 
61
67
  Please be aware that these versions can contain bugs and experimental features that aren't fully tested.
68
+
62
69
  </details>
63
70
 
64
71
  ### 1.3. Launch Connect in studio mode
72
+
65
73
  Connect is your local development hub. Running it in Studio Mode spins up a local instance with a local Reactor, allowing you to define, build, and test document models.
74
+
66
75
  ```bash
67
76
  ph connect
68
77
  ```
78
+
69
79
  This command typically opens Connect in your browser at `http://localhost:3000/`.
70
80
 
71
81
  :::info
@@ -75,69 +85,89 @@ This command typically opens Connect in your browser at `http://localhost:3000/`
75
85
  ## Phase 2: Document model specification
76
86
 
77
87
  ### 2.1. Define the document model schema
88
+
78
89
  Within Connect Studio Mode, navigate to the Document Model Editor. Here, you'll specify the structure of your document model using GraphQL Schema Definition Language (SDL).
79
- - **State Schema:** Describes the data fields and types within your document (e.g., `ToDoItem` with `id`, `text`, `checked` fields).
80
- - This schema is the blueprint for your document model's data.
90
+
91
+ - **State Schema:** Describes the data fields and types within your document (e.g., `ToDoItem` with `id`, `text`, `checked` fields).
92
+ - This schema is the blueprint for your document model's data.
81
93
 
82
94
  ### 2.2. Define document model operations
95
+
83
96
  In the same editor, specify the operations (state transitions) for your document model. These are also defined using GraphQL, specifically input types.
84
- - **Operations Schema:** Specifies the actions that can be performed on the document (e.g., `AddTodoItemInput`, `UpdateTodoItemInput`, `DeleteTodoItemInput`).
85
- - Each input type details the parameters required for an operation.
86
- - **Best Practices:**
87
- * Clearly define operations (often aligning with CRUD principles).
88
- * Use GraphQL input types for operation parameters.
89
- * Ensure operations reflect user intent for a clean API.
97
+
98
+ - **Operations Schema:** Specifies the actions that can be performed on the document (e.g., `AddTodoItemInput`, `UpdateTodoItemInput`, `DeleteTodoItemInput`).
99
+ - Each input type details the parameters required for an operation.
100
+ - **Best Practices:**
101
+ - Clearly define operations (often aligning with CRUD principles).
102
+ - Use GraphQL input types for operation parameters.
103
+ - Ensure operations reflect user intent for a clean API.
90
104
 
91
105
  ### 2.3. Export document model specification
106
+
92
107
  Once your schema and operations are defined in Connect, export the specification. This will download a `.phdm.zip` file (e.g., `YourModelName.phdm.zip`). Save this file in the root of your Powerhouse project directory.
93
108
 
94
109
  ## Phase 3: Implementation and testing
95
110
 
96
111
  ### 3.1. Generate scaffolding code
112
+
97
113
  Use the Powerhouse CLI to process the exported `.phdm.zip` file and generate the necessary boilerplate code for your document model.
114
+
98
115
  ```bash
99
116
  ph generate YourModelName.phdm.zip
100
117
  ```
118
+
101
119
  This command creates a new directory under `document-models/YourModelName/` containing:
102
- - A JSON file with the document model specification.
103
- - A GraphQL file with the state and operation schemas.
104
- - A `gen/` folder with autogenerated TypeScript types, action creators, and utility functions based on your schema.
105
- - A `src/` folder where you'll implement your custom logic (reducers, utils).
120
+
121
+ - A JSON file with the document model specification.
122
+ - A GraphQL file with the state and operation schemas.
123
+ - A `gen/` folder with autogenerated TypeScript types, action creators, and utility functions based on your schema.
124
+ - A `src/` folder where you'll implement your custom logic (reducers, utils).
106
125
 
107
126
  ### 3.2. Implement reducer logic
127
+
108
128
  Reducers are pure functions that implement the state transition logic for each operation defined in your schema. Navigate to `document-models/YourModelName/src/reducers/to-do-list.ts` (or similar, based on your model name).
109
- - Implement the functions for each operation (e.g., `addTodoItemOperation`, `updateTodoItemOperation`).
110
- - These functions take the current state and an action (containing input data) and return the new state.
111
- - Powerhouse handles immutability behind the scenes.
129
+
130
+ - Implement the functions for each operation (e.g., `addTodoItemOperation`, `updateTodoItemOperation`).
131
+ - These functions take the current state and an action (containing input data) and return the new state.
132
+ - Powerhouse handles immutability behind the scenes.
112
133
 
113
134
  ### 3.3. Write unit tests for reducers
135
+
114
136
  It's crucial to test your reducer logic. Write unit tests in the `document-models/YourModelName/src/reducers/tests/` directory.
115
- - Verify that each operation correctly transforms the document state.
116
- - Use the auto-generated action creators from the `gen/` folder to create operation actions for your tests.
117
- Run tests using:
137
+
138
+ - Verify that each operation correctly transforms the document state.
139
+ - Use the auto-generated action creators from the `gen/` folder to create operation actions for your tests.
140
+ Run tests using:
141
+
118
142
  ```bash
119
143
  pnpm run test
120
144
  ```
121
145
 
122
146
  ### 3.4. Implement the document editor
147
+
123
148
  A document editor provides the user interface for interacting with your document model in Connect. Generate an editor template:
149
+
124
150
  ```bash
125
151
  ph generate --editor YourModelName --document-types powerhouse/YourModelName
126
152
  ```
127
- - The `--editor YourModelName` flag specifies the document model this editor is for.
128
- - The `--document-types powerhouse/YourModelName` flag links the editor to the specific document type defined in your model specification (ensure this matches what you set in Connect).
153
+
154
+ - The `--editor YourModelName` flag specifies the document model this editor is for.
155
+ - The `--document-types powerhouse/YourModelName` flag links the editor to the specific document type defined in your model specification (ensure this matches what you set in Connect).
129
156
 
130
157
  This creates a template file, typically at `editors/your-model-name/editor.tsx`.
131
- - Customize this React component to build your UI.
132
- - You can use standard HTML, Tailwind CSS (available in Connect), or import custom CSS.
133
- - Utilize components from `@powerhousedao/document-engineering` for consistency and rapid development. Learn more at [Document-Engineering](/academy/ComponentLibrary/DocumentEngineering)
134
158
 
159
+ - Customize this React component to build your UI.
160
+ - You can use standard HTML, Tailwind CSS (available in Connect), or import custom CSS.
161
+ - Utilize components from `@powerhousedao/document-engineering` for consistency and rapid development. Learn more at [Document-Engineering](/academy/ComponentLibrary/DocumentEngineering)
135
162
 
136
163
  ### 3.5. Test the editor
164
+
137
165
  Run Connect locally to see your editor in action:
166
+
138
167
  ```bash
139
168
  ph connect
140
169
  ```
170
+
141
171
  Create a new document of your defined type. Interact with your editor, test all functionalities, and ensure it correctly dispatches actions to the reducers and reflects state changes.
142
172
 
143
173
  ## Phase 4: Packaging and publishing
@@ -145,27 +175,32 @@ Create a new document of your defined type. Interact with your editor, test all
145
175
  Once your document model and editor are implemented and tested, you can package them for distribution. A Powerhouse Package is a modular unit that can group document models, editors, scripts, and processors.
146
176
 
147
177
  ### 4.1. Prepare project for packaging
178
+
148
179
  If you didn't initialize your project with `ph init` intending it as a package, ensure your project structure is set up correctly. The `ph init` command is designed to create this structure.
149
- - `document-models/`: Contains your document models.
150
- - `editors/`: Contains your editor components.
151
- - `src/`: Often used for shared utilities or can be part of the model/editor structure.
152
- - (Optional) `processors/`, `scripts/` for advanced functionalities.
180
+
181
+ - `document-models/`: Contains your document models.
182
+ - `editors/`: Contains your editor components.
183
+ - `src/`: Often used for shared utilities or can be part of the model/editor structure.
184
+ - (Optional) `processors/`, `scripts/` for advanced functionalities.
153
185
 
154
186
  ### 4.2. Specify package details in `package.json`
187
+
155
188
  Navigate to the `package.json` file in your project root. This file is crucial for NPM publishing.
156
- - **`name`**: Follow a scoped naming convention, e.g., `@your-org-ph/your-package-name`. The `-ph` suffix helps identify Powerhouse ecosystem packages.
157
- - **`version`**: Use semantic versioning (e.g., `1.0.0`).
158
- - **`author`**: Your name or organization.
159
- - **`license`**: e.g., `AGPL-3.0-only`.
160
- - **`main`**: The entry point of your package (e.g., `index.js` or `dist/index.js`).
161
- - **`publishConfig`**: For scoped packages intended to be public, add:
162
- ```json
163
- "publishConfig": {
164
- "access": "public"
165
- }
166
- ```
189
+
190
+ - **`name`**: Follow a scoped naming convention, e.g., `@your-org-ph/your-package-name`. The `-ph` suffix helps identify Powerhouse ecosystem packages.
191
+ - **`version`**: Use semantic versioning (e.g., `1.0.0`).
192
+ - **`author`**: Your name or organization.
193
+ - **`license`**: e.g., `AGPL-3.0-only`.
194
+ - **`main`**: The entry point of your package (e.g., `index.js` or `dist/index.js`).
195
+ - **`publishConfig`**: For scoped packages intended to be public, add:
196
+ ```json
197
+ "publishConfig": {
198
+ "access": "public"
199
+ }
200
+ ```
167
201
 
168
202
  Example `package.json` snippet:
203
+
169
204
  ```json
170
205
  {
171
206
  "name": "@your-org-ph/your-package-name",
@@ -173,9 +208,10 @@ Example `package.json` snippet:
173
208
  "author": "Your Name",
174
209
  "license": "AGPL-3.0-only",
175
210
  "main": "index.js",
176
- "files": [ // Ensure your build output and necessary files are included
211
+ "files": [
212
+ // Ensure your build output and necessary files are included
177
213
  "dist",
178
- "manifest.json",
214
+ "manifest.json",
179
215
  "document-models",
180
216
  "editors"
181
217
  ],
@@ -186,9 +222,11 @@ Example `package.json` snippet:
186
222
  ```
187
223
 
188
224
  ### 4.3. Add a manifest file (`manifest.json`)
225
+
189
226
  Create a `manifest.json` file in your project root. This file describes your package's contents (document models, editors) and helps host applications like Connect understand and integrate your package.
190
227
 
191
228
  Example `manifest.json`:
229
+
192
230
  ```json
193
231
  {
194
232
  "name": "@yourorg-ph/your-package-name", // it's recommended to use an organization-specific NPM account (e.g., `yourorg-ph`).
@@ -196,34 +234,40 @@ Example `manifest.json`:
196
234
  "category": "your-category", // e.g., "Finance", "People Ops", "Legal"
197
235
  "publisher": {
198
236
  "name": "your-publisher-name", // Your organization or name
199
- "url": "your-publisher-url" // Link to your website or repository
237
+ "url": "your-publisher-url" // Link to your website or repository
200
238
  },
201
239
  "documentModels": [
202
240
  {
203
241
  "id": "powerhouse/YourModelName", // Document type string as defined in Connect
204
- "name": "YourModelName" // Human-readable name
242
+ "name": "YourModelName" // Human-readable name
205
243
  }
206
244
  ],
207
245
  "editors": [
208
246
  {
209
- "id": "your-editor-id", // A unique ID for the editor component
210
- "name": "YourModelName Editor", // Human-readable name
247
+ "id": "your-editor-id", // A unique ID for the editor component
248
+ "name": "YourModelName Editor", // Human-readable name
211
249
  "documentTypes": ["powerhouse/YourModelName"] // Links editor to document type(s)
212
250
  }
213
251
  ]
214
252
  }
215
253
  ```
254
+
216
255
  Update your project's main `index.js` or entry point to export your document models and editors so they can be discovered by Powerhouse applications.
217
256
 
218
257
  ### 4.4. Build your project
258
+
219
259
  Compile and optimize your project for production:
260
+
220
261
  ```bash
221
262
  pnpm build
222
263
  ```
264
+
223
265
  This command typically creates a `dist/` or `build/` directory with the compiled assets. Ensure your `package.json`'s `files` array includes this directory and other necessary assets like `manifest.json`, `document-models`, and `editors` if they are not part of the build output but need to be in the package.
224
266
 
225
267
  ### 4.5. Version control
268
+
226
269
  Store your project in a Git repository for versioning and collaboration.
270
+
227
271
  ```bash
228
272
  git init
229
273
  git add .
@@ -233,13 +277,16 @@ git commit -m "Initial commit of document model package"
233
277
  ```
234
278
 
235
279
  ### 4.6. Publish to NPM
280
+
236
281
  To share your package with others or deploy it to different environments, publish it to the NPM registry.
237
282
 
238
283
  1. **Login to NPM:**
239
284
  If you haven't already, log into your NPM account. It's recommended to use an organization-specific NPM account (e.g., `yourorg-ph`).
285
+
240
286
  ```bash
241
287
  npm login
242
288
  ```
289
+
243
290
  Follow the prompts in your terminal or browser.
244
291
 
245
292
  2. **Publish the package:**
@@ -249,10 +296,13 @@ To share your package with others or deploy it to different environments, publis
249
296
  If your package is scoped and public, NPM will use the `publishConfig` from your `package.json`. If not set there, you might need `npm publish --access public`.
250
297
 
251
298
  ### 4.7. Using your published package
299
+
252
300
  Once published, your package can be installed and used in any Powerhouse environment (like another local Connect instance or a deployed Reactor setup).
301
+
253
302
  ```bash
254
303
  ph install @your-org-ph/your-package-name
255
304
  ```
305
+
256
306
  This command makes the document models and editors defined in your package available within that Powerhouse instance.
257
307
 
258
- Congratulations! You've successfully created, packaged, and published a Powerhouse Document Model. This enables modularity, reusability, and collaboration within the Powerhouse ecosystem.
308
+ Congratulations! You've successfully created, packaged, and published a Powerhouse Document Model. This enables modularity, reusability, and collaboration within the Powerhouse ecosystem.