commit decdd2deedb1780120083ffc230e11b518db081f
parent fdf92c3ab90294d62c586ad10929061cc1fae999
Author: William Casarin <jb55@jb55.com>
Date: Sun, 28 Jan 2024 14:28:22 -0800
build: add build script to simplify build command
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
3 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -11,9 +11,8 @@
# next.js
/.next/
/out/
-
-# production
-/build
+/out-staging
+/out-production
# misc
.DS_Store
diff --git a/build b/build
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+env=$1
+
+npm run i18n
+
+if [ "$env" == "staging" ]
+then
+ export NEXT_PUBLIC_PURPLE_API_BASE_URL="https://api-staging.damus.io"
+ npx next build
+ mv out out-staging
+else
+ export NEXT_PUBLIC_PURPLE_API_BASE_URL="https://api.damus.io"
+ npx next build
+ mv out out-production
+fi
diff --git a/package.json b/package.json
@@ -4,8 +4,8 @@
"private": true,
"scripts": {
"dev": "next dev",
- "build": "npm run i18n && NEXT_PUBLIC_PURPLE_API_BASE_URL=https://api.damus.io next build && mv out out-production",
- "build-staging": "npm run i18n && NEXT_PUBLIC_PURPLE_API_BASE_URL=https://api-staging.damus.io next build && mv out out-staging",
+ "build": "./build",
+ "build-staging": "./build staging",
"start": "next start",
"export": "npm run i18n && next export",
"lint": "next lint",