Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ This repo is a **GitHub template**, so you can spin up your own app from it:
1. **Get a copy** — click **“Use this template” → Create a new repository** (clean
history). Or without GitHub: `npx degit artsy/react-native-starter my-app`, or
fork/clone.
2. **Install & add keys** — `yarn install`, then `cp keys.example.json keys.json`
and fill in your own values (real `keys*.json` are gitignored). Artsy engineers
run `yarn setup:artsy` for fonts + env; outside Artsy, supply your own fonts/env.
2. **Set up & install** — outside Artsy run `yarn setup:oss` (placeholder fonts +
`keys.json`, no private access needed), then `yarn install`. Artsy engineers run
`yarn setup:artsy` instead. Fill in your own `keys.json` values (real `keys*.json`
are gitignored).
3. **Rebrand** — edit `app.json` (`name`, `slug`, iOS `bundleIdentifier`, Android
`package`, icons/splash). Don't hand-edit the generated `ios/`/`android/` folders.
4. **Point at your backend** — swap `data/schema.graphql` for your GraphQL API
Expand Down Expand Up @@ -51,7 +52,27 @@ yarn ios # or: yarn android
```

**For OSS Contributors**
Instructions coming later

```sh
# 1. Install the pinned toolchain (node, ruby, java, yarn)
mise install # or `asdf install`

# 2. Set up placeholder fonts + keys.json (no Artsy/S3 access needed), then install
yarn setup:oss
yarn install

# 3. Generate the native projects
yarn prebuild

# 4. Run the app
yarn ios # or: yarn android
```

`yarn setup:oss` writes **empty placeholder** `Unica77LL` fonts into
`assets/fonts` (the real fonts are Artsy-private — text falls back to the system
font; drop your own `.otf` files there to change it) and creates `keys.json`
from `keys.example.json`. So you **don't** need to source `assets/fonts/Unica77LL-*.otf`
yourself.

## Features

Expand Down
28 changes: 23 additions & 5 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ This repo is a **GitHub template**. To kickstart your own app:
4. Then follow **Install → Configure keys → Generate the native projects → Run**
below.

> Outside Artsy, skip `yarn setup:artsy` (it fetches Artsy-private fonts + env) and
> provide your own fonts in `assets/fonts` and env/keys instead.
> Outside Artsy, use `yarn setup:oss` (not `yarn setup:artsy`) — it needs no
> private access and writes placeholder fonts + `keys.json` so you don't have to
> source Artsy's private fonts. Drop your own `.otf` files in `assets/fonts` to
> use your own typefaces.

## Prerequisites

Expand All @@ -48,16 +50,32 @@ You'll also need the native build toolchains — Xcode for iOS and Android Studi

## Install

**For Artsy engineers**, `yarn setup:artsy` downloads fonts and environment
variables:
**For Artsy engineers**, `yarn setup:artsy` downloads the real fonts and
environment variables from S3 (needs Artsy AWS access):

```sh
yarn setup:artsy # fonts + env vars (Artsy engineers only)
yarn install
```

**For open-source contributors**, run `yarn setup:oss` instead — it needs no
private resources:

```sh
yarn setup:oss # placeholder fonts + keys.json from the example
yarn install
```

`yarn setup:oss` writes **empty placeholder** `Unica77LL` fonts into
`assets/fonts` so `expo prebuild` resolves them (the real fonts are
Artsy-private, so text falls back to the system font — drop your own `.otf`
files in `assets/fonts` to change that) and creates `keys.json` from
`keys.example.json` if you don't have one. So you **don't** need to obtain
`assets/fonts/Unica77LL-*.otf` yourself.

Fonts are bundled through the `expo-font` config plugin from `assets/fonts`
(populated by `yarn setup:artsy`) — that directory is gitignored.
(populated by `yarn setup:artsy` or `yarn setup:oss`) — that directory is
gitignored.

## Configure keys

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"e2e:record": "agent-device replay --update",
"e2e:impact": "sniffler impact --base origin/main --head HEAD",
"setup:artsy": "./scripts/setup-env-for-artsy",
"setup:oss": "./scripts/setup-oss",
"prettier-project": "yarn prettier --write 'src/**/*.{ts,tsx}'",
"prettier-write": "prettier --write --ignore-unknown",
"sync-schema": "curl https://raw.githubusercontent.com/artsy/metaphysics/main/_schemaV2.graphql -o data/schema.graphql; yarn prettier --write --parser graphql data/schema.graphql",
Expand Down
62 changes: 62 additions & 0 deletions scripts/setup-oss
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env bash
#
# setup-oss — prepare the project for open-source contributors.
#
# Unlike `yarn setup:artsy` (which downloads Artsy's private Unica77LL fonts and
# env from S3 and needs Artsy AWS access), this uses no private resources. It:
#
# 1. Creates placeholder Unica77LL font files in assets/fonts so `expo
# prebuild` / the expo-font plugin resolve them. They are empty stand-ins —
# the real fonts are Artsy-private, so the app falls back to system fonts.
# Drop real .otf files in assets/fonts to use your own typefaces.
# 2. Creates keys.json from keys.example.json if you don't have one yet
# (react-native-keys reads secrets from keys.json; real keys*.json are
# gitignored).
#
# Run via: yarn setup:oss
set -euo pipefail

ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"

# Keep this list in sync with the `expo-font` plugin's `fonts` array in app.json.
FONT_DIR="assets/fonts"
FONTS=(
"Unica77LL-Regular.otf"
"Unica77LL-Medium.otf"
"Unica77LL-Italic.otf"
"Unica77LL-MediumItalic.otf"
)

echo "▸ Placeholder fonts in $FONT_DIR (real Unica77LL fonts are Artsy-private)"
mkdir -p "$FONT_DIR"
for f in "${FONTS[@]}"; do
if [ -s "$FONT_DIR/$f" ]; then
echo " • keeping existing $FONT_DIR/$f"
else
: > "$FONT_DIR/$f"
echo " • created placeholder $FONT_DIR/$f"
fi
done

echo "▸ keys.json (react-native-keys)"
if [ -f keys.json ]; then
echo " • keys.json already exists — leaving it as-is"
else
cp keys.example.json keys.json
echo " • created keys.json from keys.example.json — fill in your own values"
fi

cat <<'EOF'

✅ OSS setup complete. Next:

yarn install
yarn prebuild # generate ios/ and android/
yarn ios # or: yarn android

Notes:
• Fonts are empty placeholders, so text renders in the system font. Replace the
files in assets/fonts with your own .otf files to change that.
• keys.json holds secrets and is gitignored — fill in real values as needed.
EOF
Loading