Skip to content

Commit

Permalink
Initialize with/green-stack-icons
Browse files Browse the repository at this point in the history
  • Loading branch information
codinsonn committed Jan 13, 2024
0 parents commit f7fbe32
Show file tree
Hide file tree
Showing 321 changed files with 38,491 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .eslintignore
@@ -0,0 +1,6 @@
node_modules
**/*test.ts
**/(generated)/**/*
**/*.generated.*
**/*.d.ts
**/*.js
48 changes: 48 additions & 0 deletions .eslintrc
@@ -0,0 +1,48 @@
{
"env": {
"es6": true,
"node": true,
"react-native/react-native": true
},
"plugins": [
"@typescript-eslint",
"react",
"react-native",
"react-hooks",
"@react-native-community",
"jsx-a11y",
"no-secrets",
"prettier"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-native-a11y/all",
"prettier",
"next"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2022,
"ecmaFeatures": {
"jsx": true
}
},
"rules": {
"prettier/prettier": ["warn", {
"arrowParens": "always",
"semi": false,
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 100
}, { "usePrettierrc": false }],
"react-native-a11y/has-valid-accessibility-ignores-invert-colors": "off",
"@next/next/no-html-link-for-pages": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": ["warn", { "ignoreRestSiblings": true, "varsIgnorePattern": "_" }]
}
}
1 change: 1 addition & 0 deletions .github/FUNDING.yml
@@ -0,0 +1 @@
github: codinsonn
83 changes: 83 additions & 0 deletions .github/workflows/README.md
@@ -0,0 +1,83 @@
# Automatic deployments with Github Actions

We generally advise that you take full use of [Vercel](vercel.com) and [Expo](expo.dev) for automatic deployments. These are quite good and easy to set-up and link to your repo in their UI.

On top of this though, you can also enable automatic deployments through Github Actions to:
- Deploy your storybook docs with [Chromatic](https://www.chromatic.com/)
- Deploy your feature branches for testing with [Expo](https://github.com/expo/expo-github-action) (runs `eas update` whenever a branch updates)

Heads up though, as this will require setting up some secrets in your repository.

> We recommend [doppler](doppler.com) for managing and syncing secrets or env vars between services. You can find more information on how to set this up at [the doppler docs](https://docs.doppler.com/docs/github-actions).
## Publishing with EAS update

A basic workflow for publishing with EAS update is already added to your project when forking the repo. You can find it in `.github/workflows/eas.yml`.

However, it will only run when you add an `EXPO_ACCESS_TOKEN` secret to your repository. You can do this in the repository settings, but before you do that, you'll need to generate this token in their UI.

### Creating an Expo project and generating an access token

In the UI on expo.dev, create a new project. You can do this by clicking the `+` button in the top right corner and selecting `New Project`. You will then recieve instructions on how to link an existing codebase to your new project. You can run their own suggested command from `/apps/expo/` or tweak it to run from the project root with:

```bash
yarn eas-cli init --id {expo-project-id}
```

Since we're using a dynamic `app.config.js` file, it's likely you'll instead get instructions to add it manually:

`apps/expo/app.config.js`

```js
const config = ({ config }) => {
// EAS updates config (only applied when not using expo publish)
const easConfig = {
updates: {
// ...
url: 'https://u.expo.dev/{expo-project-id}',
},
extra: {
eas: {
projectId: '{expo-project-id}',
},
},
// ...
},
// ...
}
// ...
```

Once you've linked your project, you can generate an access token in the expo UI:
https://expo.dev/accounts/%5Baccount%5D/settings/access-tokens

Copy this token as `EXPO_ACCESS_TOKEN` and add it to your Github repository secrets. (Ideally through a sync with a tool like doppler)

## Publishing Storybook docs with Chromatic

Chromatic is a tool for publishing and reviewing your storybook docs. It's a great way to share your work with others and get feedback on your components.

You can find more information on how to set this up at [the Chromatic docs](https://www.chromatic.com/docs/setup).

Once you've set up your project, you can add the `CHROMATIC_PROJECT_TOKEN` to your repository secrets. (Ideally through a sync with a tool like doppler)

---

# Other deployments

## Deploying to web with Vercel

Vercel is a great tool for deploying your web apps. It's easy to set up and has a great UI for managing your deployments.
All you need to do is create a new project by importing your repository in their UI from Github.

- [https://vercel.com/new](https://vercel.com/new)

## Submit your mobile apps to the stores using EAS

- [Expo Docs: Expo Application Services](https://docs.expo.dev/eas/)
- [Expo Docs: EAS Submit](https://docs.expo.dev/submit/introduction/)

## Learn more about Aetherspace:

- [Single Sources of Truth for your Web & Mobile apps](/packages/@aetherspace/schemas/README.md)
- [Automation based on Single Sources of Truth and the File System](/packages/@aetherspace/scripts/README.md)
46 changes: 46 additions & 0 deletions .github/workflows/chromatic.yml
@@ -0,0 +1,46 @@
# Workflow name
name: 'Chromatic Deployment'

# Event for the workflow
on: push

# List of jobs
jobs:
test:
name: 'Chromatic Deployment'
runs-on: ubuntu-latest
steps:
- name: 'Check out Git repository'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 'Check secrets'
id: check-secrets
run: echo "has-secrets=$([ -n "${{ env.CHROMATIC_PROJECT_TOKEN }}" ] && echo true || echo false)" >> $GITHUB_OUTPUT
env:
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

- name: Setup Node
if: ${{ steps.check-secrets.outputs.has-secrets == 'true' }}
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn

- name: 'Warn required secrets'
if: ${{ steps.check-secrets.outputs.has-secrets == 'false' }}
run: echo 'CHROMATIC_PROJECT_TOKEN missing in Github secrets. Skipping Storybook deployment.'

- name: 'Install dependencies'
if: ${{ steps.check-secrets.outputs.has-secrets == 'true' }}
run: yarn

- uses: chromaui/action@v1
if: ${{ steps.check-secrets.outputs.has-secrets == 'true' }}
with:
#👇 Chromatic projectToken, see https://storybook.js.org/tutorials/intro-to-storybook/react/en/deploy/ to obtain it
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
env:
STORYBOOK_BACKEND_URL: ${{ secrets.BACKEND_URL }}
62 changes: 62 additions & 0 deletions .github/workflows/eas.yml
@@ -0,0 +1,62 @@
name: 'Expo: Publish Main'
on: "push"
jobs:
publish:
name: Install and publish
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: 'Check secrets'
id: check-secrets
run: echo "has-secrets=$([ -n "${{ env.EXPO_ACCESS_TOKEN }}" ] && echo true || echo false)" >> $GITHUB_OUTPUT
env:
EXPO_ACCESS_TOKEN: ${{ secrets.EXPO_ACCESS_TOKEN }}

- name: 'Warn required secrets'
if: ${{ steps.check-secrets.outputs.has-secrets == 'false' }}
run: echo 'EXPO_ACCESS_TOKEN missing in Github secrets. Skipping Expo deployment with EAS update.'

- name: Setup Node
if: ${{ steps.check-secrets.outputs.has-secrets == 'true' }}
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn

- name: Setup Expo
if: ${{ steps.check-secrets.outputs.has-secrets == 'true' }}
uses: expo/expo-github-action@v7
with:
expo-version: latest
eas-version: latest
expo-cache: true
packager: yarn
token: ${{ secrets.EXPO_ACCESS_TOKEN }}

- name: Find yarn cache
id: yarn-cache-path
if: ${{ steps.check-secrets.outputs.has-secrets == 'true' }}
run: echo "{dir}={dir::$(yarn cache dir)} >> $GITHUB_OUTPUT"

# - name: Restore cache
# if: ${{ steps.check-secrets.outputs.has-secrets == 'true' }}
# uses: actions/cache@v2
# with:
# path: ${{ steps.yarn-cache-path.outputs.dir }}
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# restore-keys: ${{ runner.os }}-yarn-

- name: Install Node.js dependencies
if: ${{ steps.check-secrets.outputs.has-secrets == 'true' }}
run: yarn install --immutable

- name: Deploy with EAS update
if: ${{ steps.check-secrets.outputs.has-secrets == 'true' }}
run: cd apps/expo && eas update --auto
env:
ENV: staging
BACKEND_URL: ${{ secrets.BACKEND_URL }}
NEXT_PUBLIC_APP_LINKS: ${{ secrets.NEXT_PUBLIC_APP_LINKS }}
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ secrets.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }}
20 changes: 20 additions & 0 deletions .github/workflows/lint.yml
@@ -0,0 +1,20 @@
name: Linting
on: [push]
jobs:
check-linting:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn

- name: Install packages
run: yarn install --immutable

- name: Run linting
run: yarn lint
36 changes: 36 additions & 0 deletions .gitignore
@@ -0,0 +1,36 @@
node_modules/
node_modules
.env

# Internal Packages
packages/@aetherspace/**/*.d.ts
packages/@aetherspace/**/*.js
!packages/@aetherspace/docs/addons/preset.js
!packages/@aetherspace/docs/addons/gqlPlaygroundAddon.js

# Expo
.expo/

# macOS
.DS_Store

# vscode
.vscode

# turborepo
.turbo

# next.js
**/public/workbox-*.js
**/public/workbox-*.js.map
**/public/sw.js
**/public/sw.js.map
**/public/fallback-*.js

# Vercel
.vercel
tsconfig.tsbuildinfo
doppler.yaml

# Storybook
build-storybook.log

0 comments on commit f7fbe32

Please sign in to comment.