@powerhousedao/academy 4.1.0-staging.1 → 5.0.0-staging.10
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 +127 -1
- 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 +61 -24
- package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +21 -12
- 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-SpecDrivenAI.md +143 -0
- package/docs/academy/01-GetStarted/home.mdx +185 -90
- 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 +26 -11
- 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 +9 -7
- 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 +267 -34
- 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 +1 -1
- package/scripts/generate-combined-cli-docs.ts +43 -13
- package/sidebars.ts +1 -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/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-StandardDocumentModelWorkflow.md
CHANGED
|
@@ -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
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
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
|
|
50
|
-
|
|
51
|
-
| **pnpm install -g ph-cmd**
|
|
52
|
-
| **pnpm install -g ph-cmd@dev**
|
|
53
|
-
| **pnpm install -g ph-cmd@staging** | Install staging version
|
|
54
|
-
| **ph init**
|
|
55
|
-
| **ph init --dev**
|
|
56
|
-
| **ph init --staging**
|
|
57
|
-
| **ph use**
|
|
58
|
-
| **ph use dev**
|
|
59
|
-
| **ph use prod**
|
|
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
|
-
|
|
80
|
-
-
|
|
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
|
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
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
|
-
|
|
110
|
-
-
|
|
111
|
-
-
|
|
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
|
-
|
|
116
|
-
-
|
|
117
|
-
|
|
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
|
-
|
|
128
|
-
-
|
|
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
|
-
|
|
150
|
-
-
|
|
151
|
-
-
|
|
152
|
-
-
|
|
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
|
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
-
|
|
160
|
-
-
|
|
161
|
-
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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": [
|
|
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"
|
|
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"
|
|
242
|
+
"name": "YourModelName" // Human-readable name
|
|
205
243
|
}
|
|
206
244
|
],
|
|
207
245
|
"editors": [
|
|
208
246
|
{
|
|
209
|
-
"id": "your-editor-id",
|
|
210
|
-
"name": "YourModelName Editor",
|
|
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.
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
# Powerhouse builder tooling
|
|
2
2
|
|
|
3
|
-
This page provides an overview of all the builder tooling offered by the Powerhouse ecosystem.
|
|
3
|
+
This page provides an overview of all the builder tooling offered by the Powerhouse ecosystem.
|
|
4
4
|
This list will be maintained and updated as our toolkit grows.
|
|
5
5
|
|
|
6
6
|
## Powerhouse command line interface
|
|
7
|
-
___
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
### Installing the Powerhouse CLI
|
|
11
|
+
|
|
10
12
|
:::tip
|
|
11
|
-
The Powerhouse CLI tool is the only essential tool to install on this page.
|
|
13
|
+
The Powerhouse CLI tool is the only essential tool to install on this page.
|
|
12
14
|
Once you've installed it with the command below you can continue to the next steps.
|
|
13
15
|
:::
|
|
14
16
|
|
|
15
17
|
The Powerhouse CLI (`ph-cmd`) is a command-line interface tool that provides essential commands for managing Powerhouse projects. You can get access to the Powerhouse ecosystem tools by installing them globally using:
|
|
18
|
+
|
|
16
19
|
```bash
|
|
17
20
|
pnpm install -g ph-cmd
|
|
18
|
-
```
|
|
21
|
+
```
|
|
19
22
|
|
|
20
23
|
Key commands include:
|
|
24
|
+
|
|
21
25
|
- `ph connect` for running the Connect application locally
|
|
22
26
|
- `ph switchboard` or `ph reactor` for starting the API service
|
|
23
27
|
- `ph init` to start a new project and build a Document Model
|
|
@@ -30,19 +34,20 @@ This tool will be fundamental on your journey when creating, building, and runni
|
|
|
30
34
|
|
|
31
35
|
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.
|
|
32
36
|
|
|
33
|
-
| Command
|
|
34
|
-
|
|
35
|
-
| **pnpm install -g ph-cmd**
|
|
36
|
-
| **pnpm install -g ph-cmd@dev**
|
|
37
|
-
| **pnpm install -g ph-cmd@staging** | Install staging version
|
|
38
|
-
| **ph init**
|
|
39
|
-
| **ph init --dev**
|
|
40
|
-
| **ph init --staging**
|
|
41
|
-
| **ph use**
|
|
42
|
-
| **ph use dev**
|
|
43
|
-
| **ph use prod**
|
|
37
|
+
| Command | Description |
|
|
38
|
+
| ---------------------------------- | ----------------------------------------------------- |
|
|
39
|
+
| **pnpm install -g ph-cmd** | Install latest stable version |
|
|
40
|
+
| **pnpm install -g ph-cmd@dev** | Install development version |
|
|
41
|
+
| **pnpm install -g ph-cmd@staging** | Install staging version |
|
|
42
|
+
| **ph init** | Use latest stable version of the boilerplate |
|
|
43
|
+
| **ph init --dev** | Use development version of the boilerplate |
|
|
44
|
+
| **ph init --staging** | Use staging version of the boilerplate |
|
|
45
|
+
| **ph use** | Switch all dependencies to latest production versions |
|
|
46
|
+
| **ph use dev** | Switch all dependencies to development versions |
|
|
47
|
+
| **ph use prod** | Switch all dependencies to production versions |
|
|
44
48
|
|
|
45
49
|
Please be aware that these versions can contain bugs and experimental features that aren't fully tested.
|
|
50
|
+
|
|
46
51
|
</details>
|
|
47
52
|
|
|
48
53
|
<details>
|
|
@@ -54,16 +59,19 @@ Please be aware that these versions can contain bugs and experimental features t
|
|
|
54
59
|
If you need to perform a clean reinstallation of the Powerhouse CLI (`ph-cmd`), follow these steps:
|
|
55
60
|
|
|
56
61
|
1. First, uninstall the global ph-cmd package:
|
|
62
|
+
|
|
57
63
|
```bash
|
|
58
64
|
pnpm uninstall -g ph-cmd
|
|
59
65
|
```
|
|
60
66
|
|
|
61
67
|
2. Remove the Powerhouse configuration directory:
|
|
68
|
+
|
|
62
69
|
```bash
|
|
63
70
|
rm -rf ~/.ph
|
|
64
71
|
```
|
|
65
72
|
|
|
66
73
|
3. Reinstall the CLI tool (choose one):
|
|
74
|
+
|
|
67
75
|
```bash
|
|
68
76
|
# For the latest stable version
|
|
69
77
|
pnpm install -g ph-cmd
|
|
@@ -76,20 +84,24 @@ pnpm install -g ph-cmd@<version>
|
|
|
76
84
|
```
|
|
77
85
|
|
|
78
86
|
This process ensures a clean slate by removing both the CLI tool and its configuration files before installing the desired version. It's particularly useful when:
|
|
87
|
+
|
|
79
88
|
- Troubleshooting CLI issues
|
|
80
89
|
- Upgrading to a new version
|
|
81
90
|
- Switching between stable and staging versions
|
|
82
|
-
- Resolving configuration conflicts
|
|
91
|
+
- Resolving configuration conflicts
|
|
83
92
|
|
|
84
93
|
</details>
|
|
85
94
|
|
|
86
95
|
### The use command
|
|
96
|
+
|
|
87
97
|
The use command allows you to switch between different environments for your Powerhouse project dependencies.
|
|
88
98
|
|
|
89
99
|
```bash
|
|
90
100
|
ph use <environment> [localPath]
|
|
91
|
-
```
|
|
101
|
+
```
|
|
102
|
+
|
|
92
103
|
**Available Environments**
|
|
104
|
+
|
|
93
105
|
- latest - Uses the latest stable version of all Powerhouse packages.
|
|
94
106
|
- dev - Uses development versions of the packages.
|
|
95
107
|
- prod - Uses production versions of the packages.
|
|
@@ -98,26 +110,31 @@ ph use <environment> [localPath]
|
|
|
98
110
|
**Examples**
|
|
99
111
|
|
|
100
112
|
#### Switch to latest stable versions
|
|
113
|
+
|
|
101
114
|
```bash
|
|
102
115
|
ph use latest
|
|
103
|
-
```
|
|
116
|
+
```
|
|
104
117
|
|
|
105
118
|
#### Switch to development versions
|
|
119
|
+
|
|
106
120
|
```bash
|
|
107
121
|
ph use dev
|
|
108
|
-
```
|
|
122
|
+
```
|
|
109
123
|
|
|
110
124
|
#### Use local versions from a specific path
|
|
125
|
+
|
|
111
126
|
```bash
|
|
112
127
|
ph use local /path/to/local/packages
|
|
113
|
-
```
|
|
128
|
+
```
|
|
114
129
|
|
|
115
130
|
#### Use a specific package manager
|
|
131
|
+
|
|
116
132
|
```bash
|
|
117
133
|
ph use latest --package-manager pnpm
|
|
118
|
-
```
|
|
134
|
+
```
|
|
119
135
|
|
|
120
136
|
### The update command
|
|
137
|
+
|
|
121
138
|
The update command allows you to update your Powerhouse dependencies to their latest versions based on the version ranges specified in your package.json.
|
|
122
139
|
|
|
123
140
|
```bash
|
|
@@ -125,22 +142,27 @@ ph update [options]
|
|
|
125
142
|
```
|
|
126
143
|
|
|
127
144
|
**Examples**
|
|
145
|
+
|
|
128
146
|
#### Update dependencies based on package.json ranges
|
|
147
|
+
|
|
129
148
|
```bash
|
|
130
149
|
ph update
|
|
131
150
|
```
|
|
132
151
|
|
|
133
152
|
#### Force update to latest dev versions
|
|
153
|
+
|
|
134
154
|
```bash
|
|
135
155
|
ph update --force dev
|
|
136
156
|
```
|
|
137
157
|
|
|
138
158
|
#### Force update to latest stable versions
|
|
159
|
+
|
|
139
160
|
```bash
|
|
140
161
|
ph update --force prod
|
|
141
162
|
```
|
|
142
163
|
|
|
143
164
|
#### Use a specific package manager
|
|
165
|
+
|
|
144
166
|
```bash
|
|
145
167
|
ph update --package-manager pnpm
|
|
146
168
|
```
|
|
@@ -148,11 +170,13 @@ ph update --package-manager pnpm
|
|
|
148
170
|
## **Key differences**
|
|
149
171
|
|
|
150
172
|
### **Use command**
|
|
173
|
+
|
|
151
174
|
- For switching between different **environments**.
|
|
152
175
|
- Requires you to specify an environment.
|
|
153
176
|
- Can work with **local packages**.
|
|
154
177
|
|
|
155
178
|
### **Update command**
|
|
179
|
+
|
|
156
180
|
- Updating **dependencies** within your current environment.
|
|
157
181
|
- Optional with its parameters.
|
|
158
182
|
- Focused on updating **remote package** versions.
|
|
@@ -160,12 +184,15 @@ ph update --package-manager pnpm
|
|
|
160
184
|
Both commands support multiple package managers (npm, yarn, pnpm, and bun) and will automatically detect your project's package manager based on the lockfile present in your project directory.
|
|
161
185
|
|
|
162
186
|
## Boilerplate
|
|
163
|
-
___
|
|
164
|
-
The Document Model Boilerplate is a foundational template that is used for code generation when scaffolding your editors and models. It ensures compatibility with host applications like Connect and Switchboard for seamless Document Model and editor integration.
|
|
165
187
|
|
|
166
|
-
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
The Document Model Boilerplate is a foundational template that is used for code generation when scaffolding your editors and models. It ensures compatibility with host applications like Connect and Switchboard for seamless Document Model and editor integration.
|
|
191
|
+
|
|
192
|
+
After installing `ph-cmd`, you will run `ph init` to initialize a project directory and structure. This initialization command makes use of the boilerplate.
|
|
167
193
|
|
|
168
194
|
The boilerplate includes essential commands with NPM/PNPM scripts for:
|
|
195
|
+
|
|
169
196
|
- Generating code
|
|
170
197
|
- Linting
|
|
171
198
|
- Formatting
|
|
@@ -173,8 +200,11 @@ The boilerplate includes essential commands with NPM/PNPM scripts for:
|
|
|
173
200
|
- Testing
|
|
174
201
|
|
|
175
202
|
## Design system
|
|
176
|
-
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
177
206
|
The Powerhouse Design System is a collection of reusable front-end components based on GraphQL scalars, including custom scalars specific to the web3 ecosystem. It provides:
|
|
207
|
+
|
|
178
208
|
- Consistent UI components across Powerhouse applications
|
|
179
209
|
- Automatic inclusion as a dependency in new Document Model projects
|
|
180
210
|
- Customization options using CSS variables
|
|
@@ -182,29 +212,37 @@ The Powerhouse Design System is a collection of reusable front-end components ba
|
|
|
182
212
|
We cover some of these topics in our design system documentation. Read more about the [design system here](/academy/ComponentLibrary/DocumentEngineering)
|
|
183
213
|
|
|
184
214
|
## Reactor libraries
|
|
185
|
-
|
|
186
|
-
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
Reactors are the nodes in the Powerhouse network that handle document storage, conflict resolution, and operation verification.
|
|
187
219
|
The Reactor Libraries include:
|
|
188
220
|
|
|
189
221
|
### API
|
|
222
|
+
|
|
190
223
|
- **Subgraphs**: Modular GraphQL services that connect to the Reactor for structured data access
|
|
191
224
|
- **Processors**: Event-driven components that react to document changes and process data
|
|
192
225
|
|
|
193
226
|
### Browser
|
|
227
|
+
|
|
194
228
|
Handles client-side interactions
|
|
195
229
|
|
|
196
230
|
### Local
|
|
231
|
+
|
|
197
232
|
Manages local storage and offline functionality
|
|
198
233
|
|
|
199
234
|
### Drive app
|
|
200
|
-
|
|
235
|
+
|
|
236
|
+
Handles document organization and storage management, but can also be customized to offer specific functionality, categorization, or tailored interfaces for your documents.
|
|
201
237
|
|
|
202
238
|
## Code generators
|
|
203
|
-
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
204
242
|
Powerhouse provides several code generation tools to streamline development:
|
|
205
243
|
|
|
206
244
|
### Document model scaffolding
|
|
207
|
-
Generates the basic structure for new Document Models with the command `ph init` based on the boilerplate.
|
|
245
|
+
Generates the basic structure for new Document Models with the command `ph init` based on the boilerplate.
|
|
208
246
|
|
|
209
247
|
### Editor generator
|
|
210
248
|
Creates template code for Document Model editors with the command `ph generate --editor <name> --document-types <documenttype>`
|
|
@@ -222,14 +260,18 @@ Powerhouse provides several code generation tools to streamline development:
|
|
|
222
260
|
Creates specialized processors for analytics tracking
|
|
223
261
|
|
|
224
262
|
## Analytics engine
|
|
225
|
-
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
226
266
|
The Analytics Engine is a system that allows tracking and analyzing operations and state changes on Document Models. Features include:
|
|
267
|
+
|
|
227
268
|
- Custom dashboard and report generation
|
|
228
269
|
- Document Model-specific analytics
|
|
229
270
|
- Metric and dimension tracking
|
|
230
271
|
- Data combination from multiple Document Models
|
|
231
272
|
|
|
232
273
|
Generate an analytics processor using:
|
|
274
|
+
|
|
233
275
|
```bash
|
|
234
276
|
ph generate --processor-type analytics
|
|
235
|
-
```
|
|
277
|
+
```
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
"label": "Builder environment",
|
|
3
|
+
"link": {
|
|
4
|
+
"type": "doc",
|
|
5
|
+
"id": "academy/MasteryTrack/BuilderEnvironment/Prerequisites"
|
|
6
|
+
}
|
|
7
|
+
}
|