Skip to content

Commit

Permalink
Added example project
Browse files Browse the repository at this point in the history
  • Loading branch information
nyan-left committed Jan 12, 2024
1 parent 891c485 commit 706a725
Show file tree
Hide file tree
Showing 15 changed files with 5,121 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build and deploy

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: volta-cli/action@v1
- run: npm install
- run: npm run build --if-present
env:
CI: true

- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: dist
CLEAN: true
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.parcel-cache
dist
lib
6 changes: 6 additions & 0 deletions .parcelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "@parcel/config-default",
"transformers": {
"*.zcomp": ["@zappar/parcel-transformer-mattercraft"]
}
}
99 changes: 98 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,99 @@
# parcel-transformer-mattercraft-example
An example project that builds and serves mattercraft projects using parcel.

## Overview

This example project, originally exported from Mattercraft, demonstrates how to set up and serve a [Mattercraft](https://zap.works/mattercraft/) project using Parcel and the [@zappar/parcel-transformer-mattercraft](https://www.npmjs.com/package/@zappar/parcel-transformer-mattercraft) plugin.

The source files of the Mattercraft project have been relocated to a custom directory named `project` for organizational purposes. This project focuses on integrating HTML within Mattercraft scenes to create interactive user interfaces.

### Key Features

- Integration of HTML and Button nodes for user interaction.
- Use of Animation states in the 'UI' layer for UI visibility control.
- A customizable splash page for a better user experience.

### Prerequisites

- Ensure `Parcel` `@zappar/parcel-transformer-mattercraft` are installed. If not, install via npm:

```bash
npm i --save-dev parcel @zappar/parcel-transformer-mattercraft
```

## Installation

1 - Clone or download this example project.
2 - Navigate to the project's root directory.
3 - Install the necessary dependencies:

```bash
npm install
```

## Project Structure

- `/project`: Contains the Mattercraft project files that were exported and then moved into this directory.
- `Root Directory`: Contains package.json and .parcelrc.

## Configuration

### Parcel Configuration

The `.parcelrc` file in the root directory is configured as follows:

```json
{
"extends": "@parcel/config-default",
"transformers": {
"*.zcomp": ["@zappar/parcel-transformer-mattercraft"]
}
}
```

This setup instructs Parcel to process `.zcomp` files using the `@zappar/parcel-transformer-mattercraft.`

### Package.json Scripts

The `package.json` file includes these scripts:

```json
"scripts": {
"start": "parcel serve ./project/index.html",
"build": "parcel build ./project/index.html"
}
```

These scripts reference the relocated project files in the `/project` directory.

## Usage

To start the development server, run:

```bash
npm run start
```

To build the project for production, run:

```bash
npm run build
```

### HTTPS Requirement

For camera access, secure context (HTTPS) is required. The start script can be modified to include the --https flag:

```json
"scripts": {
"start": "parcel serve ./project/src/index.html --https",
"build": "parcel build ./project/src/index.html"
}
```

This README provides a complete guide for setting up and running the local Mattercraft project.

For more detailed information on Mattercraft's specific features and configurations, please refer to the Mattercraft, Parcel and transformer documentation pages.

- <https://docs.zap.works/mattercraft>
- <https://parceljs.org/docs/>
- <https://www.npmjs.com/package/@zappar/parcel-transformer-mattercraft>
Loading

0 comments on commit 706a725

Please sign in to comment.