Support the @lirewine npm scope

Former-commit-id: 9e322203e9
This commit is contained in:
David Boreham 2023-03-24 02:30:04 -06:00
parent d96a6def14
commit 364a71d694
4 changed files with 19 additions and 16 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Usage: build-npm-package-local-dependencies.sh <registry-url> <publish-with-this-version> # Usage: build-npm-package-local-dependencies.sh <registry-url> <publish-with-this-version>
# Runs build-npm-package.sh after first fixing up yarn.lock to use a local # Runs build-npm-package.sh after first fixing up yarn.lock to use a local
# npm registry for all packages in a spcific scope (currently @cerc-io) # npm registry for all packages in a spcific scope (currently @cerc-io and @lirewine)
if [ -n "$CERC_SCRIPT_DEBUG" ]; then if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x set -x
fi fi
@ -17,18 +17,20 @@ fi
set -e set -e
local_npm_registry_url=$1 local_npm_registry_url=$1
package_publish_version=$2 package_publish_version=$2
# TODO: make this a paramater and allow a list of scopes # If we need to handle an additional scope, add it to the list below:
npm_scope_for_local="@cerc-io" npm_scopes_to_handle=("@cerc-io" "@lirewine")
# We need to configure the local registry for npm_scope_for_local in ${npm_scopes_to_handle[@]}; do
npm config set ${npm_scope_for_local}:registry ${local_npm_registry_url} # We need to configure the local registry
npm config set -- ${local_npm_registry_url}:_authToken ${CERC_NPM_AUTH_TOKEN} npm config set ${npm_scope_for_local}:registry ${local_npm_registry_url}
# Find the set of dependencies from the specified scope npm config set -- ${local_npm_registry_url}:_authToken ${CERC_NPM_AUTH_TOKEN}
mapfile -t dependencies_from_scope < <(cat package.json | jq -r '.dependencies | with_entries(if (.key|test("^'${npm_scope_for_local}'/.*$")) then ( {key: .key, value: .value } ) else empty end ) | keys[]') # Find the set of dependencies from the specified scope
echo "Fixing up dependencies" mapfile -t dependencies_from_scope < <(cat package.json | jq -r '.dependencies | with_entries(if (.key|test("^'${npm_scope_for_local}'/.*$")) then ( {key: .key, value: .value } ) else empty end ) | keys[]')
for package in "${dependencies_from_scope[@]}" echo "Fixing up dependencies"
do for package in "${dependencies_from_scope[@]}"
do
echo "Fixing up package ${package}" echo "Fixing up package ${package}"
yarn-local-registry-fixup.sh $package ${local_npm_registry_url} yarn-local-registry-fixup.sh $package ${local_npm_registry_url}
done
done done
echo "Running build" echo "Running build"
build-npm-package.sh ${local_npm_registry_url} ${package_publish_version} build-npm-package.sh ${local_npm_registry_url} ${package_publish_version}

View File

@ -22,8 +22,8 @@ set -e
# Get the name of this package from package.json since we weren't passed that # Get the name of this package from package.json since we weren't passed that
package_name=$( cat package.json | jq -r .name ) package_name=$( cat package.json | jq -r .name )
local_npm_registry_url=$1 local_npm_registry_url=$1
npm config set @lirewine:registry ${local_npm_registry_url}
npm config set @cerc-io:registry ${local_npm_registry_url} npm config set @cerc-io:registry ${local_npm_registry_url}
npm config set @lirewine:registry ${local_npm_registry_url}
npm config set -- ${local_npm_registry_url}:_authToken ${CERC_NPM_AUTH_TOKEN} npm config set -- ${local_npm_registry_url}:_authToken ${CERC_NPM_AUTH_TOKEN}
# First check if the version of this package we're trying to build already exists in the registry # First check if the version of this package we're trying to build already exists in the registry
package_exists=$( yarn info --json ${package_name}@${package_publish_version} 2>/dev/null | jq -r .data.dist.tarball ) package_exists=$( yarn info --json ${package_name}@${package_publish_version} 2>/dev/null | jq -r .data.dist.tarball )

View File

@ -40,8 +40,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# RUN su node -c "npm install -g <your-package-list-here>" # RUN su node -c "npm install -g <your-package-list-here>"
# Configure the local npm registry # Configure the local npm registry
RUN npm config set @lirewine:registry ${CERC_NPM_URL} \ RUN npm config set @cerc-io:registry ${CERC_NPM_URL} \
&& npm config set @cerc-io:registry ${CERC_NPM_URL} \
&& npm config set @lirewine:registry ${CERC_NPM_URL} \ && npm config set @lirewine:registry ${CERC_NPM_URL} \
&& npm config set -- ${CERC_NPM_URL}:_authToken ${CERC_NPM_AUTH_TOKEN} && npm config set -- ${CERC_NPM_URL}:_authToken ${CERC_NPM_AUTH_TOKEN}

View File

@ -3,3 +3,5 @@ laconic-sdk
debug debug
laconic-registry-cli laconic-registry-cli
gem gem
debug
crypto