Skip to content

Commit

Permalink
Start Work on Documentation (#74)
Browse files Browse the repository at this point in the history
* init bug / feat templates

* capital J for style

* PR templates

* Combine templates because github be like that

* Out with the old

* package and package lock files

* Deploy docs workflow

* Absolutely massive commit (docs)

* Delete cache and add to gitignore

* Goodbye cache
  • Loading branch information
EncodedVenom authored Jul 13, 2024
1 parent d76f343 commit 8e92257
Show file tree
Hide file tree
Showing 21 changed files with 2,355 additions and 376 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Sample workflow for building and deploying a VitePress site to GitHub Pages
#
name: Deploy VitePress site to Pages

on:
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
# using the `master` branch as the default branch.
push:
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
# - uses: pnpm/action-setup@v3 # Uncomment this if you're using pnpm
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm # or pnpm / yarn
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: npm ci # or pnpm install / yarn install / bun install
- name: Build with VitePress
run: npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,11 @@ WallyPatches
roblox.toml
sourcemap.json
drafts/*.lua

# Cached Vitepress (docs)

/docs/.vitepress/cache
/docs/.vitepress/dist

.vitepress/cache
.vitepress/dist
57 changes: 57 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { defineConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "Jecs",
base: "/Jecs/",
description: "A VitePress Site",
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Home', link: '/' },
{ text: 'Examples', link: '/markdown-examples' }
],

sidebar: [
{
text: 'Overview',
items: [
{ text: 'Getting Started', link: '/overview/get-started' },
{ text: 'First Jecs Project', link: '/overview/first-jecs-project' }
]
},
{
text: 'Concepts',
items: [
{ text: 'Entities', link: '/concepts/entities' },
{ text: 'Static Components', link: '/concepts/static-components' },
{ text: 'Queries', link: '/concepts/queries' },
]
},
{
text: 'References',
items: [
{ text: 'API Reference', link: '/api' },
]
},
{
text: "FAQ",
items: [
{ text: 'How can I contribute?', link: '/faq/contributing' }
]
},
{
text: 'Contributing',
items: [
{ text: 'Contribution Guidelines', link: '/contributing/guidelines'},
{ text: 'Submitting Issues', link: '/contributing/issues'},
{ text: 'Submitting Pull Requests', link: '/contributing/pull-requests'},
]
}
],

socialLinks: [
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' }
]
}
})
45 changes: 0 additions & 45 deletions docs/api-types.md

This file was deleted.

59 changes: 59 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# API

## World

### World.new() -> `World`
Creates a new world.

Example:
::: code-group

```luau [luau]
local world = jecs.World.new()
```

```ts [typescript]
import { World } from "@rbxts/jecs";

const world = new World();
```

:::

### world:entity() -> `Entity<T>`
Creates a new entity.

Example:
::: code-group

```luau [luau]
local entity = world:entity()
```

```ts [typescript]
const entity = world.entity();
```

:::

### world:component() -> `Entity<T>`
Creates a new static component. Keep in mind that components are also entities.

Example:
::: code-group

```luau [luau]
local Health = world:component()
```

```ts [typescript]
const Health = world.component<number>();
```

:::

::: info
You should use this when creating static components.

For example, a generic Health entity should be created using this.
:::
Loading

0 comments on commit 8e92257

Please sign in to comment.