Skip to content

Commit

Permalink
Merge pull request #352 from moonbitlang/zhiyuan/add-tour
Browse files Browse the repository at this point in the history
add moonbit langauge tour
  • Loading branch information
bzy-debug authored Dec 13, 2024
2 parents 08339be + 56713dd commit 3792d34
Show file tree
Hide file tree
Showing 81 changed files with 3,464 additions and 200 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- name: install
run: |
pnpm install
Expand All @@ -36,8 +34,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- name: install
run: |
pnpm install
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/tour-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: check langauge tour

on:
pull_request:
branches: main

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: install
run: |
pnpm install
- name: check
run: |
cd moonbit-tour
pnpm build
47 changes: 47 additions & 0 deletions .github/workflows/tour-page.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 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
- run: pnpm install
- run: |
cd moonbit-tour
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
2 changes: 0 additions & 2 deletions .github/workflows/website-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- name: install
run: |
pnpm install
Expand Down
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 3792d34

Please sign in to comment.