forked from pact-foundation/pact-js-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create os/arch specific npm optional deps for pact_ffi lib
- Loading branch information
Showing
13 changed files
with
180 additions
and
51 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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# platform-arch specific packages | ||
@pact-foundation/* | ||
|
||
# Logs | ||
logs | ||
npm-debug.log | ||
|
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
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,78 @@ | ||
SHELL:=/bin/bash | ||
export bin=@pact-foundation/pact-core | ||
export pkg_version=$(shell cat package.json | jq -r .version) | ||
supported_platforms = "linux-x64" "linux-arm64" "darwin-x64" "darwin-arm64" "windows-x64" | ||
|
||
# https://github.com/npm/npm/issues/17722 | ||
# https://github.com/npm/cli/issues/4828 | ||
# https://github.com/orhun/packaging-rust-for-npm | ||
# https://blog.orhun.dev/packaging-rust-for-npm/ | ||
|
||
clean: | ||
rm -rf @pact-foundation | ||
npm run clean-libs | ||
libs: | ||
FETCH_ASSETS=true ./script/ci/check-release-libs.sh --fetch-assets -t v$(pkg_version) | ||
|
||
all: | ||
for supported_platform in $(supported_platforms); do \ | ||
IFS='-' read -r node_os node_arch <<< "$$supported_platform"; \ | ||
export node_os=$$node_os; \ | ||
export node_arch=$$node_arch; \ | ||
export node_pkg=$(bin)-$$node_os-$$node_arch; \ | ||
if [ "$$node_os" = "windows" ]; then \ | ||
export node_os="win32"; \ | ||
fi; \ | ||
export standalone_package=prebuilds/$$node_os-$$node_arch; \ | ||
echo "Building for $$node_os-$$node_arch"; \ | ||
echo "Building $$node_pkg"; \ | ||
mkdir -p "$$node_pkg/prebuilds"; \ | ||
mv "$$standalone_package" "$$node_pkg/prebuilds"; \ | ||
envsubst < package.json.tmpl > "$$node_pkg/package.json"; \ | ||
(cd $$node_pkg && npm publish --access public --dry-run;)\ | ||
done | ||
|
||
update_opt_deps: | ||
@for supported_platform in $(supported_platforms); do \ | ||
IFS='-' read -r node_os node_arch <<< "$$supported_platform"; \ | ||
export node_pkg=$(bin)-$$node_os-$$node_arch; \ | ||
jq '.optionalDependencies."'$$node_pkg'" = "$(pkg_version)"' package.json > package-new.json; \ | ||
mv package-new.json package.json; \ | ||
done | ||
|
||
dry_run: | ||
set -eu; for supported_platform in $(supported_platforms); do \ | ||
IFS='-' read -r node_os node_arch <<< "$$supported_platform"; \ | ||
export node_os=$$node_os; \ | ||
export node_pkg=$(bin)-$$node_os-$$node_arch; \ | ||
export node_arch=$$node_arch; \ | ||
if [ "$$node_os" = "windows" ]; then \ | ||
export node_os="win32"; \ | ||
fi; \ | ||
export standalone_package=prebuilds/$$node_os-$$node_arch; \ | ||
echo "Building $$node_pkg for $$node_os-$$node_arch (dry-run)"; \ | ||
(cd $$node_pkg && npm publish --access public --dry-run;)\ | ||
done | ||
publish: | ||
set -eu; for supported_platform in $(supported_platforms); do \ | ||
IFS='-' read -r node_os node_arch <<< "$$supported_platform"; \ | ||
export node_os=$$node_os; \ | ||
export node_arch=$$node_arch; \ | ||
export node_pkg=$(bin)-$$node_os-$$node_arch; \ | ||
if [ "$$node_os" = "windows" ]; then \ | ||
export node_os="win32"; \ | ||
fi; \ | ||
export standalone_package=prebuilds/$$node_os-$$node_arch; \ | ||
echo "Building for $$node_os-$$node_arch"; \ | ||
echo "Building $$node_pkg for $$node_os-$$node_arch"; \ | ||
(cd $$node_pkg && npm publish --access public;)\ | ||
done | ||
link: | ||
set -eu; for supported_platform in $(supported_platforms); do \ | ||
IFS='-' read -r node_os node_arch <<< "$$supported_platform"; \ | ||
export node_os=$$node_os; \ | ||
export node_arch=$$node_arch; \ | ||
export node_pkg=$(bin)-$$node_os-$$node_arch; \ | ||
(cd $$node_pkg && npm link || echo "cannot link for platform";);\ | ||
npm link $$node_pkg || echo "cannot link for platform";\ | ||
done |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
{ | ||
"name": "${node_pkg}", | ||
"version": "${pkg_version}", | ||
"description": "${node_os}-${node_arch} Platform specific Core of @pact-foundation/pact. You almost certainly don't want to depend on this directly.", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/pact-foundation/pact-js-cli.git" | ||
}, | ||
"scripts": {}, | ||
"author": "Yousaf Nabi <[email protected]>", | ||
"homepage": "https://github.com/pact-foundation/pact-js-cli#readme", | ||
"os": [ | ||
"${node_os}" | ||
], | ||
"cpu": [ | ||
"${node_arch}" | ||
] | ||
} |
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
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
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