You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/plugin-development/start-with-template.mdx
+93-3
Original file line number
Diff line number
Diff line change
@@ -10,11 +10,11 @@ sidebar:
10
10
11
11
# Re:Earth Local Setup Guide
12
12
13
-
This guide is designed to help developers set up Re:Earth locally. It includes all the necessary steps, including the installation of Go and Docker, and setting up the environment for both server and web interfaces.
13
+
This guide is designed to help developers set up Re:Earth locally and develop plugin. It includes all the necessary steps, including the installation of Go and Docker, and setting up the environment for both server and web interfaces.
14
14
15
15
## Step 1: Install Go
16
16
17
-
Before cloning the Re:Earth repository, make sure you have Go installed on your machine. Go is required for server-side operations.
17
+
Before cloning the Re:Earth repository, make sure you have Go installed on your machine.
18
18
19
19
- Download and install Go from the official site:
20
20
[Download Go](https://golang.org/dl/)
@@ -99,4 +99,94 @@ Finally, install the necessary web dependencies and start the web application:
99
99
yarn && yarn start
100
100
```
101
101
102
-
- You should now be able to access the Re:Earth visualizer locally at `http://localhost:3000/`.
102
+
- You should now be able to access the Re:Earth visualizer locally at `http://localhost:3000/`.
103
+
104
+
## Step 5: Clone the Re:Earth Plugin Repository
105
+
106
+
Now that the server is up and running, the next step is to clone the Re:Earth plugin repository you wish to edit. For this guide, we'll use the Re:Earth Visualizer Plugin Template.
This repository contains a template for creating visualizer plugins for the Re:Earth platform. It includes basic setup for plugin development such as manifest files, source code structure, and build scripts.
113
+
114
+
## Step 6: Navigate to the Plugin Directory
115
+
116
+
After cloning, navigate to the plugin directory:
117
+
118
+
```bash
119
+
cd reearth-visualizer-plugin-shadcn-template
120
+
```
121
+
122
+
## Step 7: Explore the Plugin Directory
123
+
124
+
The plugin directory contains several important files and folders. Here is the structure explained:
125
+
126
+
```plaintext
127
+
my-project/
128
+
├── node_modules/
129
+
├── public/
130
+
│ └── reearth.yml // Plugin definition
131
+
├── src/
132
+
│ ├── extensions/
133
+
│ │ └── demo/ // Extension folder, naming by extension ID
134
+
│ │ ├── main/ // UI project for the main view
135
+
│ │ └── demo.ts // Extension script
136
+
│ └── shared/
137
+
│ ├── components/ // Shared components of ShadCN
138
+
│ ├── lib/ // Shared lib of ShadCN
139
+
│ ├── reearthTypes/ // Shared Re:Earth Visualizer Plugin API types
140
+
│ ├── global.css // Shared Global CSS of tailwind
141
+
│ └── utils.ts // Utility functions
142
+
├── dist/ // Output directory of the plugin build
143
+
├── dist-ui/ // Output directory for the UI build
144
+
├── package/ // Directory for packaging the plugin into a zip file
145
+
├── configs/ // Vite configuration files for both extensions and UI
146
+
├── scripts/
147
+
├── package.json
148
+
└── README.md
149
+
```
150
+
151
+
## Step 8: Install Dependencies
152
+
153
+
Before making any changes, install the necessary dependencies to ensure the plugin can be built and tested locally.
154
+
155
+
```bash
156
+
yarn install
157
+
```
158
+
159
+
## Step 9: Simplify Plugin Development with Re:Earth Visualizer
160
+
161
+
Utilize the `yarn dev-build` command to streamline the development and testing process for your Re:Earth plugins. This approach is designed to enhance efficiency and speed in plugin development.
162
+
163
+
### Step 9.1 Execute the Development Script:
164
+
165
+
Start by running the `yarn dev-build` script to automate your development setup:
166
+
167
+
```bash
168
+
yarn dev-build
169
+
```
170
+
171
+
This script efficiently orchestrates several operations:
172
+
173
+
-**Starts a Development Server**: Automatically initiates a server dedicated to UI development.
174
+
-**Automates UI Builds**: Continuously compiles the UI as you make changes.
175
+
-**Compiles Extension Scripts**: Concurrently builds your extension scripts.
176
+
-**Launches a Preview Server**: Serves your plugin at `http://localhost:5005`.
177
+
-**Configures Environment Variables**: Automatically updates `REEARTH_WEB_DEV_PLUGIN_URLS='["http://localhost:5005"]'`, triggering a server restart upon changes to `.env`.
178
+
179
+
### Step 9.2 Utilize Visualizer Tools:
180
+
181
+
After running the `yarn dev-build`, use the integrated tools in Re:Earth Visualizer for efficient testing and deployment:
182
+
183
+
-**Install Dev Plugins**:
184
+
185
+
- This tool fetches plugin files directly from the preview server, automatically zips them, and facilitates their installation.
186
+
-**When to Use**: Click this button when initially setting up your development environment or after any modifications to `reearth.yml`.
187
+
188
+
-**Reload Dev Plugin Extensions**: 
189
+
- This tool rapidly reloads all plugin extensions from the preview server.
190
+
-**Advantage**: Reloading only the plugin itself, not the entire page, significantly accelerates the development cycle.
191
+
192
+
By following this process, you can enhance your productivity and reduce the time spent on repetitive tasks, allowing you to focus more on creative aspects of plugin development. Enjoy your debvelopment life!
0 commit comments