@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.
- package/.vscode/settings.json +1 -1
- package/CHANGELOG.md +400 -0
- package/README.md +3 -3
- package/babel.config.js +1 -1
- package/blog/BeyondCommunication-ABlueprintForDevelopment.md +25 -24
- package/blog/TheChallengeOfChange.md +21 -21
- package/docs/academy/01-GetStarted/00-ExploreDemoPackage.mdx +67 -30
- package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +38 -21
- package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +24 -19
- package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +44 -41
- package/docs/academy/01-GetStarted/04-BuildToDoListEditor.md +10 -10
- package/docs/academy/01-GetStarted/05-VetraStudio.md +164 -0
- package/docs/academy/01-GetStarted/06-ReactorMCP.md +58 -0
- package/docs/academy/01-GetStarted/home.mdx +185 -90
- package/docs/academy/01-GetStarted/images/Modules.png +0 -0
- package/docs/academy/01-GetStarted/images/VetraStudioDrive.png +0 -0
- package/docs/academy/01-GetStarted/styles.module.css +5 -5
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/01-Prerequisites.md +46 -18
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-StandardDocumentModelWorkflow.md +118 -68
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +75 -33
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/_category_.json +6 -6
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/01-WhatIsADocumentModel.md +30 -21
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/02-SpecifyTheStateSchema.md +41 -37
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md +29 -25
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md +36 -37
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md +128 -109
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +95 -86
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md +7 -9
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/_category_.json +6 -6
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md +65 -47
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/02-ConfiguringDrives.md +77 -62
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/03-BuildingADriveExplorer.md +360 -349
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/00-DocumentToolbar.mdx +16 -10
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/01-OperationHistory.md +10 -7
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/02-RevisionHistoryTimeline.md +25 -17
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/_category_.json +6 -6
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/01-RenownAuthenticationFlow.md +14 -7
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/02-Authorization.md +0 -1
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/_category_.json +5 -5
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/_category_.json +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/01-GraphQLAtPowerhouse.md +45 -33
- package/docs/academy/02-MasteryTrack/04-WorkWithData/02-UsingTheAPI.mdx +61 -18
- package/docs/academy/02-MasteryTrack/04-WorkWithData/03-UsingSubgraphs.md +50 -54
- package/docs/academy/02-MasteryTrack/04-WorkWithData/04-analytics-processor.md +126 -110
- package/docs/academy/02-MasteryTrack/04-WorkWithData/05-RelationalDbProcessor.md +75 -45
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/GraphQL References/QueryingADocumentWithGraphQL.md +23 -21
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/best-practices.md +9 -9
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/index.md +11 -23
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/integration.md +25 -9
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/intro.md +10 -10
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/benchmarks.md +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/index.md +16 -11
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/memory.md +6 -5
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/schema.md +2 -2
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/utilities.md +7 -5
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/maker.md +32 -58
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/processors.md +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/07-drive-analytics.md +105 -71
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_01-SetupBuilderEnvironment.md +22 -0
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_02-CreateNewPowerhouseProject.md +9 -8
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_03-GenerateAnAnalyticsProcessor.md +28 -32
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_04-UpdateAnalyticsProcessor.md +25 -26
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_category_.json +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_category_.json +7 -7
- package/docs/academy/02-MasteryTrack/05-Launch/01-IntroductionToPackages.md +3 -4
- package/docs/academy/02-MasteryTrack/05-Launch/02-PublishYourProject.md +69 -45
- package/docs/academy/02-MasteryTrack/05-Launch/03-SetupEnvironment.md +70 -40
- package/docs/academy/02-MasteryTrack/05-Launch/04-ConfigureEnvironment.md +1 -0
- package/docs/academy/02-MasteryTrack/05-Launch/_category_.json +7 -7
- package/docs/academy/02-MasteryTrack/_category_.json +6 -6
- package/docs/academy/03-ExampleUsecases/Chatroom/02-CreateNewPowerhouseProject.md +5 -3
- package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +38 -37
- package/docs/academy/03-ExampleUsecases/Chatroom/04-ImplementOperationReducers.md +45 -41
- package/docs/academy/03-ExampleUsecases/Chatroom/05-ImplementChatroomEditor.md +14 -14
- package/docs/academy/03-ExampleUsecases/Chatroom/06-LaunchALocalReactor.md +6 -6
- package/docs/academy/03-ExampleUsecases/Chatroom/_category_.json +1 -1
- package/docs/academy/04-APIReferences/00-PowerhouseCLI.md +104 -43
- package/docs/academy/04-APIReferences/01-ReactHooks.md +177 -129
- package/docs/academy/04-APIReferences/04-RelationalDatabase.md +121 -113
- package/docs/academy/04-APIReferences/05-PHDocumentMigrationGuide.md +48 -41
- package/docs/academy/04-APIReferences/_category_.json +6 -6
- package/docs/academy/05-Architecture/00-PowerhouseArchitecture.md +1 -2
- package/docs/academy/05-Architecture/01-WorkingWithTheReactor.md +11 -8
- package/docs/academy/05-Architecture/05-DocumentModelTheory/_category_.json +1 -1
- package/docs/academy/05-Architecture/_category_.json +6 -6
- package/docs/academy/06-ComponentLibrary/00-DocumentEngineering.md +25 -23
- package/docs/academy/06-ComponentLibrary/02-CreateCustomScalars.md +105 -93
- package/docs/academy/06-ComponentLibrary/03-IntegrateIntoAReactComponent.md +1 -0
- package/docs/academy/06-ComponentLibrary/_category_.json +7 -7
- package/docs/academy/07-Cookbook.md +268 -35
- package/docs/academy/08-Glossary.md +7 -1
- package/docs/bookofpowerhouse/01-Overview.md +2 -2
- package/docs/bookofpowerhouse/02-GeneralFrameworkAndPhilosophy.md +1 -7
- package/docs/bookofpowerhouse/03-PowerhouseSoftwareArchitecture.md +10 -7
- package/docs/bookofpowerhouse/04-DevelopmentApproaches.md +10 -4
- package/docs/bookofpowerhouse/05-SNOsandANewModelForOSSandPublicGoods.md +23 -30
- package/docs/bookofpowerhouse/06-SNOsInActionAndPlatformEconomies.md +0 -7
- package/docusaurus.config.ts +64 -66
- package/package.json +9 -7
- package/scripts/generate-combined-cli-docs.ts +43 -13
- package/sidebars.ts +2 -0
- package/src/components/HomepageFeatures/index.tsx +171 -78
- package/src/components/HomepageFeatures/styles.module.css +1 -2
- package/src/css/custom.css +89 -89
- package/src/pages/_archive-homepage.tsx +17 -16
- package/src/theme/DocCardList/index.tsx +9 -8
- package/static.json +6 -6
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
# Cookbook
|
|
2
2
|
|
|
3
3
|
## Powerhouse CLI recipes
|
|
4
|
+
|
|
4
5
|
This section covers recipes related to the `ph-cmd`, the command-line tool for Powerhouse project initialization, code generation, package management, and running local development environments.
|
|
5
6
|
|
|
6
7
|
<details id="installing-ph-cmd">
|
|
7
8
|
<summary>Installing 'ph-cmd'</summary>
|
|
8
9
|
|
|
9
10
|
## How to install Powerhouse CLI
|
|
11
|
+
|
|
10
12
|
---
|
|
11
13
|
|
|
12
14
|
## Problem statement
|
|
15
|
+
|
|
13
16
|
You need to install the Powerhouse CLI (`ph-cmd`) to create and manage Powerhouse projects.
|
|
14
17
|
|
|
15
18
|
## Prerequisites
|
|
19
|
+
|
|
16
20
|
- node.js 22 installed
|
|
17
21
|
- pnpm package manager 10 installed
|
|
18
22
|
- Terminal or command prompt access
|
|
@@ -20,16 +24,19 @@ You need to install the Powerhouse CLI (`ph-cmd`) to create and manage Powerhous
|
|
|
20
24
|
## Solution
|
|
21
25
|
|
|
22
26
|
### Step 1: Install the CLI globally
|
|
27
|
+
|
|
23
28
|
```bash
|
|
24
29
|
pnpm install -g ph-cmd
|
|
25
30
|
```
|
|
26
31
|
|
|
27
32
|
### Step 2: Verify the installation
|
|
33
|
+
|
|
28
34
|
```bash
|
|
29
35
|
ph-cmd --version
|
|
30
36
|
```
|
|
31
37
|
|
|
32
38
|
### Optional: Install specific versions
|
|
39
|
+
|
|
33
40
|
```bash
|
|
34
41
|
# For the staging version
|
|
35
42
|
pnpm install -g ph-cmd@staging
|
|
@@ -39,21 +46,25 @@ pnpm install -g ph-cmd@<version>
|
|
|
39
46
|
```
|
|
40
47
|
|
|
41
48
|
## Expected outcome
|
|
49
|
+
|
|
42
50
|
- Powerhouse CLI (`ph-cmd`) installed globally on your system
|
|
43
51
|
- Access to all Powerhouse CLI commands for project creation and management
|
|
44
52
|
|
|
45
53
|
## Common issues and solutions
|
|
54
|
+
|
|
46
55
|
- Issue: Permission errors during installation
|
|
47
56
|
- Solution: Use `sudo` on Unix-based systems or run as administrator on Windows
|
|
48
57
|
- Issue: Version conflicts
|
|
49
58
|
- Solution: Clean your system using the uninstallation recipe before installing a new version
|
|
50
59
|
|
|
51
60
|
## Related recipes
|
|
61
|
+
|
|
52
62
|
- [Installing 'ph-cmd'](#installing-ph-cmd)
|
|
53
63
|
- [Uninstalling 'ph-cmd'](#uninstalling-ph-cmd)
|
|
54
64
|
- [Setting up or Resetting the Global Powerhouse Configuration](#setting-up-or-resetting-the-global-powerhouse-configuration)
|
|
55
65
|
|
|
56
66
|
## Further reading
|
|
67
|
+
|
|
57
68
|
- [Powerhouse Builder Tools](/academy/MasteryTrack/BuilderEnvironment/BuilderTools)
|
|
58
69
|
</details>
|
|
59
70
|
|
|
@@ -61,40 +72,49 @@ pnpm install -g ph-cmd@<version>
|
|
|
61
72
|
<summary>Uninstalling 'ph-cmd'</summary>
|
|
62
73
|
|
|
63
74
|
## How to uninstall Powerhouse CLI
|
|
75
|
+
|
|
64
76
|
---
|
|
65
77
|
|
|
66
78
|
## Problem statement
|
|
79
|
+
|
|
67
80
|
You want to perform a clean installation of the Powerhouse CLI.
|
|
68
81
|
|
|
69
82
|
## Prerequisites
|
|
83
|
+
|
|
70
84
|
- Powerhouse CLI (`ph-cmd`) installed
|
|
71
85
|
- A terminal or IDE
|
|
72
86
|
|
|
73
87
|
## Solution
|
|
74
88
|
|
|
75
89
|
### Step 1: Uninstall `ph-cmd`
|
|
90
|
+
|
|
76
91
|
```bash
|
|
77
|
-
pnpm uninstall -g ph-cmd
|
|
92
|
+
pnpm uninstall -g ph-cmd
|
|
78
93
|
```
|
|
79
94
|
|
|
80
|
-
### Step 2: Remove the global setups folder
|
|
95
|
+
### Step 2: Remove the global setups folder
|
|
96
|
+
|
|
81
97
|
```bash
|
|
82
|
-
rm -rf ~/.ph
|
|
98
|
+
rm -rf ~/.ph
|
|
83
99
|
```
|
|
84
100
|
|
|
85
101
|
## Expected outcome
|
|
102
|
+
|
|
86
103
|
- Your system should now be clean from the Powerhouse CLI
|
|
87
104
|
|
|
88
105
|
## Common issues and solutions
|
|
106
|
+
|
|
89
107
|
- Issue: Outdated version
|
|
90
108
|
- Solution: Uninstall and reinstall the Powerhouse CLI
|
|
91
109
|
|
|
92
110
|
## Related recipes
|
|
111
|
+
|
|
93
112
|
- [Installing 'ph-cmd'](#installing-ph-cmd)
|
|
94
113
|
- [Uninstalling 'ph-cmd'](#uninstalling-ph-cmd)
|
|
95
114
|
- [Setting up or Resetting the Global Powerhouse Configuration](#setting-up-or-resetting-the-global-powerhouse-configuration)
|
|
96
115
|
|
|
97
116
|
## Further reading
|
|
117
|
+
|
|
98
118
|
- [Powerhouse Builder Tools](/academy/MasteryTrack/BuilderEnvironment/BuilderTools)
|
|
99
119
|
- [Create A New Powerhouse Project](/academy/GetStarted/CreateNewPowerhouseProject)
|
|
100
120
|
</details>
|
|
@@ -103,32 +123,41 @@ rm -rf ~/.ph
|
|
|
103
123
|
<summary>Setting up or Resetting the Global Powerhouse Configuration</summary>
|
|
104
124
|
|
|
105
125
|
## How to set up or reset the global Powerhouse configuration
|
|
126
|
+
|
|
106
127
|
---
|
|
107
128
|
|
|
108
129
|
## Problem statement
|
|
130
|
+
|
|
109
131
|
You need to initialize the global Powerhouse configuration for the first time, or reset it to resolve issues or start fresh. This might also involve switching to a specific dependency environment like staging.
|
|
110
132
|
|
|
111
133
|
## Prerequisites
|
|
134
|
+
|
|
112
135
|
- Powerhouse CLI (`ph-cmd`) installed
|
|
113
136
|
- Terminal or command prompt access
|
|
114
137
|
|
|
115
138
|
## Solution
|
|
116
139
|
|
|
117
140
|
### Step 1: (Optional) Remove existing configuration
|
|
141
|
+
|
|
118
142
|
If you suspect issues with your current global setup or want a completely clean slate, remove the existing global configuration directory. **Skip this if setting up for the first time.**
|
|
143
|
+
|
|
119
144
|
```bash
|
|
120
145
|
# Use with caution: this removes your global settings and downloaded dependencies.
|
|
121
146
|
rm -rf ~/.ph
|
|
122
147
|
```
|
|
123
148
|
|
|
124
149
|
### Step 2: Set up global defaults
|
|
150
|
+
|
|
125
151
|
Initialize the default global project configuration.
|
|
152
|
+
|
|
126
153
|
```bash
|
|
127
154
|
ph setup-globals
|
|
128
155
|
```
|
|
129
156
|
|
|
130
157
|
### Step 3: (Optional) Switch to a specific environment (e.g., staging)
|
|
158
|
+
|
|
131
159
|
If you need to use non-production dependencies, switch the global environment.
|
|
160
|
+
|
|
132
161
|
```bash
|
|
133
162
|
# Switch to staging dependencies
|
|
134
163
|
ph use staging
|
|
@@ -138,22 +167,26 @@ ph use staging
|
|
|
138
167
|
```
|
|
139
168
|
|
|
140
169
|
## Expected outcome
|
|
170
|
+
|
|
141
171
|
- A `~/.ph` directory is created or reset.
|
|
142
172
|
- The global project is configured, potentially using the specified environment (e.g., staging).
|
|
143
173
|
- You are ready to initialize or work with Powerhouse projects using the defined global settings.
|
|
144
174
|
|
|
145
175
|
## Common issues and solutions
|
|
176
|
+
|
|
146
177
|
- Issue: Commands fail after removing `~/.ph`.
|
|
147
178
|
- Solution: Ensure you run `ph setup-globals` afterwards.
|
|
148
179
|
- Issue: Need to use specific local dependencies globally.
|
|
149
180
|
- Solution: Use `ph use local /path/to/local/packages`.
|
|
150
181
|
|
|
151
182
|
## Related recipes
|
|
183
|
+
|
|
152
184
|
- [Installing 'ph-cmd'](#installing-ph-cmd)
|
|
153
185
|
- [Uninstalling 'ph-cmd'](#uninstalling-ph-cmd)
|
|
154
186
|
- [Using Different Branches in Powerhouse](#using-different-branches-in-powerhouse)
|
|
155
187
|
|
|
156
188
|
## Further reading
|
|
189
|
+
|
|
157
190
|
- [Powerhouse Builder Tools](/academy/MasteryTrack/BuilderEnvironment/BuilderTools)
|
|
158
191
|
- [GraphQL Schema Best Practices](/academy/MasteryTrack/WorkWithData/GraphQLAtPowerhouse)
|
|
159
192
|
</details>
|
|
@@ -162,12 +195,15 @@ ph use staging
|
|
|
162
195
|
<summary>Using Different Branches in Powerhouse</summary>
|
|
163
196
|
|
|
164
197
|
## How to use different branches in Powerhouse
|
|
198
|
+
|
|
165
199
|
---
|
|
166
200
|
|
|
167
201
|
## Problem statement
|
|
202
|
+
|
|
168
203
|
You need to access experimental features, bugfixes, or development versions of Powerhouse components that aren't yet available in the stable release.
|
|
169
204
|
|
|
170
205
|
## Prerequisites
|
|
206
|
+
|
|
171
207
|
- Terminal or command prompt access
|
|
172
208
|
- pnpm package manager 10 installed
|
|
173
209
|
- Node.js 22 installed
|
|
@@ -175,6 +211,7 @@ You need to access experimental features, bugfixes, or development versions of P
|
|
|
175
211
|
## Solution
|
|
176
212
|
|
|
177
213
|
### Step 1: Install CLI with specific branch
|
|
214
|
+
|
|
178
215
|
Choose the appropriate installation command based on your needs:
|
|
179
216
|
|
|
180
217
|
```bash
|
|
@@ -189,6 +226,7 @@ pnpm install -g ph-cmd@staging
|
|
|
189
226
|
```
|
|
190
227
|
|
|
191
228
|
### Step 2: Initialize project with specific branch
|
|
229
|
+
|
|
192
230
|
When creating a new project, you can specify which branch to use:
|
|
193
231
|
|
|
194
232
|
```bash
|
|
@@ -203,6 +241,7 @@ ph init --staging
|
|
|
203
241
|
```
|
|
204
242
|
|
|
205
243
|
### Step 3: Switch dependencies for existing project
|
|
244
|
+
|
|
206
245
|
For existing projects, you can switch all dependencies to different versions:
|
|
207
246
|
|
|
208
247
|
```bash
|
|
@@ -217,22 +256,26 @@ ph use prod
|
|
|
217
256
|
```
|
|
218
257
|
|
|
219
258
|
## Expected outcome
|
|
259
|
+
|
|
220
260
|
- Access to the specified version of Powerhouse components
|
|
221
261
|
- Ability to test experimental features or bugfixes
|
|
222
262
|
- Project configured with the chosen branch's dependencies
|
|
223
263
|
|
|
224
264
|
## Common issues and solutions
|
|
265
|
+
|
|
225
266
|
- Issue: Experimental features not working as expected
|
|
226
267
|
- Solution: This is normal as these versions may contain untested features. Consider switching back to stable versions if issues persist.
|
|
227
268
|
- Issue: Version conflicts between components
|
|
228
269
|
- Solution: Ensure all components are using the same branch version. Use `ph use` commands to synchronize versions.
|
|
229
270
|
|
|
230
271
|
## Related recipes
|
|
272
|
+
|
|
231
273
|
- [Installing 'ph-cmd'](#installing-ph-cmd)
|
|
232
274
|
- Updating Your Powerhouse Project Dependencies
|
|
233
275
|
- [Setting up or Resetting the Global Powerhouse Configuration](#setting-up-or-resetting-the-global-powerhouse-configuration)
|
|
234
276
|
|
|
235
277
|
## Further reading
|
|
278
|
+
|
|
236
279
|
- [Powerhouse Builder Tools](/academy/MasteryTrack/BuilderEnvironment/BuilderTools)
|
|
237
280
|
</details>
|
|
238
281
|
|
|
@@ -240,12 +283,15 @@ ph use prod
|
|
|
240
283
|
<summary>Using Different Package Managers with Powerhouse</summary>
|
|
241
284
|
|
|
242
285
|
## How to use different package managers with Powerhouse
|
|
286
|
+
|
|
243
287
|
---
|
|
244
288
|
|
|
245
289
|
## Problem statement
|
|
290
|
+
|
|
246
291
|
You want to use a different package manager (npm, yarn, or bun) instead of pnpm for managing Powerhouse projects and dependencies.
|
|
247
292
|
|
|
248
293
|
## Prerequisites
|
|
294
|
+
|
|
249
295
|
- Node.js 22 installed
|
|
250
296
|
- Your preferred package manager installed (npm, yarn, or bun)
|
|
251
297
|
- Terminal or command prompt access
|
|
@@ -253,11 +299,12 @@ You want to use a different package manager (npm, yarn, or bun) instead of pnpm
|
|
|
253
299
|
## Solution
|
|
254
300
|
|
|
255
301
|
### Step 1: Install the CLI with Your Preferred Package Manager
|
|
302
|
+
|
|
256
303
|
Choose the appropriate installation command based on your package manager:
|
|
257
304
|
|
|
258
305
|
```bash
|
|
259
306
|
# Using npm
|
|
260
|
-
npm install -g ph-cmd
|
|
307
|
+
npm install -g ph-cmd --legacy-peer-deps
|
|
261
308
|
|
|
262
309
|
# Using yarn
|
|
263
310
|
yarn global add ph-cmd
|
|
@@ -270,32 +317,39 @@ pnpm install -g ph-cmd
|
|
|
270
317
|
```
|
|
271
318
|
|
|
272
319
|
### Step 2: Configure PATH for Global Binaries
|
|
320
|
+
|
|
273
321
|
For yarn and bun, you need to add their global binary directories to your PATH:
|
|
274
322
|
|
|
275
323
|
#### For Yarn:
|
|
324
|
+
|
|
276
325
|
```bash
|
|
277
326
|
# Add this to your ~/.bashrc, ~/.zshrc, or equivalent
|
|
278
327
|
export PATH="$PATH:$(yarn global bin)"
|
|
279
328
|
```
|
|
280
329
|
|
|
281
330
|
#### For Bun:
|
|
331
|
+
|
|
282
332
|
```bash
|
|
283
333
|
# Add this to your ~/.bashrc, ~/.zshrc, or equivalent
|
|
284
334
|
export PATH="$PATH:$HOME/.bun/bin"
|
|
285
335
|
```
|
|
286
336
|
|
|
287
337
|
After adding these lines, reload your shell configuration:
|
|
338
|
+
|
|
288
339
|
```bash
|
|
289
340
|
source ~/.bashrc # or source ~/.zshrc
|
|
290
341
|
```
|
|
291
342
|
|
|
292
343
|
### Step 3: Verify Installation
|
|
344
|
+
|
|
293
345
|
Check that the CLI is properly installed and accessible:
|
|
346
|
+
|
|
294
347
|
```bash
|
|
295
348
|
ph-cmd --version
|
|
296
349
|
```
|
|
297
350
|
|
|
298
351
|
### Step 4: Using Different Package Managers in Projects
|
|
352
|
+
|
|
299
353
|
When working with Powerhouse projects, you can specify your preferred package manager:
|
|
300
354
|
|
|
301
355
|
```bash
|
|
@@ -313,11 +367,13 @@ ph init --package-manager pnpm
|
|
|
313
367
|
```
|
|
314
368
|
|
|
315
369
|
## Expected outcome
|
|
370
|
+
|
|
316
371
|
- Powerhouse CLI installed and accessible through your preferred package manager
|
|
317
372
|
- Ability to manage Powerhouse projects using your chosen package manager
|
|
318
373
|
- Proper PATH configuration for global binaries
|
|
319
374
|
|
|
320
375
|
## Common issues and solutions
|
|
376
|
+
|
|
321
377
|
- Issue: Command not found after installation
|
|
322
378
|
- Solution: Ensure the global binary directory is in your PATH (especially for yarn and bun)
|
|
323
379
|
- Solution: Try running the command with the full path to verify installation
|
|
@@ -327,29 +383,35 @@ ph init --package-manager pnpm
|
|
|
327
383
|
- Solution: Stick to one package manager per project to avoid lockfile conflicts
|
|
328
384
|
|
|
329
385
|
## Related recipes
|
|
386
|
+
|
|
330
387
|
- [Installing 'ph-cmd'](#installing-ph-cmd)
|
|
331
388
|
- [Uninstalling 'ph-cmd'](#uninstalling-ph-cmd)
|
|
332
389
|
- [Setting up or Resetting the Global Powerhouse Configuration](#setting-up-or-resetting-the-global-powerhouse-configuration)
|
|
333
390
|
|
|
334
391
|
## Further reading
|
|
392
|
+
|
|
335
393
|
- [Powerhouse Builder Tools](/academy/MasteryTrack/BuilderEnvironment/BuilderTools)
|
|
336
394
|
- [Yarn Global Installation Guide](https://classic.yarnpkg.com/lang/en/docs/cli/global/)
|
|
337
395
|
- [Bun Installation Guide](https://bun.sh/docs/installation#how-to-add-your-path)
|
|
338
396
|
</details>
|
|
339
397
|
|
|
340
398
|
## Powerhouse Environment recipes
|
|
399
|
+
|
|
341
400
|
This section covers recipes for setting up and managing Powerhouse environments, from local development to production servers.
|
|
342
401
|
|
|
343
402
|
<details id="setting-up-a-production-environment">
|
|
344
403
|
<summary>Setting up a Production Environment</summary>
|
|
345
404
|
|
|
346
405
|
## How to set up a Production Powerhouse Environment
|
|
406
|
+
|
|
347
407
|
---
|
|
348
408
|
|
|
349
409
|
## Problem statement
|
|
410
|
+
|
|
350
411
|
You need to set up a new production-ready server to host and run your Powerhouse services (Connect and Switchboard).
|
|
351
412
|
|
|
352
413
|
## Prerequisites
|
|
414
|
+
|
|
353
415
|
- A Linux-based server (Ubuntu or Debian recommended) with `sudo` privileges.
|
|
354
416
|
- A registered domain name.
|
|
355
417
|
- DNS `A` records for your `connect` and `switchboard` subdomains pointing to your server's public IP address.
|
|
@@ -357,41 +419,53 @@ You need to set up a new production-ready server to host and run your Powerhouse
|
|
|
357
419
|
## Solution
|
|
358
420
|
|
|
359
421
|
### Step 1: Install Powerhouse Services
|
|
422
|
+
|
|
360
423
|
SSH into your server and run the universal installation script. This will install Node.js, pnpm, and prepare the system for Powerhouse services.
|
|
424
|
+
|
|
361
425
|
```bash
|
|
362
426
|
curl -fsSL https://apps.powerhouse.io/install | bash
|
|
363
427
|
```
|
|
364
428
|
|
|
365
429
|
### Step 2: Reload Your Shell
|
|
430
|
+
|
|
366
431
|
After the installation, reload your shell's configuration to recognize the new commands.
|
|
432
|
+
|
|
367
433
|
```bash
|
|
368
434
|
source ~/.bashrc # Or source ~/.zshrc if using zsh
|
|
369
435
|
```
|
|
370
436
|
|
|
371
437
|
### Step 3: Initialize a Project
|
|
438
|
+
|
|
372
439
|
Create a project directory for your services. The `ph-init` command sets up the basic structure. Move into the directory after creation.
|
|
440
|
+
|
|
373
441
|
```bash
|
|
374
442
|
ph-init my-powerhouse-services
|
|
375
443
|
cd my-powerhouse-services
|
|
376
444
|
```
|
|
377
445
|
|
|
378
446
|
### Step 4: Configure Services
|
|
447
|
+
|
|
379
448
|
Run the interactive setup command. This will guide you through configuring Nginx, PM2, databases, and SSL.
|
|
449
|
+
|
|
380
450
|
```bash
|
|
381
451
|
ph service setup
|
|
382
452
|
```
|
|
453
|
+
|
|
383
454
|
During the setup, you will be prompted for:
|
|
384
|
-
|
|
385
|
-
-
|
|
386
|
-
-
|
|
455
|
+
|
|
456
|
+
- **Packages to install:** You can pre-install any Powerhouse packages you need. (Optional)
|
|
457
|
+
- **Database:** Choose between a local PostgreSQL setup or connecting to a remote database.
|
|
458
|
+
- **SSL Certificate:** Select Let's Encrypt for a production setup. You will need to provide your domain and subdomains.
|
|
387
459
|
|
|
388
460
|
## Expected outcome
|
|
461
|
+
|
|
389
462
|
- Powerhouse Connect and Switchboard services are installed, configured, and running on your server.
|
|
390
463
|
- Nginx is set up as a reverse proxy with SSL certificates from Let's Encrypt.
|
|
391
464
|
- Services are managed by PM2 and will restart automatically on boot or if they crash.
|
|
392
465
|
- You can access your services securely at `https://connect.yourdomain.com` and `https://switchboard.yourdomain.com`.
|
|
393
466
|
|
|
394
467
|
## Common issues and solutions
|
|
468
|
+
|
|
395
469
|
- **Issue:** `ph: command not found`
|
|
396
470
|
- **Solution:** Ensure you have reloaded your shell with `source ~/.bashrc` or have restarted your terminal session.
|
|
397
471
|
- **Issue:** Let's Encrypt SSL certificate creation fails.
|
|
@@ -400,25 +474,31 @@ During the setup, you will be prompted for:
|
|
|
400
474
|
- **Solution:** Check the service logs for errors using `ph service logs` or `pm2 logs`.
|
|
401
475
|
|
|
402
476
|
## Related recipes
|
|
477
|
+
|
|
403
478
|
- [Installing a Custom Powerhouse Package](#installing-a-custom-powerhouse-package)
|
|
404
479
|
|
|
405
480
|
## Further reading
|
|
481
|
+
|
|
406
482
|
- [Full Setup Guide](/academy/MasteryTrack/Launch/SetupEnvironment)
|
|
407
483
|
</details>
|
|
408
484
|
|
|
409
485
|
## Powerhouse Project recipes
|
|
486
|
+
|
|
410
487
|
This section focuses on creating, configuring, and managing Powerhouse projects, which are collections of document models, editors, and other resources.
|
|
411
488
|
|
|
412
489
|
<details id="initializing-a-new-project-and-document-model">
|
|
413
490
|
<summary>Initializing a New Project & Document Model</summary>
|
|
414
491
|
|
|
415
492
|
## How to initialize a new project and document model
|
|
493
|
+
|
|
416
494
|
---
|
|
417
495
|
|
|
418
496
|
## Problem statement
|
|
497
|
+
|
|
419
498
|
You need to create a new, empty document model within a Powerhouse project using the local Connect application (Studio mode) to represent a workflow of a business process.
|
|
420
499
|
|
|
421
500
|
## Prerequisites
|
|
501
|
+
|
|
422
502
|
- Powerhouse CLI (`ph-cmd`) installed
|
|
423
503
|
- A Powerhouse project initialized (see [Initializing a Powerhouse Project Recipe](#powerhouse-cli-recipes)) or follow Step 1 & 2 below.
|
|
424
504
|
- Access to a terminal or command prompt
|
|
@@ -427,39 +507,51 @@ You need to create a new, empty document model within a Powerhouse project using
|
|
|
427
507
|
## Solution
|
|
428
508
|
|
|
429
509
|
### Step 1: Initialize a Powerhouse Project (if needed)
|
|
510
|
+
|
|
430
511
|
If you haven't already, create a new Powerhouse project:
|
|
512
|
+
|
|
431
513
|
```bash
|
|
432
514
|
ph init
|
|
433
515
|
# Follow the prompts to name your project
|
|
434
516
|
```
|
|
435
517
|
|
|
436
518
|
### Step 2: Navigate to Project Directory
|
|
519
|
+
|
|
437
520
|
Change your current directory to the newly created project folder:
|
|
521
|
+
|
|
438
522
|
```bash
|
|
439
523
|
cd <yourprojectname>
|
|
440
524
|
```
|
|
441
525
|
|
|
442
526
|
### Step 3: Start the Local Connect Application
|
|
527
|
+
|
|
443
528
|
Run the `connect` command to start the local development environment:
|
|
529
|
+
|
|
444
530
|
```bash
|
|
445
531
|
ph connect
|
|
446
532
|
```
|
|
533
|
+
|
|
447
534
|
Wait for the output indicating the server is running (e.g., `Local: http://localhost:3000/`).
|
|
448
535
|
|
|
449
536
|
### Step 4: Open Connect in Browser
|
|
537
|
+
|
|
450
538
|
A browser window should open automatically to `http://localhost:3000/`. If not, navigate there manually.
|
|
451
539
|
|
|
452
540
|
### Step 5: Access Your Local Drive
|
|
541
|
+
|
|
453
542
|
Click on your local drive displayed on the Connect interface.
|
|
454
543
|
|
|
455
544
|
### Step 6: Create the Document Model
|
|
545
|
+
|
|
456
546
|
In the "New Document" section at the bottom of the page, click the `DocumentModel` button.
|
|
457
547
|
|
|
458
548
|
## Expected outcome
|
|
549
|
+
|
|
459
550
|
- An empty document model is created and opened in the Document Model Editor within the Connect application.
|
|
460
551
|
- You are ready to start defining the schema and logic for your new model.
|
|
461
552
|
|
|
462
553
|
## Common issues and solutions
|
|
554
|
+
|
|
463
555
|
- Issue: `ph connect` command fails.
|
|
464
556
|
- Solution: Ensure `ph-cmd` is installed correctly (`ph-cmd --version`). Check for port conflicts if `3000` is already in use. Make sure you are inside the project directory created by `ph init`.
|
|
465
557
|
- Issue: Browser window doesn't open automatically.
|
|
@@ -468,11 +560,13 @@ In the "New Document" section at the bottom of the page, click the `DocumentMode
|
|
|
468
560
|
- Solution: Ensure you have navigated into your local drive within the Connect application first.
|
|
469
561
|
|
|
470
562
|
## Related recipes
|
|
563
|
+
|
|
471
564
|
- [Initializing a Powerhouse Project](#powerhouse-cli-recipes)
|
|
472
565
|
- Designing a Document Model Schema (WIP)
|
|
473
566
|
- Implementing Document Model Reducers (Details to be added)
|
|
474
567
|
|
|
475
568
|
## Further reading
|
|
569
|
+
|
|
476
570
|
- [GraphQL Schema Best Practices](/academy/MasteryTrack/WorkWithData/GraphQLAtPowerhouse)
|
|
477
571
|
</details>
|
|
478
572
|
|
|
@@ -480,12 +574,15 @@ In the "New Document" section at the bottom of the page, click the `DocumentMode
|
|
|
480
574
|
<summary>Generating Reducers from a Document Model File</summary>
|
|
481
575
|
|
|
482
576
|
## How to Generate Reducers from a Document Model File
|
|
577
|
+
|
|
483
578
|
---
|
|
484
579
|
|
|
485
580
|
## Problem statement
|
|
581
|
+
|
|
486
582
|
You have a Powerhouse Document Model defined in a `.phdm` or `.phdm.zip` file and need to generate the corresponding reducer functions for your project.
|
|
487
583
|
|
|
488
584
|
## Prerequisites
|
|
585
|
+
|
|
489
586
|
- Powerhouse CLI (`ph-cmd`) installed
|
|
490
587
|
- A Powerhouse project initialized (`ph init`)
|
|
491
588
|
- A `.phdm` or `.phdm.zip` file containing your document model definition, placed in your project (e.g., at the root).
|
|
@@ -493,29 +590,35 @@ You have a Powerhouse Document Model defined in a `.phdm` or `.phdm.zip` file an
|
|
|
493
590
|
## Solution
|
|
494
591
|
|
|
495
592
|
### Step 1: Navigate to Project Directory
|
|
593
|
+
|
|
496
594
|
Ensure your terminal is in the root directory of your Powerhouse project.
|
|
595
|
+
|
|
497
596
|
```bash
|
|
498
597
|
cd <yourprojectname>
|
|
499
598
|
```
|
|
500
599
|
|
|
501
600
|
### Step 2: Run the Generate Command
|
|
601
|
+
|
|
502
602
|
Execute the `ph generate` command, providing the path to your document model file.
|
|
603
|
+
|
|
503
604
|
```bash
|
|
504
605
|
# Replace todo.phdm.zip with the actual filename/path of your model
|
|
505
606
|
ph generate todo.phdm.zip
|
|
506
607
|
```
|
|
507
608
|
|
|
508
609
|
### Step 3: Integrate Generated Code
|
|
509
|
-
|
|
610
|
+
|
|
611
|
+
The command will output the generated reducer scaffolding code in the designated folders.
|
|
510
612
|
|
|
511
613
|
## Expected outcome
|
|
614
|
+
|
|
512
615
|
- Reducer functions corresponding to the operations defined in your document model are generated.
|
|
513
616
|
- The generated code is ready to be integrated into your project's state management logic.
|
|
514
617
|
|
|
515
618
|
## Common issues and solutions
|
|
516
619
|
|
|
517
|
-
|
|
518
620
|
## Related recipes
|
|
621
|
+
|
|
519
622
|
- [Initializing a New Project & Document Model](#initializing-a-new-project-and-document-model)
|
|
520
623
|
- Generating a Document Editor
|
|
521
624
|
|
|
@@ -525,9 +628,11 @@ The command will output the generated reducer scaffolding code in the designated
|
|
|
525
628
|
<summary>Updating Your Powerhouse Project Dependencies</summary>
|
|
526
629
|
|
|
527
630
|
## How to Update Your Powerhouse Project Dependencies
|
|
631
|
+
|
|
528
632
|
---
|
|
529
633
|
|
|
530
634
|
## Problem statement
|
|
635
|
+
|
|
531
636
|
The update command allows you to update your Powerhouse dependencies to their latest versions based on the version ranges specified in your package.json.
|
|
532
637
|
|
|
533
638
|
```bash
|
|
@@ -535,37 +640,46 @@ ph update [options]
|
|
|
535
640
|
```
|
|
536
641
|
|
|
537
642
|
**Examples**
|
|
643
|
+
|
|
538
644
|
#### Update dependencies based on package.json ranges
|
|
645
|
+
|
|
539
646
|
```bash
|
|
540
647
|
ph update
|
|
541
648
|
```
|
|
542
649
|
|
|
543
650
|
#### Force update to latest dev versions
|
|
651
|
+
|
|
544
652
|
```bash
|
|
545
653
|
ph update --force dev
|
|
546
654
|
```
|
|
547
655
|
|
|
548
656
|
#### Force update to latest stable versions
|
|
657
|
+
|
|
549
658
|
```bash
|
|
550
659
|
ph update --force prod
|
|
551
660
|
```
|
|
552
661
|
|
|
553
662
|
#### Use a specific package manager
|
|
663
|
+
|
|
554
664
|
```bash
|
|
555
665
|
ph update --package-manager pnpm
|
|
556
666
|
```
|
|
667
|
+
|
|
557
668
|
</details>
|
|
558
669
|
|
|
559
670
|
<details id="running-connect-with-https-and-a-custom-port">
|
|
560
671
|
<summary>Running Connect with HTTPS and a Custom Port</summary>
|
|
561
672
|
|
|
562
673
|
## How to Run Connect with HTTPS and a Custom Port
|
|
674
|
+
|
|
563
675
|
---
|
|
564
676
|
|
|
565
677
|
## Problem statement
|
|
678
|
+
|
|
566
679
|
You need to run the local Powerhouse Connect application using HTTPS, possibly on a different port than the default, for scenarios like testing on a remote server (e.g., EC2) or complying with specific network requirements.
|
|
567
680
|
|
|
568
681
|
## Prerequisites
|
|
682
|
+
|
|
569
683
|
- Powerhouse CLI (`ph-cmd`) installed
|
|
570
684
|
- A Powerhouse project initialized (`ph init`)
|
|
571
685
|
- Potentially, valid SSL/TLS certificates if running in a non-localhost environment that requires trusted HTTPS. (The `--https` flag may use self-signed certificates for local development).
|
|
@@ -573,32 +687,41 @@ You need to run the local Powerhouse Connect application using HTTPS, possibly o
|
|
|
573
687
|
## Solution
|
|
574
688
|
|
|
575
689
|
### Step 1: Navigate to Project Directory
|
|
690
|
+
|
|
576
691
|
Ensure your terminal is in the root directory of your Powerhouse project.
|
|
692
|
+
|
|
577
693
|
```bash
|
|
578
694
|
cd <yourprojectname>
|
|
579
695
|
```
|
|
580
696
|
|
|
581
697
|
### Step 2: Run Connect with Flags
|
|
698
|
+
|
|
582
699
|
Execute the `ph connect` command, adding the `--https` flag to enable HTTPS and the `--port` flag followed by the desired port number.
|
|
700
|
+
|
|
583
701
|
```bash
|
|
584
702
|
# Example using port 8442
|
|
585
703
|
ph connect --port 8442 --https
|
|
586
704
|
```
|
|
587
705
|
|
|
588
706
|
### Step 3: Access Connect
|
|
707
|
+
|
|
589
708
|
Open your web browser and navigate to the specified address. Remember to use `https` and include the custom port.
|
|
709
|
+
|
|
590
710
|
```
|
|
591
711
|
https://<your-hostname-or-ip>:<port>
|
|
592
712
|
# Example: https://localhost:8442
|
|
593
713
|
# Example: https://my-ec2-instance-ip:8442
|
|
594
714
|
```
|
|
715
|
+
|
|
595
716
|
You might encounter a browser warning about the self-signed certificate; you may need to accept the risk to proceed for local/development testing.
|
|
596
717
|
|
|
597
718
|
## Expected outcome
|
|
719
|
+
|
|
598
720
|
- The Powerhouse Connect application starts and serves traffic over HTTPS on the specified port.
|
|
599
721
|
- You can access the Connect interface securely using the `https` protocol.
|
|
600
722
|
|
|
601
723
|
## Common issues and solutions
|
|
724
|
+
|
|
602
725
|
- Issue: Browser shows security warnings (e.g., "Your connection is not private").
|
|
603
726
|
- Solution: This is expected when using the default self-signed certificate generated by `--https`. For development or internal testing, you can usually proceed by accepting the risk. For production or public-facing scenarios, configure Connect with properly signed certificates (consult Powerhouse documentation for advanced configuration).
|
|
604
727
|
- Issue: Port conflict (e.g., `"Port <port> is already in use"`).
|
|
@@ -607,27 +730,32 @@ You might encounter a browser warning about the self-signed certificate; you may
|
|
|
607
730
|
- Solution: Ensure the port is open in any firewalls (on the server and potentially network firewalls). Verify you are using the correct public IP address or hostname of the machine running Connect.
|
|
608
731
|
|
|
609
732
|
## Related recipes
|
|
733
|
+
|
|
610
734
|
- [Initializing a New Project & Document Model](#initializing-a-new-project-and-document-model)
|
|
611
735
|
|
|
612
736
|
## Further reading
|
|
737
|
+
|
|
613
738
|
- [Powerhouse Builder Tools](/academy/MasteryTrack/BuilderEnvironment/BuilderTools)
|
|
614
739
|
- [GraphQL Schema Best Practices](/academy/MasteryTrack/WorkWithData/GraphQLAtPowerhouse)
|
|
615
740
|
</details>
|
|
616
741
|
|
|
617
|
-
|
|
618
742
|
## Document & Drive Editor recipes
|
|
743
|
+
|
|
619
744
|
This section provides guidance on generating and customizing editors for Document Models and custom interfaces for Drives.
|
|
620
745
|
|
|
621
746
|
<details id="generating-a-document-editor">
|
|
622
747
|
<summary>Generating a Document Editor</summary>
|
|
623
748
|
|
|
624
749
|
## How to Generate a Document Editor
|
|
750
|
+
|
|
625
751
|
---
|
|
626
752
|
|
|
627
753
|
## Problem statement
|
|
754
|
+
|
|
628
755
|
You have a Powerhouse document model and need to create a user interface (editor) for it to be used within the Connect application.
|
|
629
756
|
|
|
630
757
|
## Prerequisites
|
|
758
|
+
|
|
631
759
|
- Powerhouse CLI (`ph-cmd`) installed
|
|
632
760
|
- A Powerhouse project initialized (`ph init`)
|
|
633
761
|
- A document model generated or defined within the project (e.g., in the `document-models` directory).
|
|
@@ -635,12 +763,15 @@ You have a Powerhouse document model and need to create a user interface (editor
|
|
|
635
763
|
## Solution
|
|
636
764
|
|
|
637
765
|
### Step 1: Navigate to Project Directory
|
|
766
|
+
|
|
638
767
|
Ensure your terminal is in the root directory of your Powerhouse project.
|
|
768
|
+
|
|
639
769
|
```bash
|
|
640
770
|
cd <yourprojectname>
|
|
641
771
|
```
|
|
642
772
|
|
|
643
773
|
### Step 2: Generate the Editor Template
|
|
774
|
+
|
|
644
775
|
Run the `generate` command, specifying the editor name (usually matching the document model name) and the associated document type.
|
|
645
776
|
|
|
646
777
|
```bash
|
|
@@ -650,15 +781,18 @@ ph generate --editor <ModelName> --document-types <docType>
|
|
|
650
781
|
```
|
|
651
782
|
|
|
652
783
|
## Expected outcome
|
|
784
|
+
|
|
653
785
|
- A new directory is created under `editors/` (e.g., `editors/<model-name>/`).
|
|
654
786
|
- An `editor.tsx` file is generated within that directory, containing a basic template for your document editor.
|
|
655
787
|
- You can now customize `editor.tsx` to build your desired UI using HTML, Tailwind CSS, or custom CSS.
|
|
656
788
|
|
|
657
789
|
## Related recipes
|
|
790
|
+
|
|
658
791
|
- [Initializing a New Project & Document Model](#initializing-a-new-project-and-document-model)
|
|
659
792
|
- [Generating a Custom Drive Explorer](#generating-a-custom-drive-explorer)
|
|
660
793
|
|
|
661
794
|
## Further reading
|
|
795
|
+
|
|
662
796
|
- [Build a Todo-list Editor](/academy/GetStarted/BuildToDoListEditor)
|
|
663
797
|
</details>
|
|
664
798
|
|
|
@@ -666,24 +800,30 @@ ph generate --editor <ModelName> --document-types <docType>
|
|
|
666
800
|
<summary>Generating a Custom Drive Explorer</summary>
|
|
667
801
|
|
|
668
802
|
## How to Generate a Custom Drive Explorer
|
|
803
|
+
|
|
669
804
|
---
|
|
670
805
|
|
|
671
806
|
## Problem statement
|
|
807
|
+
|
|
672
808
|
You need a custom, application-like interface to browse, organize, or interact with specific types of documents stored within a Powerhouse drive, going beyond the standard file listing.
|
|
673
809
|
|
|
674
810
|
## Prerequisites
|
|
811
|
+
|
|
675
812
|
- Powerhouse CLI (`ph-cmd`) installed
|
|
676
813
|
- A Powerhouse project initialized (`ph init`)
|
|
677
814
|
|
|
678
815
|
## Solution
|
|
679
816
|
|
|
680
817
|
### Step 1: Navigate to Project Directory
|
|
818
|
+
|
|
681
819
|
Ensure your terminal is in the root directory of your Powerhouse project.
|
|
820
|
+
|
|
682
821
|
```bash
|
|
683
822
|
cd <yourprojectname>
|
|
684
823
|
```
|
|
685
824
|
|
|
686
825
|
### Step 2: Generate the Drive Explorer Template
|
|
826
|
+
|
|
687
827
|
Run the `generate` command, specifying the `--drive-editor` flag and a name for your drive explorer application.
|
|
688
828
|
|
|
689
829
|
```bash
|
|
@@ -692,15 +832,18 @@ ph generate --drive-editor <drive-app-name>
|
|
|
692
832
|
```
|
|
693
833
|
|
|
694
834
|
## Expected outcome
|
|
835
|
+
|
|
695
836
|
- A new directory is created under `editors/` (e.g., `editors/<drive-app-name>/`).
|
|
696
837
|
- Template files (`EditorContainer.tsx`, components, hooks, etc.) are generated within that directory, providing a basic structure for a drive explorer.
|
|
697
838
|
- You can now customize these files to create your specific drive interface, potentially removing default components and adding custom views relevant to your document models.
|
|
698
839
|
- Remember to update your `powerhouse.manifest.json` to register the new app.
|
|
699
840
|
|
|
700
841
|
## Related recipes
|
|
842
|
+
|
|
701
843
|
- [Generating a Document Editor](#generating-a-document-editor)
|
|
702
844
|
|
|
703
845
|
## Further reading
|
|
846
|
+
|
|
704
847
|
- [Build a Drive-Explorer](/academy/MasteryTrack/BuildingUserExperiences/BuildingADriveExplorer)
|
|
705
848
|
</details>
|
|
706
849
|
|
|
@@ -708,12 +851,15 @@ ph generate --drive-editor <drive-app-name>
|
|
|
708
851
|
<summary>Adding a New Drive via GraphQL Mutation</summary>
|
|
709
852
|
|
|
710
853
|
## How to Add a New Remote Drive via GraphQL Mutation
|
|
854
|
+
|
|
711
855
|
---
|
|
712
856
|
|
|
713
857
|
## Problem statement
|
|
858
|
+
|
|
714
859
|
You want to programmatically add a new remote drive to your Powerhouse Connect environment using a GraphQL mutation. This is useful for automation, scripting, or integrating with external systems.
|
|
715
860
|
|
|
716
861
|
## Prerequisites
|
|
862
|
+
|
|
717
863
|
- Access to the Switchboard or remote reactor (server node) of your Connect instance.
|
|
718
864
|
- The GraphQL endpoint for your instance (e.g., `https://staging.switchboard.phd/graphql/system`).
|
|
719
865
|
- Appropriate permissions to perform mutations.
|
|
@@ -721,13 +867,20 @@ You want to programmatically add a new remote drive to your Powerhouse Connect e
|
|
|
721
867
|
## Solution
|
|
722
868
|
|
|
723
869
|
### Step 1: Access the GraphQL Playground or Client
|
|
870
|
+
|
|
724
871
|
Open the GraphQL Playground at your endpoint (e.g., [https://staging.switchboard.phd/graphql/system](https://staging.switchboard.phd/graphql/system)), or use a GraphQL client of your choice.
|
|
725
872
|
|
|
726
873
|
### Step 2: Prepare the Mutation
|
|
874
|
+
|
|
727
875
|
Use the following mutation to create a new drive, set a name and add a drive icon. Weither or not you define a ID & Slug is up to you:
|
|
728
876
|
|
|
729
877
|
```graphql
|
|
730
|
-
mutation Mutation(
|
|
878
|
+
mutation Mutation(
|
|
879
|
+
$name: String!
|
|
880
|
+
$icon: String
|
|
881
|
+
$addDriveId: String
|
|
882
|
+
$slug: String
|
|
883
|
+
) {
|
|
731
884
|
addDrive(name: $name, icon: $icon, id: $addDriveId, slug: $slug) {
|
|
732
885
|
icon
|
|
733
886
|
id
|
|
@@ -738,6 +891,7 @@ mutation Mutation($name: String!, $icon: String, $addDriveId: String, $slug: Str
|
|
|
738
891
|
```
|
|
739
892
|
|
|
740
893
|
Example variables:
|
|
894
|
+
|
|
741
895
|
```json
|
|
742
896
|
{
|
|
743
897
|
"name": "AcademyTest",
|
|
@@ -746,9 +900,11 @@ Example variables:
|
|
|
746
900
|
"slug": null
|
|
747
901
|
}
|
|
748
902
|
```
|
|
903
|
+
|
|
749
904
|
You can also provide a custom `id`, `slug`, or `preferredEditor` if needed.
|
|
750
905
|
|
|
751
906
|
### Step 3: Execute the Mutation
|
|
907
|
+
|
|
752
908
|
Run the mutation. On success, you will receive a response containing the new drive's `icon`, `id`, `name`, and `slug`:
|
|
753
909
|
|
|
754
910
|
```json
|
|
@@ -765,41 +921,50 @@ Run the mutation. On success, you will receive a response containing the new dri
|
|
|
765
921
|
```
|
|
766
922
|
|
|
767
923
|
### Step 4: Construct the Drive URL
|
|
924
|
+
|
|
768
925
|
Once you have the `id` or `slug`, you can construct the drive URL for Connect:
|
|
926
|
+
|
|
769
927
|
- Format: `domain/d/driveId` or `domain/d/driveSlug`
|
|
770
928
|
- Example: `https://staging.connect.phd/d/6461580b-d317-4596-942d-f6b3d1bfc8fd`
|
|
771
929
|
|
|
772
930
|
### Step 5: Add the Drive in Connect
|
|
931
|
+
|
|
773
932
|
Use the constructed URL to add or access the drive in your Connect environment.
|
|
774
933
|
|
|
775
934
|
## Expected outcome
|
|
935
|
+
|
|
776
936
|
- A new drive is created and accessible in your Connect environment.
|
|
777
937
|
- The drive can be managed or accessed using the generated URL.
|
|
778
938
|
|
|
779
939
|
## Related recipes
|
|
940
|
+
|
|
780
941
|
- [Configuring Drives](/academy/MasteryTrack/BuildingUserExperiences/ConfiguringDrives)
|
|
781
942
|
- [Initializing a New Project & Document Model](#initializing-a-new-project-and-document-model)
|
|
782
943
|
|
|
783
944
|
## Further reading
|
|
945
|
+
|
|
784
946
|
- [GraphQL Playground](https://www.apollographql.com/docs/apollo-server/testing/graphql-playground/)
|
|
785
947
|
- [Powerhouse Builder Tools](/academy/MasteryTrack/BuilderEnvironment/BuilderTools)
|
|
786
948
|
|
|
787
949
|
</details>
|
|
788
950
|
|
|
789
|
-
|
|
790
951
|
## Reactor recipes
|
|
952
|
+
|
|
791
953
|
Learn how to manage the Powerhouse Reactor, the local service for processing document model operations and state.
|
|
792
954
|
|
|
793
955
|
<details id="starting-the-reactor">
|
|
794
956
|
<summary>Starting the Reactor</summary>
|
|
795
957
|
|
|
796
958
|
## How to Start the Powerhouse Reactor
|
|
959
|
+
|
|
797
960
|
---
|
|
798
961
|
|
|
799
962
|
## Problem statement
|
|
963
|
+
|
|
800
964
|
You need to start the Powerhouse Reactor, the local service responsible for processing document model operations and managing state, typically for testing or development purposes.
|
|
801
965
|
|
|
802
966
|
## Prerequisites
|
|
967
|
+
|
|
803
968
|
- Powerhouse CLI (`ph-cmd`) installed
|
|
804
969
|
- A Powerhouse project initialized (`ph init`)
|
|
805
970
|
- You are in the root directory of your Powerhouse project.
|
|
@@ -807,47 +972,58 @@ You need to start the Powerhouse Reactor, the local service responsible for proc
|
|
|
807
972
|
## Solution
|
|
808
973
|
|
|
809
974
|
### Step 1: Navigate to Project Directory (if needed)
|
|
975
|
+
|
|
810
976
|
Ensure your terminal is in the root directory of your Powerhouse project.
|
|
977
|
+
|
|
811
978
|
```bash
|
|
812
979
|
cd <yourprojectname>
|
|
813
980
|
```
|
|
814
981
|
|
|
815
982
|
### Step 2: Run the Reactor Command
|
|
983
|
+
|
|
816
984
|
Execute the `ph reactor` command.
|
|
985
|
+
|
|
817
986
|
```bash
|
|
818
987
|
ph reactor
|
|
819
988
|
```
|
|
820
989
|
|
|
821
990
|
## Expected outcome
|
|
991
|
+
|
|
822
992
|
- The Reactor service starts, typically listening on `localhost:4001`.
|
|
823
993
|
- You will see log output indicating the reactor is running and ready to process operations.
|
|
824
994
|
- A GraphQL endpoint is usually available at `http://localhost:4001/graphql` for direct interaction and testing.
|
|
825
995
|
|
|
826
996
|
## Common issues and solutions
|
|
997
|
+
|
|
827
998
|
- Issue: Reactor fails to start, mentioning port conflicts.
|
|
828
999
|
- Solution: Ensure port `4001` (or the configured reactor port) is not already in use by another application. Stop the conflicting application or configure the reactor to use a different port (if possible, check documentation).
|
|
829
1000
|
- Issue: Errors related to storage or configuration.
|
|
830
1001
|
- Solution: Check the `powerhouse.manifest.json` and any reactor-specific configuration files for errors. Ensure storage providers (like local disk) are accessible and configured correctly.
|
|
831
1002
|
|
|
832
1003
|
## Related recipes
|
|
1004
|
+
|
|
833
1005
|
- [Initializing a New Project & Document Model](#initializing-a-new-project-and-document-model)
|
|
834
1006
|
- Testing with GraphQL (Details to be added)
|
|
835
1007
|
|
|
836
1008
|
</details>
|
|
837
1009
|
|
|
838
1010
|
## Package Development recipes
|
|
1011
|
+
|
|
839
1012
|
These recipes guide you through creating, installing, and managing Powerhouse Packages, which are reusable collections of document models and editors.
|
|
840
1013
|
|
|
841
1014
|
<details id="installing-a-custom-powerhouse-package">
|
|
842
1015
|
<summary>Installing a Custom Powerhouse Package</summary>
|
|
843
1016
|
|
|
844
1017
|
## How to Install a Custom Powerhouse Package
|
|
1018
|
+
|
|
845
1019
|
---
|
|
846
1020
|
|
|
847
1021
|
## Problem statement
|
|
1022
|
+
|
|
848
1023
|
You have developed and published a Powerhouse package (containing document models, editors, etc.) to npm, or you have a local package, and you need to install it into another Powerhouse project.
|
|
849
1024
|
|
|
850
1025
|
## Prerequisites
|
|
1026
|
+
|
|
851
1027
|
- Powerhouse CLI (`ph-cmd`) installed
|
|
852
1028
|
- A Powerhouse project initialized (`ph init`) where you want to install the package.
|
|
853
1029
|
- The custom package is either published to npm or available locally.
|
|
@@ -855,21 +1031,26 @@ You have developed and published a Powerhouse package (containing document model
|
|
|
855
1031
|
## Solution
|
|
856
1032
|
|
|
857
1033
|
### Step 1: Navigate to the Target Project Directory
|
|
1034
|
+
|
|
858
1035
|
Ensure your terminal is in the root directory of the Powerhouse project where you want to install the package.
|
|
1036
|
+
|
|
859
1037
|
```bash
|
|
860
1038
|
cd <your-target-project-name>
|
|
861
1039
|
```
|
|
862
1040
|
|
|
863
1041
|
### Step 2: Install the Package
|
|
1042
|
+
|
|
864
1043
|
Use the `ph install` command followed by the package name (if published to npm) or the path to the local package.
|
|
865
1044
|
|
|
866
1045
|
**For npm packages:**
|
|
1046
|
+
|
|
867
1047
|
```bash
|
|
868
1048
|
# Replace <your-package-name> with the actual name on npm
|
|
869
1049
|
ph install <your-package-name>
|
|
870
1050
|
```
|
|
871
1051
|
|
|
872
1052
|
**For local packages (using a relative or absolute path):**
|
|
1053
|
+
|
|
873
1054
|
```bash
|
|
874
1055
|
# Example using a relative path
|
|
875
1056
|
ph install ../path/to/my-local-package
|
|
@@ -879,14 +1060,17 @@ ph install /Users/you/dev/my-local-package
|
|
|
879
1060
|
```
|
|
880
1061
|
|
|
881
1062
|
### Step 3: Verify Installation
|
|
1063
|
+
|
|
882
1064
|
Check your project's `package.json` and `powerhouse.manifest.json` to ensure the package dependency has been added correctly. Run `ph connect` to see if the components from the installed package are available.
|
|
883
1065
|
|
|
884
1066
|
## Expected outcome
|
|
1067
|
+
|
|
885
1068
|
- The custom Powerhouse package is downloaded and installed into your project's dependencies.
|
|
886
1069
|
- The `powerhouse.manifest.json` is updated (if necessary) to reflect the installed package.
|
|
887
1070
|
- Document models, editors, drive explorers, or other components from the package become available within the target project.
|
|
888
1071
|
|
|
889
1072
|
## Common issues and solutions
|
|
1073
|
+
|
|
890
1074
|
- Issue: Package not found (npm).
|
|
891
1075
|
- Solution: Double-check the package name for typos. Ensure the package is published and accessible on npm.
|
|
892
1076
|
- Issue: Path not found (local).
|
|
@@ -895,6 +1079,7 @@ Check your project's `package.json` and `powerhouse.manifest.json` to ensure the
|
|
|
895
1079
|
- Solution: Resolve version conflicts or naming collisions as needed. Review the installed package's structure and dependencies.
|
|
896
1080
|
|
|
897
1081
|
## Related recipes
|
|
1082
|
+
|
|
898
1083
|
- [Publishing a Powerhouse Package](#publishing-a-powerhouse-package)
|
|
899
1084
|
- [Initializing a Powerhouse Project](#initializing-a-new-project-and-document-model)
|
|
900
1085
|
|
|
@@ -904,16 +1089,21 @@ Check your project's `package.json` and `powerhouse.manifest.json` to ensure the
|
|
|
904
1089
|
<summary>Managing Powerhouse Dependencies and Versions</summary>
|
|
905
1090
|
|
|
906
1091
|
## How to Manage Powerhouse Dependencies and Versions
|
|
1092
|
+
|
|
907
1093
|
---
|
|
1094
|
+
|
|
908
1095
|
> **Note:** This is a temporary solution until version control is fully implemented in Powerhouse. Future updates may change how dependencies are managed.
|
|
909
1096
|
|
|
910
1097
|
## Problem statement
|
|
1098
|
+
|
|
911
1099
|
You need to understand and manage different types of dependencies in your Powerhouse project, including:
|
|
1100
|
+
|
|
912
1101
|
- Monorepo dependencies (from the Powerhouse core repository)
|
|
913
1102
|
- Project-specific dependencies (from published npm packages)
|
|
914
1103
|
- Boilerplate dependencies
|
|
915
1104
|
|
|
916
1105
|
## Prerequisites
|
|
1106
|
+
|
|
917
1107
|
- Powerhouse CLI (`ph-cmd`) installed
|
|
918
1108
|
- A Powerhouse project initialized (`ph init`)
|
|
919
1109
|
- npm account (if you need to publish packages)
|
|
@@ -928,10 +1118,11 @@ You need to understand and manage different types of dependencies in your Powerh
|
|
|
928
1118
|
- `dev` (development)
|
|
929
1119
|
- `staging` (pre-release)
|
|
930
1120
|
- You can use these branches by:
|
|
1121
|
+
|
|
931
1122
|
```bash
|
|
932
1123
|
# Install dev version of CLI
|
|
933
1124
|
pnpm install -g ph-cmd@dev
|
|
934
|
-
|
|
1125
|
+
|
|
935
1126
|
# Initialize project with dev dependencies
|
|
936
1127
|
ph init --dev
|
|
937
1128
|
```
|
|
@@ -939,13 +1130,14 @@ You need to understand and manage different types of dependencies in your Powerh
|
|
|
939
1130
|
2. **Project Dependencies**
|
|
940
1131
|
- These are dependencies from published npm packages
|
|
941
1132
|
- Update them using:
|
|
1133
|
+
|
|
942
1134
|
```bash
|
|
943
1135
|
# Update to latest stable versions
|
|
944
1136
|
ph use
|
|
945
|
-
|
|
1137
|
+
|
|
946
1138
|
# Update to development versions
|
|
947
1139
|
ph use dev
|
|
948
|
-
|
|
1140
|
+
|
|
949
1141
|
# Update to production versions
|
|
950
1142
|
ph use prod
|
|
951
1143
|
```
|
|
@@ -969,11 +1161,13 @@ You need to understand and manage different types of dependencies in your Powerh
|
|
|
969
1161
|
- For testing, you can publish to your own npm account
|
|
970
1162
|
|
|
971
1163
|
## Expected outcome
|
|
1164
|
+
|
|
972
1165
|
- Clear understanding of different dependency types
|
|
973
1166
|
- Ability to manage and update dependencies appropriately
|
|
974
1167
|
- Knowledge of when to publish updated packages
|
|
975
1168
|
|
|
976
1169
|
## Common issues and solutions
|
|
1170
|
+
|
|
977
1171
|
- Issue: Dependencies not updating as expected
|
|
978
1172
|
- Solution: Ensure you're using the correct `ph use` command for your needs
|
|
979
1173
|
- Issue: Breaking changes after updates
|
|
@@ -982,11 +1176,13 @@ You need to understand and manage different types of dependencies in your Powerh
|
|
|
982
1176
|
- Solution: Check your package.json and powerhouse.manifest.json for current versions
|
|
983
1177
|
|
|
984
1178
|
## Related recipes
|
|
1179
|
+
|
|
985
1180
|
- [Installing 'ph-cmd'](#installing-ph-cmd)
|
|
986
1181
|
- [Using Different Branches in Powerhouse](#using-different-branches-in-powerhouse)
|
|
987
1182
|
- [Setting up or Resetting the Global Powerhouse Configuration](#setting-up-or-resetting-the-global-powerhouse-configuration)
|
|
988
1183
|
|
|
989
1184
|
## Further reading
|
|
1185
|
+
|
|
990
1186
|
- [Powerhouse Builder Tools](/academy/MasteryTrack/BuilderEnvironment/BuilderTools)
|
|
991
1187
|
- [GraphQL Schema Best Practices](/academy/MasteryTrack/WorkWithData/GraphQLAtPowerhouse)
|
|
992
1188
|
|
|
@@ -996,12 +1192,15 @@ You need to understand and manage different types of dependencies in your Powerh
|
|
|
996
1192
|
<summary>Packaging and Publishing a Powerhouse Project</summary>
|
|
997
1193
|
|
|
998
1194
|
## How to Package and Publish a Powerhouse Project
|
|
1195
|
+
|
|
999
1196
|
---
|
|
1000
1197
|
|
|
1001
1198
|
## Problem statement
|
|
1199
|
+
|
|
1002
1200
|
You have created a collection of document models, editors, or other components and want to share it as a reusable package on a public or private npm registry. Publishing a package allows other projects to install and use your creations easily.
|
|
1003
1201
|
|
|
1004
1202
|
## Prerequisites
|
|
1203
|
+
|
|
1005
1204
|
- A completed Powerhouse project that you are ready to share.
|
|
1006
1205
|
- An account on [npmjs.com](https://www.npmjs.com/) (or a private registry).
|
|
1007
1206
|
- Your project's `package.json` should have a unique name and correct version.
|
|
@@ -1010,6 +1209,7 @@ You have created a collection of document models, editors, or other components a
|
|
|
1010
1209
|
## Solution
|
|
1011
1210
|
|
|
1012
1211
|
### Step 1: Build the Project
|
|
1212
|
+
|
|
1013
1213
|
First, compile your project to create a production-ready build in the `dist/` or `build/` directory.
|
|
1014
1214
|
|
|
1015
1215
|
```bash
|
|
@@ -1017,6 +1217,7 @@ pnpm build
|
|
|
1017
1217
|
```
|
|
1018
1218
|
|
|
1019
1219
|
### Step 2: Log In to npm
|
|
1220
|
+
|
|
1020
1221
|
If you aren't already, log in to your npm account. You will be prompted for your username, password, and one-time password.
|
|
1021
1222
|
|
|
1022
1223
|
```bash
|
|
@@ -1024,6 +1225,7 @@ npm login
|
|
|
1024
1225
|
```
|
|
1025
1226
|
|
|
1026
1227
|
### Step 3: Version Your Package
|
|
1228
|
+
|
|
1027
1229
|
Update the package version according to semantic versioning. This command updates `package.json` and creates a new Git tag.
|
|
1028
1230
|
|
|
1029
1231
|
```bash
|
|
@@ -1034,6 +1236,7 @@ pnpm version major # For breaking changes (e.g., 1.1.0 -> 2.0.0)
|
|
|
1034
1236
|
```
|
|
1035
1237
|
|
|
1036
1238
|
### Step 4: Publish the Package
|
|
1239
|
+
|
|
1037
1240
|
Publish your package to the npm registry. If it's your first time publishing a scoped package (e.g., `@your-org/your-package`), you may need to add the `--access public` flag.
|
|
1038
1241
|
|
|
1039
1242
|
```bash
|
|
@@ -1041,6 +1244,7 @@ npm publish --access public
|
|
|
1041
1244
|
```
|
|
1042
1245
|
|
|
1043
1246
|
### Step 5: Push Git Commits and Tags
|
|
1247
|
+
|
|
1044
1248
|
Push your new version commit and tag to your remote repository to keep it in sync.
|
|
1045
1249
|
|
|
1046
1250
|
```bash
|
|
@@ -1052,33 +1256,40 @@ git push --tags
|
|
|
1052
1256
|
```
|
|
1053
1257
|
|
|
1054
1258
|
## Expected outcome
|
|
1259
|
+
|
|
1055
1260
|
- Your Powerhouse project is successfully published to the npm registry.
|
|
1056
1261
|
- Other developers can now install your package into their projects using `ph install @your-org/your-package-name`.
|
|
1057
1262
|
- Your Git repository is updated with the new version information.
|
|
1058
1263
|
|
|
1059
1264
|
## Common issues and solutions
|
|
1265
|
+
|
|
1060
1266
|
- **Issue**: "403 Forbidden" or "You do not have permission" error on publish.
|
|
1061
1267
|
- **Solution**: Ensure your package name is unique and not already taken on npm. If it's a scoped package (`@scope/name`), make sure the organization exists and you have permission to publish to it. For public scoped packages, you must include `--access public`.
|
|
1062
1268
|
|
|
1063
1269
|
## Related recipes
|
|
1270
|
+
|
|
1064
1271
|
- [Installing a Custom Powerhouse Package](#installing-a-custom-powerhouse-package)
|
|
1065
1272
|
- [Managing Powerhouse Dependencies and Versions](#managing-powerhouse-dependencies-and-versions)
|
|
1066
1273
|
|
|
1067
1274
|
</details>
|
|
1068
1275
|
|
|
1069
1276
|
## Data Synchronisation recipes
|
|
1277
|
+
|
|
1070
1278
|
This section helps troubleshoot and understand data synchronization within the Powerhouse ecosystem, including interactions between different services and components.
|
|
1071
1279
|
|
|
1072
1280
|
<details id="troubleshooting-document-syncing">
|
|
1073
1281
|
<summary>Troubleshooting Document Syncing: Supergraph vs. Drive Endpoints</summary>
|
|
1074
1282
|
|
|
1075
1283
|
## Troubleshooting Document Syncing: Supergraph vs. Drive Endpoints
|
|
1284
|
+
|
|
1076
1285
|
---
|
|
1077
1286
|
|
|
1078
1287
|
## Problem statement
|
|
1288
|
+
|
|
1079
1289
|
You've created or modified documents within a specific drive using Powerhouse Connect, but when you query the main GraphQL endpoint (`http://localhost:4001/graphql`), you don't see the changes or the documents you expected. This can lead to confusion about whether data is being synced correctly.
|
|
1080
1290
|
|
|
1081
1291
|
## Prerequisites
|
|
1292
|
+
|
|
1082
1293
|
- Powerhouse CLI (`ph-cmd`) installed.
|
|
1083
1294
|
- A Powerhouse project initialized (`ph init`).
|
|
1084
1295
|
- The Powerhouse Reactor is running (`ph reactor`).
|
|
@@ -1090,86 +1301,99 @@ You've created or modified documents within a specific drive using Powerhouse Co
|
|
|
1090
1301
|
Understanding the different GraphQL endpoints in Powerhouse is crucial for effective troubleshooting:
|
|
1091
1302
|
|
|
1092
1303
|
1. **The Supergraph Endpoint (`http://localhost:4001/graphql`):**
|
|
1093
|
-
|
|
1094
|
-
|
|
1304
|
+
- This is the main entry point for the supergraph, which combines various subgraphs (e.g., system information, user accounts, etc.).
|
|
1305
|
+
- While you can query many things here, it's generally **not** the endpoint for direct, real-time document content operations like `pushUpdates` for a specific drive.
|
|
1095
1306
|
|
|
1096
1307
|
2. **Drive-Specific Endpoints (e.g., `http://localhost:4001/d/<driveId>` or `http://localhost:4001/d/<driveId>/graphql`):**
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1308
|
+
- Each drive (e.g., "finances", "mydocs") has its own dedicated endpoint.
|
|
1309
|
+
- Operations that modify or directly interact with the content of a specific drive, such as creating new documents or pushing updates, are typically handled by this endpoint.
|
|
1310
|
+
- When you interact with documents in Powerhouse Connect, it communicates with these drive-specific endpoints.
|
|
1100
1311
|
|
|
1101
1312
|
**Troubleshooting Steps:**
|
|
1102
1313
|
|
|
1103
1314
|
1. **Identify the Correct Endpoint:**
|
|
1104
|
-
|
|
1315
|
+
- As illustrated in the scenario where a user was looking for documents in a "finances" drive, the key realization was needing to interact with the `http://localhost:4001/d/finances` endpoint for document-specific operations, not just `http://localhost:4001/graphql`.
|
|
1105
1316
|
|
|
1106
1317
|
2. **Inspect Network Requests:**
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1318
|
+
- Open your browser's developer tools (usually by pressing F12) and go to the "Network" tab.
|
|
1319
|
+
- Perform an action in Powerhouse Connect that involves a document (e.g., creating, saving).
|
|
1320
|
+
- Look for GraphQL requests. You'll often see operations like `pushUpdates`.
|
|
1321
|
+
- Examine the "Request URL" or "Path" for these requests. You'll likely see they are being sent to a drive-specific endpoint (e.g., `/d/finances`, `/d/powerhouse`).
|
|
1322
|
+
- The payload might show `operationName: "pushUpdates"`, confirming a document modification attempt.
|
|
1112
1323
|
|
|
1113
1324
|
3. **Querying Drive Data:**
|
|
1114
|
-
|
|
1325
|
+
- If you want to query the state of documents within a specific drive via GraphQL, ensure you are targeting that drive's GraphQL endpoint (often `http://localhost:4001/d/<driveId>/graphql` or through specific queries available on the main supergraph that reference the drive). The exact query structure will depend on your document models.
|
|
1115
1326
|
|
|
1116
1327
|
4. **Clear Caches and Reset (If Necessary):**
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1328
|
+
- Sometimes, old state or cached data can cause confusion. As a general troubleshooting step if issues persist:
|
|
1329
|
+
- Try deleting the `.ph` folder in your user's home directory (`~/.ph`). This folder stores global Powerhouse configurations and cached dependencies.
|
|
1330
|
+
- Clear browser storage (localStorage, IndexedDB) for the Connect application.
|
|
1120
1331
|
|
|
1121
1332
|
## Expected outcome
|
|
1333
|
+
|
|
1122
1334
|
- You can correctly identify which GraphQL endpoint to use for different types of queries and operations.
|
|
1123
1335
|
- You understand that document-specific operations (like creating or updating documents in a drive) are typically handled by drive-specific endpoints.
|
|
1124
1336
|
- You can use browser developer tools to inspect network requests and confirm which endpoints Powerhouse Connect is using.
|
|
1125
1337
|
- Documents sync as expected, and you can retrieve their state by querying the appropriate endpoint.
|
|
1126
1338
|
|
|
1127
1339
|
## Common issues and solutions
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1340
|
+
|
|
1341
|
+
- **Issue:** Documents created in Connect don't appear when querying `http://localhost:4001/graphql`.
|
|
1342
|
+
- **Solution:** You are likely querying the general supergraph. For document-specific data, ensure you are targeting the drive's endpoint (e.g., `http://localhost:4001/d/<driveId>`) or using queries designed to fetch data from specific drives. Inspect Connect's network activity to see the endpoint it uses for `pushUpdates`.
|
|
1343
|
+
- **Issue:** Persistent syncing problems or unexpected behavior after trying the above.
|
|
1344
|
+
- **Solution:** Consider cleaning the global Powerhouse setup by removing `~/.ph`
|
|
1345
|
+
|
|
1133
1346
|
</details>
|
|
1134
1347
|
|
|
1135
1348
|
<details id="resetting-your-localhost-environment">
|
|
1136
1349
|
<summary>Resetting Your Localhost Environment</summary>
|
|
1137
1350
|
|
|
1138
1351
|
## How to Reset Your Localhost Environment
|
|
1352
|
+
|
|
1139
1353
|
---
|
|
1140
1354
|
|
|
1141
1355
|
## Problem statement
|
|
1356
|
+
|
|
1142
1357
|
You are running Powerhouse Connect locally (via `ph connect`), but you can't find your local drive in the interface. Alternatively, you can see the drive or have recreated it, but the `DocumentModel` button is missing, preventing you from creating new document model schemas.
|
|
1143
1358
|
|
|
1144
1359
|
## Prerequisites
|
|
1360
|
+
|
|
1145
1361
|
- Powerhouse Connect is running locally.
|
|
1146
1362
|
- The Powerhouse Connect interface is open in your browser.
|
|
1147
1363
|
|
|
1148
1364
|
## Solution
|
|
1365
|
+
|
|
1149
1366
|
This issue is often caused by corrupted or inconsistent data stored in your browser's local storage for the Connect application. Clearing this storage forces a re-initialization of your local environment.
|
|
1150
1367
|
|
|
1151
1368
|
### Step 1: Open Settings
|
|
1369
|
+
|
|
1152
1370
|
In the bottom-left corner of the Powerhouse Connect UI, click on the "Settings" menu.
|
|
1153
1371
|
|
|
1154
1372
|
### Step 2: Find the Danger Zone
|
|
1373
|
+
|
|
1155
1374
|
In the settings panel that appears, scroll or navigate to the "Danger Zone" section.
|
|
1156
1375
|
|
|
1157
1376
|
### Step 3: Clear Local Storage
|
|
1377
|
+
|
|
1158
1378
|
Click the "Clear storage" button. A confirmation prompt may appear. Confirming this action will wipe all application data stored in your browser for your local environment, including the state of your local drive.
|
|
1159
1379
|
|
|
1160
1380
|
### Step 4: Verify the Reset
|
|
1381
|
+
|
|
1161
1382
|
The application should automatically refresh and re-initialize its state. If it doesn't, manually reload the page. Your local drive should now be present with the `DocumentModel` button restored.
|
|
1162
1383
|
|
|
1163
1384
|
## Expected outcome
|
|
1385
|
+
|
|
1164
1386
|
- Your local drive is visible again in the Powerhouse Connect UI.
|
|
1165
1387
|
- The `DocumentModel` button is available inside the local drive.
|
|
1166
1388
|
- You can proceed to create and edit document models in your local environment.
|
|
1167
1389
|
|
|
1168
1390
|
## Common issues and solutions
|
|
1391
|
+
|
|
1169
1392
|
- **Issue**: The problem persists after clearing storage.
|
|
1170
1393
|
- **Solution**: Try clearing your browser's cache and cookies for the localhost domain. As a last resort, follow the recipe for [Clearing Package Manager Caches](#clearing-package-manager-caches) and reinstalling dependencies.
|
|
1171
1394
|
|
|
1172
1395
|
## Related recipes
|
|
1396
|
+
|
|
1173
1397
|
- [Troubleshooting Document Syncing](#troubleshooting-document-syncing)
|
|
1174
1398
|
- [Initializing a New Project & Document Model](#initializing-a-new-project-and-document-model)
|
|
1175
1399
|
|
|
@@ -1179,12 +1403,15 @@ The application should automatically refresh and re-initialize its state. If it
|
|
|
1179
1403
|
<summary>Clearing Package Manager Caches</summary>
|
|
1180
1404
|
|
|
1181
1405
|
## How to Clear Package Manager Caches
|
|
1406
|
+
|
|
1182
1407
|
---
|
|
1183
1408
|
|
|
1184
1409
|
## Problem statement
|
|
1410
|
+
|
|
1185
1411
|
You are encountering unexpected issues with dependencies, `ph-cmd` installation, or package resolution. Corrupted or outdated caches for your package manager (pnpm, npm, yarn) can often be the cause. Clearing the cache forces the package manager to refetch packages, which can resolve these problems.
|
|
1186
1412
|
|
|
1187
1413
|
## Prerequisites
|
|
1414
|
+
|
|
1188
1415
|
- Terminal or command prompt access
|
|
1189
1416
|
- A package manager (pnpm, npm, or yarn) installed
|
|
1190
1417
|
|
|
@@ -1193,6 +1420,7 @@ You are encountering unexpected issues with dependencies, `ph-cmd` installation,
|
|
|
1193
1420
|
Choose the commands corresponding to the package manager you are using.
|
|
1194
1421
|
|
|
1195
1422
|
### For pnpm
|
|
1423
|
+
|
|
1196
1424
|
`pnpm` has a robust set of commands to manage its content-addressable store.
|
|
1197
1425
|
|
|
1198
1426
|
```bash
|
|
@@ -1204,6 +1432,7 @@ pnpm store prune
|
|
|
1204
1432
|
```
|
|
1205
1433
|
|
|
1206
1434
|
### For npm
|
|
1435
|
+
|
|
1207
1436
|
`npm` provides commands to clean and verify its cache.
|
|
1208
1437
|
|
|
1209
1438
|
```bash
|
|
@@ -1215,6 +1444,7 @@ npm cache clean --force
|
|
|
1215
1444
|
```
|
|
1216
1445
|
|
|
1217
1446
|
### For Yarn (v1 Classic)
|
|
1447
|
+
|
|
1218
1448
|
Yarn Classic allows you to list and clean the cache.
|
|
1219
1449
|
|
|
1220
1450
|
```bash
|
|
@@ -1226,15 +1456,18 @@ yarn cache clean --force
|
|
|
1226
1456
|
```
|
|
1227
1457
|
|
|
1228
1458
|
## Expected outcome
|
|
1459
|
+
|
|
1229
1460
|
- The package manager's cache is cleared or verified.
|
|
1230
1461
|
- Subsequent installations will fetch fresh versions of packages, potentially resolving dependency-related errors.
|
|
1231
1462
|
- Your system is in a cleaner state for managing Powerhouse project dependencies.
|
|
1232
1463
|
|
|
1233
1464
|
## Common issues and solutions
|
|
1465
|
+
|
|
1234
1466
|
- **Issue**: Problems persist after clearing the cache.
|
|
1235
1467
|
- **Solution**: The issue might not be cache-related. Consider completely removing `node_modules` and lockfiles (`pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`) and running `pnpm install` (or equivalent) again.
|
|
1236
1468
|
|
|
1237
1469
|
## Related recipes
|
|
1470
|
+
|
|
1238
1471
|
- [Installing 'ph-cmd'](#installing-ph-cmd)
|
|
1239
1472
|
- [Uninstalling 'ph-cmd'](#uninstalling-ph-cmd)
|
|
1240
1473
|
- [Managing Powerhouse Dependencies and Versions](#managing-powerhouse-dependencies-and-versions)
|