From 305de05ae8295528717be7bc19ea562dad25f577 Mon Sep 17 00:00:00 2001 From: Nigel Breslaw Date: Sun, 11 Feb 2024 11:23:28 +0100 Subject: [PATCH] Update docs (#344) * Update docs * Update readme * Document cloudflare deployment --- README.md | 6 ++- gg-mono/docs/starlight/astro.config.mjs | 3 +- .../docs/guides/automated-deployment.md | 9 ++++ .../content/docs/guides/coding-guidelines.mdx | 52 ++++++++++++++++++- .../src/content/docs/guides/todo.mdx | 21 ++++++++ 5 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 gg-mono/docs/starlight/src/content/docs/guides/todo.mdx diff --git a/README.md b/README.md index 7bdf160e0..808718e63 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ As of December 2023 this is a monorepo built around going beyond the Ishtar Commander mobile applications. -The tech choices are based on interesting new tools to learn. However the main app will use React. +The tech choices are based on interesting new tools to learn. However the main app will use React-Native. ## Developer environment @@ -10,7 +10,9 @@ Full documentation and details about the project can be found [here](https://doc ## Main deployments -Main website [guardianghost.com](https://guardianghost.com) +Landing/Marketing page [guardianghost.com](https://guardianghost.com) + +Web app site [app.guardianghost.com](https://app.guardianghost.com) Stats dashboard [dashboard.guardianghost.com](https://dashboard.guardianghost.com) diff --git a/gg-mono/docs/starlight/astro.config.mjs b/gg-mono/docs/starlight/astro.config.mjs index 4be599b81..129ed502b 100644 --- a/gg-mono/docs/starlight/astro.config.mjs +++ b/gg-mono/docs/starlight/astro.config.mjs @@ -25,7 +25,8 @@ export default defineConfig({ { label: 'React Native', link: '/guides/react-native/' }, { label: 'Costs', link: '/guides/costs/' }, { label: 'Misc', link: '/guides/misc/' }, - { label: 'Authentication', link: '/guides/authentication/' } + { label: 'Authentication', link: '/guides/authentication/' }, + { label: 'To-do\'s', link: '/guides/todo/' } ], }, ], diff --git a/gg-mono/docs/starlight/src/content/docs/guides/automated-deployment.md b/gg-mono/docs/starlight/src/content/docs/guides/automated-deployment.md index 596b1109f..e2c006b96 100644 --- a/gg-mono/docs/starlight/src/content/docs/guides/automated-deployment.md +++ b/gg-mono/docs/starlight/src/content/docs/guides/automated-deployment.md @@ -14,6 +14,15 @@ All the web apps are deployed to production and development tracks on Cloudflare Note all the web deployments and iOS beta + TestFlight deployment are 100% automated. iOS production deployments could also be automated, but this isn't wise till the first couple of releases have been completed manually and successfully. +### Cloudflare +To create a new deployment e.g. for say 'new.guardianghost.com' first visit the [cloudflare pages dashboard](https://dash.cloudflare.com/a993e54a3f3b468de91f1d9d6d9499e7/workers-and-pages). Then Create Application > Pages > Upload assets. And add a bare bones html site for the first deployment. Give it a name e.g. 'gg-new'. + +Once deployed you can then copy one of existing cloudflare deployments from .github/workflows. Then change the project it builds to the new one and the deploy 'projectName:' to be the new one e.g. 'gg-new'. Also change the 'directory:' to upload the new built project. + +Then go the 'gg-new' or whatever dashboard on cloudflare and set the custom domain to be 'new.guardianghost.com' or whatever the name is. + +That's it! There is a global api and account token. The action just needs to know the new project name and what files to upload. + ### Xcode Cloud While all the other deployments are automated and run on Github actions, iOS does not. Instead it runs on Xcode Cloud which has been linked with the Github repo. The reasons for this are cost, ease of deployment and security. The standard apple developer account comes with 1500 minutes a month of Xcode Cloud build time for free. It's fully integrated with Apple's developer system so all the app certificate management and signing 'just works'. Finally the entire certificate system is managed by Apple so there are no security concerns or extra setup needed to protect these items for a project hosted in a public github repo. They don't even need to be added as github secrets. diff --git a/gg-mono/docs/starlight/src/content/docs/guides/coding-guidelines.mdx b/gg-mono/docs/starlight/src/content/docs/guides/coding-guidelines.mdx index 602ff9c1b..9363827c2 100644 --- a/gg-mono/docs/starlight/src/content/docs/guides/coding-guidelines.mdx +++ b/gg-mono/docs/starlight/src/content/docs/guides/coding-guidelines.mdx @@ -17,4 +17,54 @@ import FileTree from '../../../components/file-tree.astro'; - .gitignore - **biome.json** - \ No newline at end of file + + +### Functions +Explicit functions should be 'named', not arrow functions +```ts +// Valid +function myFunction() { + // ... +} + +// Not valid +const myFunction = () => { + // ... +} +``` + +Arrow functions are great when needed in-line +```ts +myArray.map((item) => { + return item + 1; +}); +``` +### Imports +When importing functions from the project (not NPM) use file extensions. This means the +monorepo tools don't need to do extra work trying a range of extensions on hundreds of files. +The project is set up so you can rely on autocomplete for imports and it will add the extension for you. +```ts +// Valid +import { myFunction } from './my-file.ts'; + +// Not valid +import { myFunction } from './my-file'; +``` + +### Exports +A common problem is the use of 'barrel files' which export everything from a folder. +This can cause performance issues, especially in a monorepo. You need just one function +from a file, but behind the scenes the whole file is being imported and parsed. + +Instead, export each function directly from the file and rely on autocomplete to help you find the right file. +```ts +// Valid +export function myFunction() { + // ... +} + +// Not valid +export * from './my-file'; +``` +TODO: When Biome [supports](https://biomejs.dev/linter/rules/no-re-export-all) it, add a rule to enforce this. + diff --git a/gg-mono/docs/starlight/src/content/docs/guides/todo.mdx b/gg-mono/docs/starlight/src/content/docs/guides/todo.mdx new file mode 100644 index 000000000..cd7586106 --- /dev/null +++ b/gg-mono/docs/starlight/src/content/docs/guides/todo.mdx @@ -0,0 +1,21 @@ +--- +title: To-do's +description: Long term to-do's +--- + +I prefer to keep the github issues as clean as possible. For certain types of todo, +such as those where I am waiting on a new feature with no clear date I will store them here. + +- [ ] When Biome [supports](https://biomejs.dev/linter/rules/no-re-export-all) it, add a rule to enforce this. Also update +the coding guide page that has this todo on it. +- [ ] When possible move the react-native project into the PNPM workspaces. It's a future plan of Expo and react-native. +- [ ] Github action to check documentation for dead links. See [here](https://docs.github.com/en/actions/examples/using-the-github-cli-on-a-runner). +- [ ] Android signing action is outdated and no longer [maintained](https://github.com/r0adkll/sign-android-release). +- [ ] Look into an nginx reverse proxy for turbo repo with ssh key so https can be used. Seems oracle support updating the ssl themselves, but you still need to generate your own cert first. +- [ ] Try out Graphite stacked diffs? +- [ ] Trial a remote gradle cache. +- [ ] Trial a local ccache. +- [ ] Trial a shared ccache, scache? +- [ ] Look at adding [Codspeed](https://codspeed.io/blog) for CI based benchmarking +- [ ] +- [ ]