Skip to content
Closed
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
20 changes: 20 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
41 changes: 41 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
63 changes: 63 additions & 0 deletions docs/docs/getting-started.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
sidebar_position: 1
---

# Getting started

## Install

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

<Tabs>
<TabItem label="yarn" value="yarn">

```sh
yarn add -D expo-build-flags
```

</TabItem>
<TabItem label="npm" value="npm">

```sh
npm install -save-dev expo-build-flags
```

</TabItem>
</Tabs>

## Setup flags files

```sh
yarn build-flags init
```

Running this in your repo will:

- write a `flags.yml` file at the root of your repo
- write a `buildFlags.ts` in your src or app folder
- update your .gitignore to ignore the runtime file (`buildFlags.ts`)

## Workflow

To generate the gitignored runtime file using the existing flag states in flags.yml, run the override command of the CLI with no arguments:

```sh
yarn build-flags override
```

To enable a flag that's defaulted to off (false) in the base flags.yml file, run:

```sh
yarn build-flags override +flagNameToEnable
```

Likewise if there's a flag that's defaulted to on (true) in flags.yml and you want it off, run:

```sh
yarn build-flags override -flagNameToDisable
```

We recommend running the first command (`yarn build-flags override`) in your package.json `postinstall` script so that default flag states are used by default.

Read more in [Recipes](/docs/recipes) for more ways to use this library.
6 changes: 6 additions & 0 deletions docs/docs/how-it-works.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
---

# How it works

Coming soon.
9 changes: 9 additions & 0 deletions docs/docs/recipes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
sidebar_position: 2
---

# Recipes

- Ensure default flag values for releases and mainline development
- Enable constants folding for tree shaking
- Linking native dependencies based on flag state
88 changes: 88 additions & 0 deletions docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { themes as prismThemes } from "prism-react-renderer";
import type { Config } from "@docusaurus/types";
import type * as Preset from "@docusaurus/preset-classic";

// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)

const config: Config = {
title: "Expo Build Flags",
tagline: "Safer releases, more control",
favicon: "img/favicon.ico",

// Set the production url of your site here
url: "https://your-docusaurus-site.example.com",
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/",

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "facebook", // Usually your GitHub org/user name.
projectName: "docusaurus", // Usually your repo name.

onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",

// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: ["en"],
},

markdown: {
mermaid: true,
},
themes: ["@docusaurus/theme-mermaid"],

presets: [
[
"classic",
{
docs: {
sidebarPath: "./sidebars.ts",
},
theme: {
customCss: "./src/css/custom.css",
},
} satisfies Preset.Options,
],
],

themeConfig: {
// Replace with your project's social card
image: "img/docusaurus-social-card.jpg",
navbar: {
title: "Expo Build Flags",
logo: {
alt: "My Site Logo",
src: "img/logo.svg",
},
items: [
{
type: "docSidebar",
sidebarId: "docs",
position: "left",
label: "Docs",
},
{
href: "https://github.com/sterlingwes/expo-build-flags",
label: "GitHub",
position: "right",
},
],
},
footer: {
style: "dark",
copyright:
"Expo Build Flags is a community project unaffiliated with Expo or 650 Industries, Inc.",
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
} satisfies Preset.ThemeConfig,
};

export default config;
Loading