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

chore: add script to copy homepage into website dir #3295

Merged
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
4 changes: 2 additions & 2 deletions sites/fast-website/src/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<ul>
<li><fast-anchor appearance="lightweight" href="https://explore.fast.design">Components</fast-anchor></li>
<li><fast-anchor appearance="lightweight" href="#">Integration</fast-anchor></li>
<li><fast-anchor appearance="lightweight" href="https://www.fast.design/docs/en/contributing/install">Documentation</fast-anchor></li>
<li><fast-anchor appearance="lightweight" href="/docs/fast-foundation/getting-started">Documentation</fast-anchor></li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably go to /docs/introduction

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch Rob. We'll want everything to be relative so that when they the same files move through the Front Door into staging environment or production the entire site is functional.

<li><fast-anchor appearance="lightweight" href="https://discord.gg/FcSNfg4">Community</fast-anchor></li>
</ul>
<fast-anchor class="github-link" slot="end" appearance="lightweight" href="https://github.com/microsoft/fast-dna/">
Expand All @@ -45,7 +45,7 @@
<fast-badge slot="badge" class="section-badge">ADAPTIVE UI SYSTEM, UTILITIES, & TOOLS</fast-badge>
<h1 class="section-heading-hero">The adaptive interface system for modern web experiences</h1>
<p slot="body">Interfaces bult with FAST adapt to your design system and can be used with any modern UI Framework by leveraging industry standard Web Components.</p>
<fast-button slot="action" appearance="accent">Get started</fast-button>
<fast-button slot="action" appearance="accent" href="/docs/fast-foundation/getting-started">Get started</fast-button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one makes sense to have direct to the getting started, but the one above should probably go to the docs intro. Thoughts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have another PR to cover the rest of the page's links.

</site-section-header>
</div>
</section>
Expand Down
18 changes: 8 additions & 10 deletions sites/fast-website/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin");

const appDir = path.resolve(__dirname, "./src/app");
const publicDir = path.resolve(__dirname, "./src/public");
const outDir = path.resolve(__dirname, "./www");

module.exports = {
entry: {
Expand All @@ -16,8 +15,8 @@ module.exports = {
resolve: {
extensions: [".svg", ".ts", ".tsx", ".js"],
alias: {
svg: path.resolve(__dirname, "src/app/svg")
}
svg: path.resolve(__dirname, "src/app/svg"),
},
},
output: {
path: path.resolve(__dirname, "dist"),
Expand Down Expand Up @@ -59,19 +58,18 @@ module.exports = {
{
loader: "svg-inline-loader",
options: {
removeSVGTagAttrs: false
}
}
]
}
removeSVGTagAttrs: false,
},
},
],
},
],
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
title: "FAST website",
title: "FAST",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you inform more in the title for SEO? "FAST - An adaptive UI design system" for example on the home page or whatever our tagline may be?

template: path.resolve(publicDir, "index.html"),
contentBase: outDir,
}),
],
};
6 changes: 3 additions & 3 deletions sites/fast-website/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ module.exports = merge(baseConfig, {
minimizer: [new TerserJSPlugin({}), new OptimizeCSSAssetsPlugin({})],
},
output: {
filename: "[name].[hash].js",
filename: "bundle/[name].[hash].js",
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name].[hash].css",
chunkFilename: "[id].[hash].css",
filename: "bundle/[name].[hash].css",
chunkFilename: "bundle/[id].[hash].css",
awentzel marked this conversation as resolved.
Show resolved Hide resolved
}),
],
});
6 changes: 5 additions & 1 deletion sites/website/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ yarn-debug.log*
yarn-error.log*

# Cache
.docusaurus
.docusaurus

# Static files from the homepage
static/bundle
static/index.html
9 changes: 8 additions & 1 deletion sites/website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@ module.exports = {
async: true,
},
],
themes: ["@docusaurus/theme-live-codeblock"],
themes: [require.resolve("@docusaurus/theme-live-codeblock")],
themeConfig: {
navbar: {
logo: {
alt: "FAST-DNA",
src: "img/logo.svg",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good candidate for the CDN https://static.fast.design/assets/brand/fast-logo.svg as an example and is achievable by placing in /sites/site-utilities/statics/assets/brand/fast-logo.svg upon merge to master ( know this is a feature branch ) it would deploy to CDN.


// FIXME: #3299 Docusaurus displays a blank page when clicking the logo link without workaround
target: "_blank",
...(process.env.NODE_ENV === "production" && {
href: "https://www.fast.design",
target: "_self",
}),
},
links: [
{
Expand Down
14 changes: 8 additions & 6 deletions sites/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
"private": true,
"scripts": {
"clean": "node ../../build/clean.js docs",
"prepare-docs": "npm run clean && node src/prepare-docs.js",
"dev": "npm run prepare-docs && docusaurus start",
"build": "npm run prepare-docs && docusaurus build"
"prepare-docs": "yarn clean && node src/prepare-docs.js",
radium-v marked this conversation as resolved.
Show resolved Hide resolved
"build-homepage": "node src/build-homepage.js",
"dev": "yarn build-homepage && yarn prepare-docs && docusaurus start",
"build": "yarn build-homepage && yarn prepare-docs && docusaurus build"
},
"dependencies": {
"@docusaurus/core": "2.0.0-alpha.48",
"@docusaurus/preset-classic": "2.0.0-alpha.48",
"@docusaurus/theme-live-codeblock": "2.0.0-alpha.39",
"@docusaurus/core": "2.0.0-alpha.56",
"@docusaurus/preset-classic": "2.0.0-alpha.56",
"@docusaurus/theme-live-codeblock": "2.0.0-alpha.56",
"classnames": "^2.2.6",
"copyfiles": "^2.3.0",
"react": "^16.8.4",
"react-dom": "^16.8.4"
},
Expand Down
45 changes: 45 additions & 0 deletions sites/website/src/build-homepage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// FIXME: #3298 Merge fast-website and website projects to replace temporary build/copy script

/* eslint-env node */
/* eslint-disable @typescript-eslint/typedef */
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/explicit-function-return-type */
const { spawn } = require("child_process");
const path = require("path");
const copyfiles = require("copyfiles");

const projectPath = path.resolve(__dirname, "../../fast-website");
const staticPath = path.resolve(__dirname, "../static");
const indexPath = path.resolve(projectPath, "dist/index.html");

const copyConfig = { flat: true, verbose: true, up: true };

function copyBundle() {
copyfiles([indexPath, staticPath], copyConfig, () => {
console.log("Copied homepage files to static");
});

copyfiles(
[`${projectPath}/dist/bundle/*`, `${staticPath}/bundle`],
copyConfig,
() => {
console.log("Copied homepage files to static");
}
);
}

// Run `yarn build` in the fast-website project
const yarnBuild = spawn("yarn", ["build"], { cwd: projectPath });

yarnBuild.stdout.on("data", data => console.log(`stdout: ${data}`));
yarnBuild.stderr.on("data", data => console.log(`stderr: ${data}`));
yarnBuild.on("error", error => console.log(`error: ${error.message}`));

yarnBuild.on("close", exitCode => {
console.log(`child process exited with code ${exitCode}`);
if (exitCode !== 0) {
process.exit(exitCode);
}

copyBundle();
});
114 changes: 0 additions & 114 deletions sites/website/src/pages/index.js

This file was deleted.

36 changes: 0 additions & 36 deletions sites/website/src/pages/styles.module.css

This file was deleted.