diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4530bf8b..ce9add29 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,10 +20,10 @@ jobs: with: fetch-depth: 0 - - name: Set Node.js 14.x + - name: Set Node.js 16.x uses: actions/setup-node@main with: - node-version: 14.x + node-version: 16.x - name: Get yarn cache directory path id: yarn-cache-dir-path @@ -56,10 +56,10 @@ jobs: steps: - uses: actions/checkout@main - - name: Set Node.js 14.x + - name: Set Node.js 16.x uses: actions/setup-node@main with: - node-version: 14.x + node-version: 16.x - name: Get yarn cache directory path id: yarn-cache-dir-path @@ -86,10 +86,10 @@ jobs: steps: - uses: actions/checkout@main - - name: Set Node.js 14.x + - name: Set Node.js 16.x uses: actions/setup-node@main with: - node-version: 14.x + node-version: 16.x - name: Get yarn cache directory path id: yarn-cache-dir-path diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1ab62c0e..0e670ef5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,10 +15,10 @@ jobs: with: fetch-depth: 0 - - name: Setup Node.js 14.x + - name: Setup Node.js 16.x uses: actions/setup-node@main with: - node-version: 14.x + node-version: 16.x - name: Get yarn cache directory path id: yarn-cache-dir-path diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..dc79191d --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +16.16 \ No newline at end of file diff --git a/package.json b/package.json index f68d6d71..21af6886 100644 --- a/package.json +++ b/package.json @@ -20,11 +20,7 @@ "site" ], "private": true, - "resolutions": { - "**/@babel/parser": "^7.7.7" - }, "dependencies": { - "@babel/cli": "^7.7.7", "@babel/core": "^7.7.7", "@babel/parser": "^7.7.7", "@babel/plugin-proposal-class-properties": "^7.7.4", diff --git a/site/.gitignore b/site/.gitignore new file mode 100644 index 00000000..b2d6de30 --- /dev/null +++ b/site/.gitignore @@ -0,0 +1,20 @@ +# 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* diff --git a/site/babel.config.js b/site/babel.config.js new file mode 100644 index 00000000..bfd75dbd --- /dev/null +++ b/site/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + presets: [require.resolve("@docusaurus/core/lib/babel/preset")], +}; diff --git a/site/src/pages/commands.mdx b/site/docs/commands.md similarity index 100% rename from site/src/pages/commands.mdx rename to site/docs/commands.md diff --git a/site/src/pages/configuration.mdx b/site/docs/configuration.md similarity index 100% rename from site/src/pages/configuration.mdx rename to site/docs/configuration.md diff --git a/site/src/pages/decisions.mdx b/site/docs/decisions.md similarity index 100% rename from site/src/pages/decisions.mdx rename to site/docs/decisions.md diff --git a/site/src/pages/dictionary.mdx b/site/docs/dictionary.md similarity index 98% rename from site/src/pages/dictionary.mdx rename to site/docs/dictionary.md index f4df12e4..f90c8a03 100644 --- a/site/src/pages/dictionary.mdx +++ b/site/docs/dictionary.md @@ -1,3 +1,7 @@ +--- +sidebar_position: 1 +--- + # Dictionary This page documents some common words and phrases that are used throughout this site and when discussing Preconstruct. diff --git a/site/src/pages/errors.mdx b/site/docs/errors.md similarity index 100% rename from site/src/pages/errors.mdx rename to site/docs/errors.md diff --git a/site/src/pages/guides/adding-a-second-entrypoint.mdx b/site/docs/guides/adding-a-second-entrypoint.md similarity index 93% rename from site/src/pages/guides/adding-a-second-entrypoint.mdx rename to site/docs/guides/adding-a-second-entrypoint.md index 79890ad3..ffb176a0 100644 --- a/site/src/pages/guides/adding-a-second-entrypoint.mdx +++ b/site/docs/guides/adding-a-second-entrypoint.md @@ -54,8 +54,8 @@ to get set up for development. Preconstruct's CLI will alert you to any problems For further documentation, we recommend reading: -- [the package configuration options](/config/packages) -- [the entrypoint package.json configuration options](/config/entrypoints) +- [the package configuration options](/configuration#packages) +- [the entrypoint package.json configuration options](/configuration#entrypoints) ### I don't have a `preconstruct` field in my package.json diff --git a/site/src/pages/guides/building-typescript-packages.mdx b/site/docs/guides/building-typescript-packages.md similarity index 100% rename from site/src/pages/guides/building-typescript-packages.mdx rename to site/docs/guides/building-typescript-packages.md diff --git a/site/src/pages/guides/configuring-babel.mdx b/site/docs/guides/configuring-babel.md similarity index 100% rename from site/src/pages/guides/configuring-babel.mdx rename to site/docs/guides/configuring-babel.md diff --git a/site/src/pages/guides/index.mdx b/site/docs/guides/index.md similarity index 89% rename from site/src/pages/guides/index.mdx rename to site/docs/guides/index.md index 24674cd2..09ed7338 100644 --- a/site/src/pages/guides/index.mdx +++ b/site/docs/guides/index.md @@ -1,3 +1,7 @@ +--- +sidebar_position: 4 +--- + # Guides Preconstruct's guides explain how to achieve common use cases in general terms, if you're looking for information about how to do achieve something with Preconstruct step-by-step, check out [Preconstruct's tutorials](/tutorials) instead. diff --git a/site/src/pages/guides/using-preconstruct-dev-in-a-monorepo.mdx b/site/docs/guides/using-preconstruct-dev-in-a-monorepo.md similarity index 100% rename from site/src/pages/guides/using-preconstruct-dev-in-a-monorepo.mdx rename to site/docs/guides/using-preconstruct-dev-in-a-monorepo.md diff --git a/site/src/pages/guides/when-should-i-use-multiple-entrypoints.mdx b/site/docs/guides/when-should-i-use-multiple-entrypoints.md similarity index 100% rename from site/src/pages/guides/when-should-i-use-multiple-entrypoints.mdx rename to site/docs/guides/when-should-i-use-multiple-entrypoints.md diff --git a/site/src/pages/index.mdx b/site/docs/index.md similarity index 98% rename from site/src/pages/index.mdx rename to site/docs/index.md index d6e0b15f..fadbac22 100644 --- a/site/src/pages/index.mdx +++ b/site/docs/index.md @@ -1,3 +1,7 @@ +--- +sidebar_position: 0 +--- + # Introduction > Dev and build your code painlessly in monorepos diff --git a/site/src/pages/tutorials/index.mdx b/site/docs/tutorials/index.md similarity index 99% rename from site/src/pages/tutorials/index.mdx rename to site/docs/tutorials/index.md index f03981fa..0a581d59 100644 --- a/site/src/pages/tutorials/index.mdx +++ b/site/docs/tutorials/index.md @@ -1,3 +1,7 @@ +--- +sidebar_position: 2 +--- + # Building your first package > A repository with the end result of this tutorial is available at https://github.com/preconstruct/a-random-number diff --git a/site/src/pages/tutorials/monorepo.mdx b/site/docs/tutorials/monorepo.md similarity index 92% rename from site/src/pages/tutorials/monorepo.mdx rename to site/docs/tutorials/monorepo.md index d51f7939..b90d9e45 100644 --- a/site/src/pages/tutorials/monorepo.mdx +++ b/site/docs/tutorials/monorepo.md @@ -1,10 +1,14 @@ +--- +sidebar_position: 3 +--- + # Building a Monorepo > **Note:** this tutorial builds upon knowledge in [the Getting Started tutorial](/tutorials) so if you haven't gone through it, you should do that first. We're going to setup a monorepo that uses Preconstruct to build its packages. We're also going to use [Yarn Workspaces](https://yarnpkg.com/en/docs/workspaces) for linking. Yarn Workspaces isn't the only monorepo linking tool that you can use with Preconstruct, [Lerna](https://github.com/lerna/lerna), [Bolt](https://github.com/boltpkg/bolt) and any other tool that does this will also work. -We have our `a-random-number` package from the [the Getting Started guide](/getting-started) which is awesome but we want to create a new set of packages with some other numbers, `the-number-one` and `the-number-two`. We're going to use a monorepo to manage it because we want to be able to manage all our packages together. +We have our `a-random-number` package from the [the Getting Started guide](/tutorials) which is awesome but we want to create a new set of packages with some other numbers, `the-number-one` and `the-number-two`. We're going to use a monorepo to manage it because we want to be able to manage all our packages together. ## Setting up Yarn Workspaces @@ -99,7 +103,7 @@ yarn add -W @babel/core @babel/preset-env ```jsx module.exports = { - presets: ["@babel/preset-env"] + presets: ["@babel/preset-env"], }; ``` diff --git a/site/src/pages/tutorials/multiple-entrypoints.mdx b/site/docs/tutorials/multiple-entrypoints.md similarity index 98% rename from site/src/pages/tutorials/multiple-entrypoints.mdx rename to site/docs/tutorials/multiple-entrypoints.md index 88eafff7..09f91661 100644 --- a/site/src/pages/tutorials/multiple-entrypoints.mdx +++ b/site/docs/tutorials/multiple-entrypoints.md @@ -1,3 +1,7 @@ +--- +sidebar_position: 4 +--- + # Exporting Multiple Entrypoints > **Note:** this tutorial builds upon [the Getting Started tutorial](/tutorials) so if you haven't gone through it, you should do that first. diff --git a/site/docusaurus.config.js b/site/docusaurus.config.js new file mode 100644 index 00000000..05572fec --- /dev/null +++ b/site/docusaurus.config.js @@ -0,0 +1,58 @@ +// @ts-check +// Note: type annotations allow type checking and IDEs autocompletion + +const lightCodeTheme = require("prism-react-renderer/themes/github"); +const darkCodeTheme = require("prism-react-renderer/themes/dracula"); + +/** @type {import('@docusaurus/types').Config} */ +const config = { + title: "Preconstruct", + // tagline: "Dinosaurs are cool", + url: "https://preconstruct.tools", + baseUrl: "/", + onBrokenLinks: "throw", + onBrokenMarkdownLinks: "throw", + favicon: "img/favicon.ico", + i18n: { + defaultLocale: "en", + locales: ["en"], + }, + + presets: [ + [ + "classic", + /** @type {import('@docusaurus/preset-classic').Options} */ + ({ + docs: { + routeBasePath: "/", + sidebarPath: require.resolve("./sidebars.js"), + // Please change this to your repo. + // Remove this to remove the "edit this page" links. + editUrl: + "https://github.com/preconstruct/preconstruct/tree/main/packages/create-docusaurus/templates/shared/", + }, + }), + ], + ], + themeConfig: + /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ + ({ + navbar: { + title: "Preconstruct", + logo: { + alt: "Preconstruct Logo", + src: "img/icon.png", + }, + items: [ + { + href: "https://github.com/preconstruct/preconstruct", + label: "GitHub", + position: "right", + }, + ], + }, + prism: { theme: lightCodeTheme, darkTheme: darkCodeTheme }, + }), +}; + +module.exports = config; diff --git a/site/gatsby-config.js b/site/gatsby-config.js deleted file mode 100644 index f2d4c196..00000000 --- a/site/gatsby-config.js +++ /dev/null @@ -1,44 +0,0 @@ -module.exports = { - plugins: [ - "gatsby-theme-sidebar", - { - resolve: `gatsby-source-filesystem`, - options: { - name: `pages`, - path: `${__dirname}/src/pages/`, - }, - }, - { - resolve: "gatsby-plugin-page-creator", - options: { - path: `${__dirname}/src/pages/`, - }, - }, - "gatsby-plugin-mdx", - { - resolve: "gatsby-plugin-typography", - options: { - pathToConfigModule: "src/typography", - }, - }, - "gatsby-plugin-emotion", - { - resolve: "gatsby-plugin-google-analytics", - options: { - trackingId: "UA-140394521-1", - }, - }, - { - resolve: `gatsby-plugin-manifest`, - options: { - name: "Preconstruct", - short_name: "Preconstruct", - start_url: "/", - background_color: "#ea2929", - theme_color: "#ea2929", - display: "browser", - icon: "src/images/icon.png", - }, - }, - ], -}; diff --git a/site/package.json b/site/package.json index f5c19452..2600512c 100644 --- a/site/package.json +++ b/site/package.json @@ -1,29 +1,37 @@ { - "private": true, "name": "@preconstruct/site", - "version": "1.0.0", + "version": "0.0.0", + "private": true, "scripts": { - "clean": "rm -rf node_modules .cache public", - "start": "gatsby develop", - "build": "gatsby build" + "start": "docusaurus start", + "build": "docusaurus build", + "clear": "docusaurus clear", + "serve": "docusaurus serve", + "write-translations": "docusaurus write-translations", + "write-heading-ids": "docusaurus write-heading-ids" }, "dependencies": { - "@mdx-js/mdx": "^1.5.1", - "@mdx-js/react": "^1.5.1", - "gatsby": "^2.17.7", - "gatsby-plugin-emotion": "^4.1.13", - "gatsby-plugin-google-analytics": "^2.1.23", - "gatsby-plugin-manifest": "^2.2.26", - "gatsby-plugin-mdx": "^1.0.55", - "gatsby-plugin-page-creator": "^2.1.28", - "gatsby-plugin-typography": "^2.3.15", - "gatsby-source-filesystem": "^2.1.35", - "gatsby-theme-sidebar": "^0.0.2", - "prism-react-renderer": "^1.0.2", - "react": "^16.11.0", - "react-dom": "^16.11.0", - "react-typography": "^0.16.19", - "typography": "^0.16.19" + "@docusaurus/core": "2.0.0-beta.22", + "@docusaurus/preset-classic": "2.0.0-beta.22", + "@mdx-js/react": "^1.6.22", + "prism-react-renderer": "^1.3.5", + "react": "^17.0.2", + "react-dom": "^17.0.2" + }, + "browserslist": { + "production": [ + ">0.5%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + }, + "engines": { + "node": ">=16.14" }, "repository": "https://github.com/preconstruct/preconstruct/tree/main/site" } diff --git a/site/sidebars.js b/site/sidebars.js new file mode 100644 index 00000000..a069ac1a --- /dev/null +++ b/site/sidebars.js @@ -0,0 +1,31 @@ +/** + * Creating a sidebar enables you to: + - create an ordered group of docs + - render a sidebar for each doc of that group + - provide next/previous navigation + + The sidebars can be generated from the filesystem, or explicitly defined here. + + Create as many sidebars as you want. + */ + +// @ts-check + +/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ +const sidebars = { + // By default, Docusaurus generates a sidebar from the docs folder structure + docs: [{ type: "autogenerated", dirName: "." }], + + // But you can create a sidebar manually + /* + tutorialSidebar: [ + { + type: 'category', + label: 'Tutorial', + items: ['hello'], + }, + ], + */ +}; + +module.exports = sidebars; diff --git a/site/src/code-theme.js b/site/src/code-theme.js deleted file mode 100644 index b2413ff8..00000000 --- a/site/src/code-theme.js +++ /dev/null @@ -1,79 +0,0 @@ -// @flow -// Converted automatically using prism-react-renderer/tools/themeFromVsCode -// from VS Code Gloom - -export let theme = { - plain: { - color: "#f1eff7", - backgroundColor: "#292a44", - }, - styles: [ - { - types: ["punctuation", "builtin", "constant", "char"], - style: { - color: "rgb(174, 129, 255)", - }, - }, - { - types: ["variable"], - style: { - color: "rgb(241, 239, 247)", - }, - }, - { - types: ["comment"], - style: { - color: "rgb(109, 109, 181)", - fontStyle: "italic", - }, - }, - { - types: ["changed"], - style: { - color: "rgb(224, 194, 133)", - }, - }, - { - types: ["inserted", "string"], - style: { - color: "rgb(109, 254, 223)", - }, - }, - { - types: ["deleted"], - style: { - color: "rgb(255, 111, 159)", - }, - }, - { - types: ["keyword", "selector"], - style: { - color: "rgb(122, 165, 255)", - }, - }, - { - types: ["attr-name"], - style: { - fontStyle: "italic", - }, - }, - { - types: ["operator", "class-name", "symbol"], - style: { - color: "rgb(45, 224, 167)", - }, - }, - { - types: ["namespace", "tag"], - style: { - color: "rgb(102, 217, 239)", - }, - }, - { - types: ["number"], - style: { - color: "rgb(255, 219, 125)", - }, - }, - ], -}; diff --git a/site/src/colors.js b/site/src/colors.js deleted file mode 100644 index 7c421aa9..00000000 --- a/site/src/colors.js +++ /dev/null @@ -1,10 +0,0 @@ -// @flow - -export default { - base: "#ea2929", - black: "#493b3b", - gray: "#eef6f9", - blue: "#117fd0", - pink: "#fdeaf4", - active: "#7e45ff", -}; diff --git a/site/src/fancy-link.js b/site/src/fancy-link.js deleted file mode 100644 index 46357550..00000000 --- a/site/src/fancy-link.js +++ /dev/null @@ -1,32 +0,0 @@ -import React from "react"; -import { Link } from "gatsby"; -import colors from "./colors"; - -export let LinksContainer = (props) => ( -
-); - -let fancyCSS = { - display: "block", - color: "inherit", - textDecoration: "none", - fontWeight: "bold", - paddingLeft: 32, - paddingRight: 32, - paddingTop: 8, - paddingBottom: 8, - marginLeft: 8, - marginRight: 8, - border: `${colors.base} solid 4px`, - borderRadius: 8, - ":hover": { - backgroundColor: colors.base, - color: "white", - }, -}; - -export let FancyLink = (props) => ; -export let FancyAnchor = (props) => ; diff --git a/site/src/gatsby-theme-sidebar/root.js b/site/src/gatsby-theme-sidebar/root.js deleted file mode 100644 index 2bdd33f4..00000000 --- a/site/src/gatsby-theme-sidebar/root.js +++ /dev/null @@ -1,280 +0,0 @@ -import React, { useState } from "react"; -import { Link } from "gatsby"; -import { Spacer } from "gatsby-theme-sidebar"; -import { MDXProvider } from "@mdx-js/react"; -import Highlight, { defaultProps } from "prism-react-renderer"; -import colors from "../colors"; -import { theme as codeTheme } from "../code-theme"; - -let linkStyles = { - display: "block", - color: "inherit", - textDecoration: "none", - fontWeight: "bold", - paddingLeft: 32, - paddingRight: 32, - paddingTop: 8, - paddingBottom: 8, - marginLeft: -32, - marginRight: -32, - "&.active": { - color: colors.active, - }, -}; - -const NavLink = (props) => ( - -); - -const MenuButton = (props) => ( -