Skip to content

Commit

Permalink
docs: move docs to main branch #969 (#985)
Browse files Browse the repository at this point in the history
* Move documentation from `gh-pages` to `main` branch

* Format code with `npm run fmt`

* Restore Contribution guide

* chore: update package-lock.json to solve CI problem

* chore: up deps

* build(tsd): disable default nm/@types traversing

* chore: up size limit

---------

Co-authored-by: Anton Golub <[email protected]>
  • Loading branch information
1e9y and antongolub authored Dec 17, 2024
1 parent 97d0f5f commit 3e5bcb0
Show file tree
Hide file tree
Showing 44 changed files with 5,258 additions and 400 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Deploy docs

on:
push:
branches: ['gh-pages']
workflow_dispatch:
release:
types: [created]

permissions:
contents: read
Expand All @@ -24,17 +23,17 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: gh-pages
ref: main
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Install deps
run: npm ci
- name: Built docs
run: npm run docs:built
- name: Build docs
run: npm run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: 'docs'
path: 'docs/build'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
2 changes: 2 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/cache/
/build/
131 changes: 131 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
import { defineConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config
export default defineConfig({
base: '/zx/',
outDir: 'build',
cleanUrls: true,
title: 'google/zx',
titleTemplate: ':title | google/zx',
description: 'A tool for writing better scripts',
head: [
[
'link',
{
rel: 'apple-touch-icon',
sizes: '180x180',
href: '/zx/img/favicons/apple-touch-icon.png',
},
],
[
'link',
{
rel: 'icon',
type: 'image/png',
sizes: '32x32',
href: '/zx/img/favicons/favicon-32x32.png',
},
],
[
'link',
{
rel: 'icon',
type: 'image/png',
sizes: '16x16',
href: '/zx/img/favicons/favicon-16x16.png',
},
],
[
'link',
{
rel: 'mask-icon',
href: '/zx/img/favicons/safari-pinned-tab.svg',
color: '#3a0839',
},
],
['link', { rel: 'shortcut icon', href: '/zx/img/favicons/favicon.ico' }],
['meta', { name: 'og:image', content: '/zx/img/og-image.png' }],
['meta', { name: 'twitter:image', content: '/zx/img/og-image.png' }],
],
themeConfig: {
logo: '/img/logo.svg',
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Home', link: '/' },
{ text: 'Docs', link: '/getting-started' },
{
text: 'v8',
items: [
{ text: 'v8', link: '/migration-from-v7' },
{ text: 'v7', link: '/v7/api' },
],
},
],

sidebar: {
'/': [
{
text: 'Docs',
items: [
{ text: 'Getting Started', link: '/getting-started' },
{ text: 'Setup', link: '/setup' },
{ text: 'API Reference', link: '/api' },
{ text: 'CLI Usage', link: '/cli' },
{ text: 'Configuration', link: '/configuration' },
{ text: 'Process Promise', link: '/process-promise' },
{ text: 'Contribution Guide', link: '/contribution' },
{ text: 'Migration from v7', link: '/migration-from-v7' },
],
},
{
text: 'FAQ',
link: '/faq',
items: [
{ text: 'Quotes', link: '/quotes' },
{ text: 'TypeScript', link: '/typescript' },
{ text: 'Markdown Scripts', link: '/markdown-scripts' },
{ text: 'Known Issues', link: '/known-issues' },
],
},
],

'/v7/': [
{
text: 'Docs (v7)',
items: [
{ text: 'Getting Started', link: '/v7/getting-started' },
{ text: 'Process Promise', link: '/v7/process-promise' },
{ text: 'API Reference', link: '/v7/api' },
{ text: 'Configuration', link: '/v7/configuration' },
{ text: 'CLI Usage', link: '/v7/cli' },
],
},
{
text: 'FAQ',
link: '/v7/faq',
items: [
{ text: 'Quotes', link: '/v7/quotes' },
{ text: 'TypeScript', link: '/v7/typescript' },
{ text: 'Markdown Scripts', link: '/v7/markdown-scripts' },
{ text: 'Known Issues', link: '/v7/known-issues' },
],
},
],
},

socialLinks: [{ icon: 'github', link: 'https://github.com/google/zx' }],

editLink: {
pattern: 'https://github.com/google/zx/blob/main/docs/:path',
},

footer: {
message:
'Disclaimer: This is not an officially supported Google product.',
},

search: {
provider: 'local',
},
},
})
14 changes: 14 additions & 0 deletions docs/.vitepress/theme/MyLayout.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script setup>
import DefaultTheme from 'vitepress/theme'
import MyOxygen from './MyOxygen.vue'
const { Layout } = DefaultTheme
</script>

<template>
<Layout>
<template #aside-ads-after>
<MyOxygen />
</template>
</Layout>
</template>
44 changes: 44 additions & 0 deletions docs/.vitepress/theme/MyOxygen.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<template>
<div class="Oxygen">
<a href="https://webpod.dev/?from=zx-site">
<!--<img src="https://webpod.dev/img/banner.png" alt="Webpod - deploy JavaScript apps">-->
<img
src="https://webpod.dev/img/logo.svg"
alt="Webpod - deploy JavaScript apps"
/>
<p>Webpod – deploy JavaScript apps to own cloud or private server</p>
</a>
</div>
</template>

<style scoped>
.Oxygen {
display: flex;
justify-content: center;
align-items: center;
padding: 24px;
border-radius: 12px;
min-height: 256px;
text-align: center;
line-height: 18px;
font-size: 12px;
font-weight: 500;
background-color: var(--vp-carbon-ads-bg-color);
}
.Oxygen :deep(img) {
margin: 0 auto;
}
.Oxygen :deep(p) {
display: block;
margin: 0 auto;
color: var(--vp-carbon-ads-text-color);
transition: color 0.25s;
}
.Oxygen :deep(p:hover) {
color: var(--vp-carbon-ads-hover-text-color);
}
</style>
<script setup></script>
27 changes: 27 additions & 0 deletions docs/.vitepress/theme/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
:root {
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient(
120deg,
#f11a7b 10%,
#feffac
);

--vp-home-hero-image-background-image: linear-gradient(
-45deg,
rgba(241, 26, 123, 0.33) 50%,
rgba(254, 255, 172, 0.33) 50%
);
--vp-home-hero-image-filter: blur(40px);
}

@media (min-width: 640px) {
:root {
--vp-home-hero-image-filter: blur(56px);
}
}

@media (min-width: 960px) {
:root {
--vp-home-hero-image-filter: blur(72px);
}
}
10 changes: 10 additions & 0 deletions docs/.vitepress/theme/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import DefaultTheme from 'vitepress/theme'
import MyLayout from './MyLayout.vue'
import './custom.css'

export default {
...DefaultTheme,
// override the Layout with a wrapper component that
// injects the slots
Layout: MyLayout,
}
Loading

0 comments on commit 3e5bcb0

Please sign in to comment.