Skip to content

Commit

Permalink
move desktop site to separate folder (finos#988)
Browse files Browse the repository at this point in the history
* move desktop site to separate folder

* mobile build script

* remove injectScript

* add redirect script instead of inject

* try adding desktop build

* add missing import

* add second build, for desktop

* fix typo

* save desktop config

* add script to switch desktop or mobile resources

* add additional desktop resources

* add misisng links

* add missing images
  • Loading branch information
heswell authored Nov 23, 2023
1 parent 3fbc182 commit 7f79271
Show file tree
Hide file tree
Showing 100 changed files with 7,715 additions and 194 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ website/build/
website/i18n/
website/.docusaurus/
website/package-lock.json
website-desktop/translated_docs/
website-desktop/build/
website-desktop/i18n/
website-desktop/.docusaurus/
website-desktop/package-lock.json

# Generated docs
docs/contributing.md
Expand Down
22 changes: 17 additions & 5 deletions vuu-ui/scripts/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ export const execWait = (cmd, cwd = ".") =>
new Promise((resolve, reject) => {
// const newProcess = exec(cmd, { cwd }, (err, stdout, stderr) => {
exec(cmd, { cwd }, (err, stdout, stderr) => {
if (err) {
reject(err);
}
console.log(stdout);
if (stderr) {
console.log(`stderr: ${stderr}`);
}
console.log(stdout);
resolve();
if (err) {
reject(err);
} else {
resolve();
}
});
// newProcess.stdout.on("data", function (data) {
// console.log(data);
Expand Down Expand Up @@ -105,6 +106,17 @@ export const assertFolderExists = (folderName, exitIfFalse) => {
return true;
};

export const writeFile = async (text, path) =>
new Promise((resolve, reject) => {
fs.writeFile(path, text, (err) => {
if (err) {
reject(err);
} else {
resolve();
}
});
});

export const writeJsonFileFile = async (json, path) =>
new Promise((resolve, reject) => {
fs.writeFile(path, JSON.stringify(json, null, 2), (err) => {
Expand Down
30 changes: 30 additions & 0 deletions website-desktop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
This website was created with [Docusaurus v2](https://v2.docusaurus.io/).

In order to start working with Docusaurus, please read the [Getting Started guide](https://docusaurus.io/docs/configuration) and browse through the following folders and files:

- `website` - contains the Node/React code to build the website
- `website/docusaurus.config.js` - contains the Docusaurus configuration; you'll need to edit this file.
- `website/static` - contains images, PDF and other static assets used in the website; if you add a `file.pdf` in this folder, it will be served as `https://<your_host>/file.pdf`.
- `docs` - contains the `.md` and `.mdx` files that are served as `https://<your_host>/<file_id>` ; the `file_id` is defined at the top of the file.

## Local run

Running Docusaurus locally is very simple, just follow these steps:

- Make sure `node` version is 14 or higher, using `node -v` ; you can use [nvm](https://github.com/nvm-sh/nvm) to install different node versions in your system.
- `cd website ; npm install ; npm run start`

The command should open your browser and point to `http://localhost:3000`.

## Deployment

[Netlify] (https://www.netlify.com/) is the default way to serve FINOS websites publicly. Find docs [here] (https://docs.netlify.com/configure-builds/get-started/).

You can configure Netlify using your own GitHub account, pointing to a personal repository (or fork); when adding a new site, please use the following configuration:

- Working directory: `website`
- Build command: `yarn build`
- Build directory: `website/build`

If you want to serve your website through `https://<project_name>.finos.org`, please email [[email protected]](mailto:[email protected]). To check a preview, visit https://project-blueprint.finos.org .
.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Docs at https://v2.docusaurus.io/docs/configuration
const fs = require("fs");

// Replace 'project-blueprint' with {project name}
const projectName = "VUU";
Expand All @@ -11,7 +12,7 @@ module.exports = {
title: `FINOS ${projectName}`,
tagline: `FINOS ${projectName}`,
url: "https://vuu.finos.org",
baseUrl: "/",
baseUrl: "/desktop/",
favicon: "img/favicon/vuu-logo-favicon.png",
projectName: `FINOS ${projectName}`,
organizationName: "FINOS",
Expand Down
20 changes: 20 additions & 0 deletions website-desktop/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"scripts": {
"start": "docusaurus start",
"swizzle": "docusaurus swizzle",
"build": "node ./scripts/build-desktop.mjs",
"publish-gh-pages": "docusaurus deploy"
},
"devDependencies": {
"@docusaurus/core": "^2.2.0",
"@docusaurus/preset-classic": "^2.2.0",
"classnames": "^2.2.6",
"eslint": "^7.25.0",
"eslint-plugin-react": "^7.23.2",
"react": "^16.10.2",
"react-dom": "^16.10.2"
},
"dependencies": {
"is-promise": "2.1.0"
}
}
13 changes: 13 additions & 0 deletions website-desktop/scripts/build-desktop.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { execWait, writeFile } from "../../vuu-ui/scripts/utils.mjs";
import fs from "fs";
import { execSync } from "child_process";

const redirectToDesktop = `<script>if (window.innerWidth > 1380) window.location.href="/desktop"</script>`;

console.log(`run desktop build`);
await execWait("docusaurus build --out-dir ../website/build/desktop");
// let stdout = execSync("docusaurus build --out-dir ../website/build/desktop");
// console.log(stdout.toString());

// console.log(`run desktop build`);
// await execWait(`docusaurus build`);
3 changes: 3 additions & 0 deletions website-desktop/scripts/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const { build } = require("@docusaurus/core/lib");

build();
138 changes: 138 additions & 0 deletions website-desktop/sidebars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
module.exports = {
mainSidebar: [
{
type: "category",
label: "Introduction",
items: [
"introduction/what_is",
"introduction/how_does_it_work",
"introduction/trade-offs",
],
link: {
type: "doc",
id: "introduction/intro",
},
},
{
type: "category",
label: "Getting Started",
items: [
"getting_started/developing",
"getting_started/adding",
"getting_started/using_vuu_from_java",
"getting_started/configuration",
],
link: {
type: "doc",
id: "getting_started/getting_started",
},
},
{
type: "category",
label: "Core Concepts",
items: [
"providers_tables_viewports/lifecycle",
"providers_tables_viewports/providers",
"providers_tables_viewports/tables",
"providers_tables_viewports/viewports",
"providers_tables_viewports/filter_sort",
"providers_tables_viewports/modules",
],
link: {
type: "doc",
id: "providers_tables_viewports/providers_tables_viewports",
},
},
{
type: "category",
label: "Trees and Session Tables",
items: ["trees/trees", "trees/tree_builder", "trees/aggregates"],
link: {
type: "doc",
id: "trees/trees_session_tables",
},
},
{
type: "category",
label: "Server Internals",
items: [
"server_internals/tickpath",
"server_internals/viewport_thread",
"server_internals/join_manager",
],
link: {
type: "doc",
id: "server_internals/server_internals",
},
},
{
type: "category",
label: "Remote Procedure Calls",
items: ["rpc/service", "rpc/Menu_items"],
link: {
type: "doc",
id: "rpc/rpc",
},
},
{
type: "category",
label: "Wire Protocol",
items: ["wire/viewport_ack_nack"],
link: {
type: "doc",
id: "wire/wire_protocol",
},
},
{
type: "category",
label: "The UI",
items: [
"ui/vuu_data",
"ui/vuu_data_ag_grid",
"ui/vuu_data_table",
"ui/visual_linking",
"ui/custom_controls",
"ui/calculated_columns",
],

link: {
type: "doc",
id: "ui/ui-overview",
},
},
{
type: "category",
label: "Performance Optimisation",
items: ["perf/indices", "perf/query_planner"],
link: {
type: "doc",
id: "perf/performance_optimization",
},
},
{
type: "category",
label: "Security",
items: ["security/authentication", "security/authorisation"],
link: {
type: "doc",
id: "security/security",
},
},
{
type: "category",
label: "New Features - RFC",
items: ["rfc/conditional_formatting"],
},
{
type: "category",
label: "FAQ",
items: ["faq/debugging_json_messages"],
link: {
type: "doc",
id: "faq/faq",
},
},
"team",
"roadmap",
],
};
Loading

0 comments on commit 7f79271

Please sign in to comment.