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
58 changes: 58 additions & 0 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Deployment Guide for Netlify

This monorepo is configured to deploy both the marketing site (`corewar-public`) and the game app (`corewar-app`) to Netlify as a single deployment.

## Deployment Structure

- **`/`** → Marketing site (`corewar-public`)
- **`/app`** → Game/Editor app (`corewar-app`)

## Netlify Configuration

The `netlify.toml` file is already configured with:
- Build command: `pnpm run build:unified`
- Publish directory: `build`
- Routing rules for both packages

## Deployment Steps

1. **Connect your repository to Netlify**
- Go to [Netlify](https://netlify.com)
- Connect your GitHub repository
- Netlify will automatically detect the `netlify.toml` configuration

2. **Build Process**
- Netlify will run `pnpm run build:unified`
- This builds both packages and creates the unified structure
- Marketing site goes to root `/`
- Game app goes to `/app`

3. **Routing**
- All routes are handled by the respective `index.html` files
- Client-side routing works for both packages

## Local Testing

To test the deployment locally:

```bash
# Build the unified package
pnpm run build:unified

# Serve the build directory
npx serve -s build -p 3000

# Test the routes
# http://localhost:3000/ → Marketing site
# http://localhost:3000/app → Game app
```

## CTA Links

The "Play Now" buttons in the marketing site now point to `/app` instead of the old `app/editor/src` path.

## Troubleshooting

- **Build fails**: Make sure all dependencies are installed with `pnpm install`
- **Routing issues**: Check that the `netlify.toml` file is in the root directory
- **Static assets**: Both packages build to their respective directories and are copied to the unified build
13 changes: 13 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[build]
publish = "build"
command = "pnpm run build:unified"

[[redirects]]
from = "/app/*"
to = "/app/index.html"
status = 200

[[redirects]]
from = "/*"
to = "/index.html"
status = 200
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@
"name": "root",
"private": true,
"packageManager": "pnpm@10.15.0",
"engines": {
"node": ">=24.0.0"
},
"engines": {
"node": ">=22.0.0"
},
"scripts": {
"dev": "turbo run dev",
"build": "turbo run build",
"build:unified": "pnpm clean && pnpm build:public && pnpm build:app && pnpm copy:public && pnpm copy:app",
"build:public": "cd packages/corewar-public && pnpm build",
"build:app": "cd packages/corewar-app && pnpm build",
"copy:public": "mkdir -p build && cp -r packages/corewar-public/build/* build/",
"copy:app": "mkdir -p build/app && cp -r packages/corewar-app/build/* build/app/",
"deploy:build": "pnpm run build:unified",
"dev": "turbo run dev",
"start": "turbo run start",
"test": "turbo run test",
"coverage": "turbo run coverage",
"lint": "turbo run lint",
"lint:fix": "eslint --fix \"**/*.{ts,js}\"",
"clean": "turbo run clean",
"clean": "rm -rf build && rm -rf packages/*/build",
"bootstrap": "pnpm install"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/corewar-public/src/features/common/siteNav.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import styled from 'styled-components'

import { colour, space } from '../common/theme'
import { media } from '../common/mediaQuery'
import { colour, space } from '../common/theme'

const Header = styled.header`
display: flex;
Expand Down Expand Up @@ -43,7 +43,7 @@ const Nav = styled.nav`
const SiteNav = () => (
<Header>
<Nav>
<a href={`/app/editor/src`}>play</a>
<a href={`/app`}>play</a>
<a href={`/learn`}>learn</a>
<a href={`/#features`}>features</a>
<a href={`/sign-up`}>sign up</a>
Expand Down
8 changes: 4 additions & 4 deletions packages/corewar-public/src/features/onboarding/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ const Home = () => (
<SiteNav />
<HeroLogo />
<CallToAction>
<PrimaryButton href="/app/editor/src">Play Now</PrimaryButton>
<PrimaryButton href="/app">Play Now</PrimaryButton>
<FeatureButton href="/learn">Learn more</FeatureButton>
</CallToAction>
<Tagline id={`features`}>
Expand Down Expand Up @@ -408,7 +408,7 @@ const Home = () => (
<Octicon name='rocket' />
<h3>Play corewar</h3>
<p>Enjoy a slice of coding history by playing and learning the classic game corewar</p>
<PrimaryButton href='/app/src'>Play Now</PrimaryButton>
<PrimaryButton href='/app'>Play Now</PrimaryButton>
</Feature>
<Feature>
<Octicon name='device-mobile' />
Expand All @@ -432,7 +432,7 @@ const Home = () => (
<Octicon name="mortar-board" />
<h3>Experienced player</h3>
<p>I’ve played corewar before and understand the instructions and concepts</p>
<PrimaryButton href="/app/editor/src">Play Now</PrimaryButton>
<PrimaryButton href="/app">Play Now</PrimaryButton>
<Guidance>
<Octicon name="hubot" />
<SpeechArrow />
Expand Down Expand Up @@ -550,7 +550,7 @@ const Home = () => (
<Prospect>
<h2>Check out the app</h2>
<Octicon name="beaker" />
<PrimaryButton href="/app/editor/src">Play Now</PrimaryButton>
<PrimaryButton href="/app">Play Now</PrimaryButton>
</Prospect>
<Footer>
&copy; 2018 <a href="http://www.corewar.io">www.corewar.io</a> - crafted with love by{' '}
Expand Down