Skip to content

Commit

Permalink
add moonbit langauge tour
Browse files Browse the repository at this point in the history
  • Loading branch information
Bao Zhiyuan committed Dec 13, 2024
1 parent 08339be commit 32c4b25
Show file tree
Hide file tree
Showing 78 changed files with 3,453 additions and 194 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/tour-page.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy language tour to Pages

on:
# Runs on pushes targeting 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:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- uses: pnpm/action-setup@v4
with:
version: 9
- run: |
cd moonbit-tour
pnpm install
pnpm build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './moonbit-tour/dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
25 changes: 25 additions & 0 deletions moonbit-tour/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
**/target
1 change: 1 addition & 0 deletions moonbit-tour/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v22.10.0
4 changes: 4 additions & 0 deletions moonbit-tour/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
assets
public
tour
pnpm-lock.yaml
3 changes: 3 additions & 0 deletions moonbit-tour/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["prettier-plugin-tailwindcss", "prettier-plugin-organize-imports"]
}
42 changes: 42 additions & 0 deletions moonbit-tour/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# MoonBit Language Tour

An interactive tour to learn the MoonBit programming language.

## Get started

```sh
pnpm install
pnpm build
pnpm preview
```

open <http://localhost:4173> to view the tour.

## How to add new tour

### Add new lesson

1. Create a new folder under the chapter folder following the naming convention `lesson<n>_<lesson-name>` (count start from 1).
1. Write the lesson content in `index.md` and lesson code in `index.mbt` under the created folder.

To see the render result while writing lesson on the fly, follow the instruction below:

1. Setup development environment.

```sh
pnpm install
pnpm dev
```

1. Write the lesson content in `tour/index.md` and lesson code in `tour/index.mbt`. You can see the render result in <http://localhost:5173>

1. After you finish writing the lesson, copy `tour/index.md` and `tour/index.mbt` to the corresponding lesson folder.

### Add new chapter

1. Create a new folder under `tour` following the naming convention `chapter<n>_<chapter-name>`.
1. Add new lessons following the instruction above.

## Credit

This project is highly inspired by [Gleam Language Tour](https://github.com/gleam-lang/language-tour).
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 32c4b25

Please sign in to comment.