Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ node_modules/
dist/
data/contributors.json
data/sponsors.json
src/.vuepress/.temp/
src/.vuepress/.cache/
src/.vuepress/public/contributors.svg
src/.vuepress/public/sponsors.svg
26,183 changes: 7,167 additions & 19,016 deletions package-lock.json

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
"name": "@assemblyscript/website",
"private": true,
"version": "0.0.0",
"type": "module",
"license": "Apache-2.0",
"description": "AssemblyScript's Website.",
"scripts": {
"start": "vuepress dev src --host localhost --no-cache",
"start": "vuepress dev src --host localhost --clean-cache",
"build": "vuepress build src",
"serve": "vuepress serve src"
"serve": "serve dist"
},
"devDependencies": {
"@vuepress/plugin-html-redirect": "^0.2.1",
"@vuepress/bundler-vite": "2.0.0-rc.28",
"@vuepress/plugin-copy-code": "next",
"@vuepress/plugin-docsearch": "2.0.0-rc.128",
"@vuepress/plugin-redirect": "2.0.0-rc.128",
"@vuepress/plugin-register-components": "2.0.0-rc.128",
"@vuepress/plugin-shiki": "next",
"@vuepress/theme-default": "2.0.0-rc.128",
"he": "^1.2.0",
"node-addon-api": "^8.7.0",
"node-fetch": "^2.7.0",
"node-gyp": "^12.2.0",
"pngquant": "^4.2.0",
"prism-themes": "^1.9.0",
"sass-embedded": "^1.99.0",
"serve": "^14.2.0",
"sharp": "^0.34.5",
"vuepress": "^1.9.10",
"vuepress-plugin-serve": "^2.0.4",
"vuepress-plugin-sitemap": "^2.3.1"
},
"overrides": {
"watchpack": "2.5.1"
"vuepress": "2.0.0-rc.28"
}
}
2 changes: 1 addition & 1 deletion scripts/update-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function updateSponsors() {
/** Updates contributors data by pulling stats from GitHub. */
function updateContributors() {
const contributors = {}
Promise.all(repos.map(repo => fetch('http://api.github.com/repos/' + repo + '/contributors').then(res => res.json())))
Promise.all(repos.map(repo => fetch('https://api.github.com/repos/' + repo + '/contributors').then(res => res.json())))
.then(jsons => {
jsons.forEach(json => {
json
Expand Down
93 changes: 0 additions & 93 deletions src/.vuepress/config.js

This file was deleted.

104 changes: 104 additions & 0 deletions src/.vuepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { viteBundler } from '@vuepress/bundler-vite'
import { docsearchPlugin } from '@vuepress/plugin-docsearch'
import { redirectPlugin } from '@vuepress/plugin-redirect'
import { shikiPlugin } from '@vuepress/plugin-shiki'
import { registerComponentsPlugin } from '@vuepress/plugin-register-components'
import { defaultTheme } from '@vuepress/theme-default'
import { defineUserConfig } from 'vuepress'
import navbar from './nav'
import sidebar from './sidebar'

const __dirname = fileURLToPath(new URL('.', import.meta.url))
const redirectsFile = new URL('./redirects', import.meta.url)
export default defineUserConfig({
base: '/',
dest: './dist',
locales: {
'/': {
lang: 'en-US',
title: 'The AssemblyScript Book',
description: 'A TypeScript-like language for WebAssembly',
},
},
head: [
['link', { rel: "apple-touch-icon", sizes: "180x180", href: "/favicons/apple-touch-icon.png" }],
['link', { rel: "icon", type: "image/png", sizes: "32x32", href: "/favicons/favicon-32x32.png" }],
['link', { rel: "icon", type: "image/png", sizes: "16x16", href: "/favicons/favicon-16x16.png" }],
['link', { rel: "manifest", href: "/site.webmanifest" }],
['link', { rel: "mask-icon", href: "/favicons/safari-pinned-tab.svg", color: "#007acc" }],
['link', { rel: "shortcut icon", href: "/favicon.ico" }],
['link', { rel: "preconnect", href: "https://cdn.jsdelivr.net" }],
['meta', { name: "msapplication-TileColor", content: "#ffffff" }],
['meta', { name: "msapplication-config", content: "/browserconfig.xml" }],
['meta', { name: "theme-color", content: "#ffffff" }],
['meta', { name: "viewport", content: "width=device-width, initial-scale=1" }],
],
bundler: viteBundler(),
theme: defaultTheme({
hostname: 'https://www.assemblyscript.org',
logo: '/images/icon.svg',
navbar,
sidebar,
sidebarDepth: 1,
docsRepo: 'AssemblyScript/website',
docsDir: 'src',
docsBranch: 'main',
editLinkText: 'Edit this page on GitHub',
themePlugins: {
copyCode: {
locales: {
'/': {
copy: 'Copy code',
copied: 'Copied',
},
},
},
prismjs: false,
sitemap: true,
},
}),
plugins: [
shikiPlugin({
themes: {
light: 'light-plus',
dark: 'ayu-mirage',
},
langAlias: {
editor: 'typescript',
},
}),
redirectPlugin({
config: loadRedirects(),
}),
registerComponentsPlugin({
componentsDir: resolve(__dirname, './components'),
}),
docsearchPlugin({
// TODO: Replace with the real Algolia DocSearch app ID before enabling search in production.
appId: 'TODO_DOCSEARCH_APP_ID',
apiKey: 'ffb8769cdb0f8cfa20d6a307385cb7ba',
indexName: 'assemblyscript',
}),
]
})

function loadRedirects(): Record<string, string> {
return Object.fromEntries(
readFileSync(redirectsFile, 'utf8')
.split(/\r?\n/u)
.map((line) => line.trim())
.filter((line) => line.length > 0)
.map((line) => {
const separatorIndex = line.search(/\s/u)

if (separatorIndex === -1) {
throw new Error(`Invalid redirect entry: ${line}`)
}

return [line.slice(0, separatorIndex), line.slice(separatorIndex).trim()]
}),
)
}
14 changes: 8 additions & 6 deletions src/.vuepress/nav.js → src/.vuepress/nav.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
module.exports = [
import type { NavbarOptions } from '@vuepress/theme-default'

export default [
{
text: 'Documentation',
link: '/introduction.md'
},
{
text: 'Examples',
items: [
children: [
{
text: 'Overview',
link: '/examples'
Expand All @@ -18,7 +20,7 @@ module.exports = [
},
{
text: 'Community',
items: [
children: [
{
text: 'Contributing guidelines',
link: 'https://github.com/AssemblyScript/assemblyscript/blob/main/CONTRIBUTING.md'
Expand All @@ -29,7 +31,7 @@ module.exports = [
},
{
text: 'Social',
items: [
children: [
{
text: 'Twitter',
link: 'https://twitter.com/AssemblyScript'
Expand All @@ -42,7 +44,7 @@ module.exports = [
},
{
text: 'Q&A',
items: [
children: [
{
text: 'Stack Overflow',
link: 'https://stackoverflow.com/questions/tagged/assemblyscript'
Expand All @@ -59,4 +61,4 @@ module.exports = [
text: 'GitHub',
link: 'https://github.com/AssemblyScript'
},
]
] satisfies NavbarOptions
Loading