Path: blob/main/net-im/deltachat-desktop/scripts/make_node_tarball.sh
20806 views
#!/bin/sh1# Script for assembling the node dependencies required for FreeBSD packaging2#3# This is what I run to get the node_modules dirs needed to build the port4#5# Clone the https://github.com/deltachat/deltachat-desktop repo6# Then start with something like the following:7# git checkout -b v2.22.0 tags/v2.22.08#9# Finally you can run this script.10#11# Requirements: electron37, node, npm, deltachat-rpc-server1213set -eu1415VERSION=$(git branch --show-current)1617export ELECTRON_OVERRIDE_DIST_PATH=/usr/local/share/electron3718export ELECTRON_SKIP_BINARY_DOWNLOAD=11920# Cleanup21rm -rf node_modules pnpm packages/target-electron/node_modules deltachat-desktop-2.15.0-node-deps.tgz22git reset --hard2324# Install pnpm in temp dir to avoid package.json parsing issues25# It would throw an error on the "catalog:"26CWD=$(pwd)27TMP=$(mktemp -d)28cd $TMP29npm i pnpm30mv node_modules $CWD31cd $CWD32rm -r $TMP3334# Install all dependencies35echo "Installing dependencies..."36pnpm install3738# Build workspace packages that have build steps39echo "Building workspace packages..."40# shared and runtime are just TypeScript source, no build needed41pnpm --filter @deltachat-desktop/frontend build4243# Test the main build to ensure everything works44echo "Testing main build..."45cd packages/target-electron46pnpm build47cd ../..4849echo "Build test successful! All dependencies are working."5051# Remove platform-specific modules/binaries we don't need for FreeBSD52# TODO: there are possibly more that could be excluded53echo "Cleaning platform-specific binaries..."54rm -rf node_modules/.pnpm/*linux*55rm -rf node_modules/.pnpm/*darwin*56rm -rf node_modules/.pnpm/*win32*57rm -rf node_modules/.pnpm/*android*58rm -rf node_modules/.pnpm/@tauri-apps*59rm -rf node_modules/.pnpm/app-builder*60rm -rf node_modules/.pnpm/7zip-bin*61find node_modules -type f -name '*.exe' -delete6263# Remove duplicates which will make it harder to select the right path by64# globbing in Makefile during packaging65find node_modules/.pnpm -name "@deltachat+stdio-rpc-server@*" -type d | tail -n+2 | xargs rm -r6667echo "Creating tarball..."68tar -czvpf deltachat-desktop-${VERSION}-node-deps.tgz \69node_modules \70packages/target-electron/node_modules \71packages/frontend/node_modules \72packages/runtime/node_modules \73packages/shared/node_modules7475echo ""76echo "Tarball created successfully!"77echo "You can now upload this distfile"787980