Skip to content

Commit

Permalink
Merge pull request #2 from sasial-dev/docs
Browse files Browse the repository at this point in the history
Add Docs
  • Loading branch information
jackdotink authored Dec 17, 2023
2 parents ad18860 + 2ad94e3 commit ec00da1
Show file tree
Hide file tree
Showing 22 changed files with 2,227 additions and 2 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Docs

on:
workflow_dispatch: {}
push:
branches:
- main

jobs:
deploy:
name: Deploy Docs
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
cache: yarn
- name: Get latest zap release
uses: robinraju/[email protected]
with:
latest: true
fileName: "zap-*-wasm.tgz"
out-file-path: "staging"
- name: Extract file
run: tar -xvzf staging/zap-*-wasm.tgz -C zap
- name: Install Dependencies
run: yarn install --frozen-lockfile --force
- name: Build
run: yarn docs:build
- uses: actions/configure-pages@v2
- uses: actions/upload-pages-artifact@v1
with:
path: docs/.vitepress/dist
- name: Deploy
id: deployment
uses: actions/deploy-pages@v1
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,54 @@ jobs:
with:
name: ${{ env.BIN }}-${{ env.PROJECT_VERSION }}-${{ matrix.label }}.zip
path: release.zip

build-wasm:
name: Build WASM
runs-on: ubuntu-latest
needs: ["create-release"]
env:
BIN: zap
steps:
- uses: actions/checkout@v3

- name: Get Version from Tag
shell: bash
# https://github.community/t/how-to-get-just-the-tag-name/16241/7#M1027
run: |
echo "PROJECT_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
echo "Version is: ${{ env.PROJECT_VERSION }}"
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
override: true
profile: minimal

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Build Release
run: wasm-pack pack zap

- name: Upload Archive to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: zap/pkg/${{ env.BIN }}-${{ env.PROJECT_VERSION }}.tgz
asset_name: ${{ env.BIN }}-${{ env.PROJECT_VERSION }}-wasm.tgz
asset_content_type: application/octet-stream

- name: Upload Archive to Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.BIN }}-${{ env.PROJECT_VERSION }}-wasm.tgz
path: zap/pkg/${{ env.BIN }}-${{ env.PROJECT_VERSION }}.tgz
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,13 @@
/network
net.zap

# Docs
docs/.vitepress/dist
docs/.vitepress/cache
node_modules

# WASM
zap/pkg
zap/package

# Mac Moment
.DS_Store
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
zap.redblox.dev
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ At this time Zap has not been benchmarked, as it progresses through development

### Complex Types

While buffers may only support a small number of types, zap has complex type support. Below is a list of all supported types:
While buffers may only support a small number of types, Zap has complex type support. Below is a list of all supported types:

- Booleans

Expand Down
39 changes: 39 additions & 0 deletions docs/.vitepress/components/CodeBlock.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template>
<div class="language-" :style="styles">
<Editor
:modelValue="props.code"
:options="{ ...(props.isCodeBlock ? CODEBLOCK_OPTIONS : EDITOR_OPTIONS), ...props.options }"
:lang="lang"
:isCodeBlock="props.isCodeBlock"
/>
</div>
</template>

<script setup lang="ts">
import type monacoEditor from 'monaco-editor/esm/vs/editor/editor.api';
import { ref, watch } from 'vue';
const props = withDefaults(defineProps<{ code: string, options?: monacoEditor.editor.IStandaloneEditorConstructionOptions, lang?: string, isCodeBlock?: boolean }>(), {
isCodeBlock: true
})
defineEmits<{ (e: "update:modelValue", value: string): void }>()
const styles = ref()
watch(
() => props.code,
(code: string) => {
styles.value = {
width: "100%",
height: Math.min(code.split("\n").length * (props.options?.lineHeight ?? 18), 460) + 40 + "px",
padding: "20px 0px",
background: props.isCodeBlock ? undefined : "transparent"
};
},
{ immediate: true },
);
;
const EDITOR_OPTIONS: monacoEditor.editor.IStandaloneEditorConstructionOptions = { readOnly: true, scrollBeyondLastLine: false }
const CODEBLOCK_OPTIONS: monacoEditor.editor.IStandaloneEditorConstructionOptions = { ...EDITOR_OPTIONS, minimap: { enabled: false }, lineNumbers: "off", scrollbar: { vertical: "hidden", horizontal: "hidden", handleMouseWheel: false }, overviewRulerLanes: 0 }
</script>

Loading

0 comments on commit ec00da1

Please sign in to comment.