mirror of
https://github.com/coracle-social/flotilla.git
synced 2025-12-10 02:47:06 +00:00
Add build in production script
This commit is contained in:
19
build-in-production.sh
Executable file
19
build-in-production.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Fetch tags and set to env vars
|
||||
git fetch --prune --unshallow --tags
|
||||
git describe --tags --abbrev=0
|
||||
export VITE_BUILD_VERSION=$RENDER_GIT_COMMIT
|
||||
export VITE_BUILD_HASH=$RENDER_GIT_COMMIT
|
||||
|
||||
# Remove link overrides
|
||||
node remove-pnpm-overrides.js package.json
|
||||
|
||||
# When CI=true as it is on render.com, removing link overrides breaks the lockfile
|
||||
pnpm i --no-frozen-lockfile
|
||||
|
||||
# Rebuild sharp
|
||||
pnpm rebuild
|
||||
|
||||
# The build runs out of memory at times
|
||||
NODE_OPTIONS=--max_old_space_size=16384 pnpm run build
|
||||
20
remove-pnpm-overrides.js
Normal file
20
remove-pnpm-overrides.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// This script is necessary for installing stuff on a host, since our links don't exist there.
|
||||
|
||||
import fs from "fs"
|
||||
|
||||
const pkgName = process.argv[2]
|
||||
|
||||
if (!pkgName?.endsWith("package.json")) {
|
||||
console.log("File passed was not a package.json file")
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const pkg = JSON.parse(fs.readFileSync(pkgName, "utf8"))
|
||||
|
||||
if (pkg.pnpm && pkg.pnpm.overrides) {
|
||||
delete pkg.pnpm.overrides
|
||||
fs.writeFileSync(pkgName, JSON.stringify(pkg, null, 2) + "\n")
|
||||
console.log("Removed pnpm.overrides from package.json")
|
||||
} else {
|
||||
console.log("No pnpm.overrides found in package.json")
|
||||
}
|
||||
Reference in New Issue
Block a user