-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# map Go's os and arch to Node's | ||
os="" | ||
if [ "$GOOS" == "linux" ]; then | ||
os="linux" | ||
elif [ "$GOOS" == "darwin" ]; then | ||
os="mac" | ||
fi | ||
|
||
arch="" | ||
if [ "$GOARCH" == "amd64" ]; then | ||
arch="x64" | ||
elif [ "$GOARCH" == "arm64" ]; then | ||
arch="arm64" | ||
fi | ||
|
||
cmd_base="pkg -c pkg.json --output bin/yjs-server" | ||
input_file="dist/yjs-server.js" | ||
|
||
# if both os and arch are set, modify the command to include the -t option | ||
if [[ -n "$os" && -n "$arch" ]]; then | ||
target="node20-${os}-${arch}" | ||
cmd="$cmd_base -t ${target} $input_file" | ||
else | ||
# bundle for the current platform | ||
cmd="$cmd_base $input_file" | ||
fi | ||
|
||
# execute the command | ||
echo "Executing command: $cmd" | ||
$cmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# map Go's os and arch to Node's | ||
os="" | ||
if [ "$GOOS" == "linux" ]; then | ||
os="linux" | ||
elif [ "$GOOS" == "darwin" ]; then | ||
os="mac" | ||
fi | ||
|
||
arch="" | ||
if [ "$GOARCH" == "amd64" ]; then | ||
arch="x64" | ||
elif [ "$GOARCH" == "arm64" ]; then | ||
arch="arm64" | ||
fi | ||
|
||
rm -rf node_modules | ||
|
||
# if both GOOS and GOARCH are set, modify the command to include the -t option | ||
if [[ -n "$os" && -n "$arch" ]]; then | ||
# install dependencies w.r.t the os and arch | ||
echo "Cross-building for ${os}-${arch}" | ||
npm_config_platform=${os} npm_config_arch=${arch} npm install | ||
else | ||
# install dependencies for the current platform | ||
echo "Building for the current platform" | ||
npm install | ||
fi | ||
|
||
# build | ||
cross-env TS_NODE_PROJECT=\"tsconfig.webpack.json\" webpack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: "3" | ||
|
||
tasks: | ||
start: | ||
cmds: | ||
- npm run dev | ||
dir: app/yjs-server | ||
|
||
pack: | ||
cmds: | ||
- npm run pack | ||
dir: app/yjs-server | ||
|
||
build: | ||
deps: [pack] | ||
cmds: | ||
- npm run build | ||
dir: app/yjs-server |