Skip to content

Commit

Permalink
include scope in optionalDependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
dave4420 committed Mar 31, 2024
1 parent 524e89f commit c5e9191
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions bin/build-npm-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ rm -rf npm
mkdir npm

package_name=gen-elm-wrappers
scope=@dave4420

# general approach taken from <https://sentry.engineering/blog/publishing-binaries-on-npm>

Expand Down Expand Up @@ -72,7 +73,7 @@ list-binaries-to-build | while read GOOS GOARCH ; do
continue
esac

arch_package_name=@dave4420/$package_name-$process_platform-$process_arch
arch_package_name=$scope/$package_name-$process_platform-$process_arch
mkdir -p npm/$arch_package_name/bin
cat <<PACKAGE_JSON > npm/$arch_package_name/package.json
{
Expand Down Expand Up @@ -113,12 +114,8 @@ node -e '
pj.bin = "bin/cli.js";
delete pj.devDependencies;
pj.optionalDependencies = {};
fs.readdirSync("npm").forEach((dir) => {
// DAVE: recurse into @dave4420
if (dir === "'$package_name'") {
return;
}
pj.optionalDependencies[dir] = process.env.BINARY_VERSION;
fs.readdirSync("npm/'$scope'").forEach((dir) => {
pj.optionalDependencies[`'$scope'/${dir}`] = process.env.BINARY_VERSION;
});
process.stdout.write(JSON.stringify(pj, null, 2));
process.stdout.write("\n");
Expand Down

0 comments on commit c5e9191

Please sign in to comment.