Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init: initial website #1

Merged
merged 1 commit into from
Nov 7, 2023
Merged
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
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
open_collective: svgo
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Discord
url: https://discord.gg/z8jX8NYxrE
about: Please ask questions in our Discord server.
32 changes: 32 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy

on:
release:
types:
- 'published'
workflow_dispatch:

permissions:
contents: write

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: svg/svgo
path: .svgo
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn install --immutable
- run: yarn run build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
24 changes: 24 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI

on:
- 'pull_request'

permissions:
contents: read

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: svg/svgo
path: .svgo
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn install --immutable
- run: yarn run build
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Docs should be pulled from the svg/svgo repository
/docs/
/.svgo/
1 change: 0 additions & 1 deletion CNAME

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) SVGO and Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# SVGO Website

A site powered by Docusaurus, mostly featuring documentation for SVGO.

This repository contains source code for the landing page, custom components, and pretty much everything except the documentation itself. The documentation is pulled from [svg/svgo](https://github.com/svg/svgo) during deployment.

In order to run or deploy the site, you'll first need to fetch the documentation. You can do this by cloning [svg/svgo](https://github.com/svg/svgo) to the `.svgo` directory in the workspace.

```sh
git clone https://github.com/svg/svgo.git .svgo --depth 1
```

Docusaurus is configured to read documents from the `.svgo/docs` directory instead of the root `docs/` directory.

## Running Locally

Once you have the project setup, you can run the development server:

```sh
yarn install
yarn run start
```
5 changes: 5 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
require.resolve('@docusaurus/core/lib/babel/preset')
],
};
140 changes: 140 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");

/**
* @typedef {import("@docusaurus/types").Config} Config
*/

/**
* Config for Docusaurus.
*
* $.themeConfig.navbar.logo is underfined as this is configured with a custom component.
* $.themeConfig.footer.style is ignored as this is overriden with custom CSS.
*
* @type {Config}
*/
const config = {
title: "SVGO",
tagline: "A Node.js library and command-line application to optimize vectors.",
favicon: "img/favicon.ico",
url: "https://svgo.dev",
baseUrl: "/",
baseUrlIssueBanner: false,
organizationName: "svg",
projectName: "svgo.dev",
trailingSlash: true,
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "throw",
i18n: {
defaultLocale: "en",
locales: [
"en"
],
},
plugins: [
[
"@docusaurus/theme-classic",
{
customCss: require.resolve("./src/css/custom.css"),
},
],
[
"@docusaurus/plugin-content-pages",
{
path: "src/pages",
routeBasePath: "/"
}
],
[
"@docusaurus/plugin-content-docs",
{
path: ".svgo/docs",
breadcrumbs: true,
sidebarPath: require.resolve("./sidebars.js"),
editUrl: ({ docPath }) => `https://github.com/svg/svgo/tree/main/docs/${docPath}`,
}
],
[
"@docusaurus/plugin-sitemap",
{
filename: "sitemap.xml",
ignorePatterns: [
"/.well-known/**"
]
}
]
],
themes: [
'@docusaurus/theme-live-codeblock',
[
require.resolve("@easyops-cn/docusaurus-search-local"),
{
indexDocs: true,
indexBlog: false,
language: "en",
hashed: true,
searchBarPosition: "right"
}
]
],
themeConfig: {
colorMode: {
disableSwitch: true,
respectPrefersColorScheme: true,
},
navbar: {
items: [
{
type: "docSidebar",
position: "left",
sidebarId: "docsSidebar",
label: "Documentation",
},
{
href: "https://github.com/svg/svgo",
position: "right",
html: `<img src="https://img.shields.io/github/stars/svg/svgo?style=social" alt="" height="20" width="88"/>`,
className: 'github-shield',
'aria-label': 'GitHub repository'
}
],
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme
},
footer: {
links: [
{
title: "Community",
items: [
{
label: "Stack Overflow",
href: "https://stackoverflow.com/questions/tagged/svgo",
},
{
label: "Discord",
href: "https://discord.com/invite/z8jX8NYxrE",
}
],
},
{
title: "More",
items: [
{
label: "GitHub",
href: "https://github.com/svg/svgo",
},
{
label: "Open Collective",
href: "https://opencollective.com/svgo"
}
]
}
],
copyright: `Copyright © ${new Date().getFullYear()} <a href="https://github.com/svg/svgo/graphs/contributors">SVGO and Contributors</a><br>Source Code under MIT · Content and Assets under CC-BY-4.0`
},
}
};

module.exports = config;
1 change: 0 additions & 1 deletion index.html

This file was deleted.

57 changes: 57 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "svgo-dev",
"version": "0.0.0",
"description": "Landing page and documentation for SVGO.",
"license": "MIT",
"homepage": "https://svgo.dev/",
"private": true,
"author": {
"name": "Seth Falco",
"email": "[email protected]",
"url": "https://falco.fun/"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/svgo"
},
"repository": {
"type": "git",
"url": "git://github.com/svg/svgo.dev.git"
},
"bugs": {
"url": "https://github.com/svg/svgo.dev/issues"
},
"keywords": [
"svgo",
"docusaurus"
],
"engines": {
"node": ">=18"
},
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "^2.4.3",
"@docusaurus/plugin-content-docs": "^2.4.3",
"@docusaurus/plugin-content-pages": "^2.4.3",
"@docusaurus/plugin-sitemap": "^2.4.3",
"@docusaurus/theme-classic": "^2.4.3",
"@docusaurus/theme-live-codeblock": "^2.4.3",
"@easyops-cn/docusaurus-search-local": "^0.36.0",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.1",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"svgo": "^3.0.2"
}
}
1 change: 0 additions & 1 deletion readme.md

This file was deleted.

10 changes: 10 additions & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @typedef {import('@docusaurus/plugin-content-docs').SidebarsConfig} SidebarsConfig
*/

/** @type {SidebarsConfig} */
const sidebars = {
docsSidebar: [{ type: 'autogenerated', dirName: '.' }],
};

module.exports = sidebars;
11 changes: 11 additions & 0 deletions src/components/DefaulBadge/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import clsx from 'clsx';
import React from 'react';
import styles from './index.module.css';

export default function DefaultBadge() {
return (
<span className={clsx(styles.badge)} title="This plugin is enabled by default.">
Default
</span>
);
}
6 changes: 6 additions & 0 deletions src/components/DefaulBadge/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.badge {
padding: .3em .6em;
border-radius: 1em;
color: var(--svgo-pill-fg-color);
background-color: var(--svgo-pill-bg-color);
}
Loading