Skip to content

Commit

Permalink
Add script to copy homepage into website dir
Browse files Browse the repository at this point in the history
  • Loading branch information
radium-v committed Jun 12, 2020
1 parent 3f2e5de commit 534aceb
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 173 deletions.
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>
<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>
</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",
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",
}),
],
});
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",

// 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",
"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.

0 comments on commit 534aceb

Please sign in to comment.