Skip to content

Commit

Permalink
Update docs (#344)
Browse files Browse the repository at this point in the history
* Update docs
* Update readme
* Document cloudflare deployment
  • Loading branch information
NigelBreslaw authored Feb 11, 2024
1 parent f6e8903 commit 305de05
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 4 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

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

Full documentation and details about the project can be found [here](https://docs.guardianghost.com).

## 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)

Expand Down
3 changes: 2 additions & 1 deletion gg-mono/docs/starlight/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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/' }
],
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,54 @@ import FileTree from '../../../components/file-tree.astro';
- .gitignore
- **biome.json**

</FileTree>
</FileTree>

### 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.

21 changes: 21 additions & 0 deletions gg-mono/docs/starlight/src/content/docs/guides/todo.mdx
Original file line number Diff line number Diff line change
@@ -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
- [ ]
- [ ]

0 comments on commit 305de05

Please sign in to comment.