Skip to content

Commit a1dfa08

Browse files
authored
Merge pull request #165 from nsalminen/readme-instructions
Improve local development workflow/instructions
2 parents 081b034 + ec58d0a commit a1dfa08

File tree

7 files changed

+837
-31
lines changed

7 files changed

+837
-31
lines changed

README.md

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,28 +132,58 @@ code below:
132132
</html>
133133
```
134134

135-
### Development guide
135+
### Development Guide
136136

137-
Follow the steps below to clone the repository and build XR Blocks:
137+
#### Setup
138138

139139
```bash
140140
# Clone the repository.
141141
git clone --depth=1 git@github.com:google/xrblocks.git
142142
cd xrblocks
143143

144-
# Install dependencies.
144+
# Install dependencies and build the SDK.
145145
npm ci
146+
```
147+
148+
After setup, either serve the samples and demos or develop locally, as
149+
described below.
150+
151+
#### Serve samples and demos
152+
153+
Serve the repository to view samples and demos through
154+
`http://localhost:8080/`:
155+
156+
```bash
157+
# Serve the repository on http://localhost:8080
158+
npm run serve
159+
```
160+
161+
#### Develop locally
146162

147-
# Build xrblocks.js.
148-
npm run build
163+
For active SDK development, run watch mode and local serving together:
149164

150-
# After making changes, check ESLint and run Prettier
165+
```bash
166+
# Build the SDK in watch mode and serve the repository on http://localhost:8080
167+
npm run dev
168+
```
169+
170+
#### Linting and formatting
171+
172+
XR Blocks uses ESLint for linting and Prettier for formatting. Run the
173+
following commands to check your code before submitting a pull request:
174+
175+
```bash
151176
npm run lint # ESLint check
152177
npm run format # Prettier format
153178
```
154179

155-
XR Blocks uses ESLint for linting and Prettier for formatting.
156-
If coding in VSCode, make sure to install the [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and the [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode). Then set Prettier as your default formatter.
180+
If you are using VS Code, install the
181+
[ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
182+
and the
183+
[Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode),
184+
then set Prettier as your default formatter.
185+
186+
#### Notice
157187

158188
This is not an officially supported Google product, but will be actively
159189
maintained by the XR Labs team and external collaborators. This project is not

demos/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ everyone so they may bring their ideas to life faster.
88
For basic demo to demonstrate the use of a particular module, we suggest you
99
submit to `/samples/`.
1010

11+
## Running Demos Locally
12+
13+
Follow the [development guide](../README.md#development-guide) to serve the
14+
repository, then open your demo path, for example:
15+
16+
- `http://localhost:8080/demos/math3d/`
17+
1118
## Contributing a New Demo
1219

1320
### Step 1: Clone this repository and sign contributor agreement

docs/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ This website is built using [Docusaurus](https://docusaurus.io/).
88
Start the development server for the documentation:
99

1010
```bash
11-
# In the xrblocks/docs folder:
11+
# In the xrblocks/docs/ directory
1212
npm start
1313
```
1414

15-
For templates and samples in the documentation site to be loaded, a web server needs to be started in the `xrblocks` folder:
15+
This serves the documentation site locally at `http://localhost:3000/` and
16+
watches for changes to the documentation source files.
1617

17-
```bash
18-
# In the xrblocks folder:
19-
npm run build
20-
http-server --cors
21-
```
18+
When viewing docs pages that embed templates or samples, **also** follow the
19+
[development guide](../README.md#development-guide) in the root README to serve
20+
the SDK on port 8080. Both servers can run simultaneously.
2221

2322
## Deployment
2423

25-
The documentation site is automatically deployed to https://xrblocks.github.io/docs/ whenever it is updated in the [google/xrblocks](https://github.com/google/xrblocks) repository.
24+
The documentation site is automatically deployed to https://xrblocks.github.io/docs/
25+
whenever it is updated in the [google/xrblocks](https://github.com/google/xrblocks) repository.

0 commit comments

Comments
 (0)