diff --git a/app/build_npms.py b/app/build_npms.py index 4dbed550..f91fcf99 100644 --- a/app/build_npms.py +++ b/app/build_npms.py @@ -61,7 +61,7 @@ def command(ctx, include, exclude): repo_dir = package repo_full_path = os.path.join(dev_root_path, repo_dir) # TODO: make the npm registry url configurable. - build_command = ["sh", "-c", "cd /workspace && build-npm-package-local-dependencies.sh http://host.docker.internal:3000/api/packages/cerc-io/npm/ 1.0.16"] + build_command = ["sh", "-c", "cd /workspace && build-npm-package-local-dependencies.sh http://host.docker.internal:3000/api/packages/cerc-io/npm/"] if not dry_run: if verbose: print(f"Executing: {build_command}") @@ -70,7 +70,7 @@ def command(ctx, include, exclude): interactive=True, tty=True, user=f"{os.getuid()}:{os.getgid()}", - envs={"CERC_NPM_AUTH_TOKEN": os.environ["CERC_NPM_AUTH_TOKEN"]}, + envs={"CERC_NPM_AUTH_TOKEN": os.environ["CERC_NPM_AUTH_TOKEN"], "CERC_SCRIPT_DEBUG": "true"}, add_hosts=[("host.docker.internal", "host-gateway")], volumes=[(repo_full_path, "/workspace")], command=build_command diff --git a/container-build/cerc-builder-js/build-npm-package-local-dependencies.sh b/container-build/cerc-builder-js/build-npm-package-local-dependencies.sh index 6449bb87..2824e008 100755 --- a/container-build/cerc-builder-js/build-npm-package-local-dependencies.sh +++ b/container-build/cerc-builder-js/build-npm-package-local-dependencies.sh @@ -5,7 +5,7 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi -if [[ $# -ne 2 ]]; then +if ! [[ $# -eq 1 || $# -eq 2 ]]; then echo "Illegal number of parameters" >&2 exit 1 fi diff --git a/container-build/cerc-builder-js/build-npm-package.sh b/container-build/cerc-builder-js/build-npm-package.sh index 88cc974b..c0b8f5dd 100755 --- a/container-build/cerc-builder-js/build-npm-package.sh +++ b/container-build/cerc-builder-js/build-npm-package.sh @@ -4,7 +4,7 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi -if [[ $# -ne 2 ]]; then +if ! [[ $# -eq 1 || $# -eq 2 ]]; then echo "Illegal number of parameters" >&2 exit 1 fi @@ -12,8 +12,12 @@ if [[ -z "${CERC_NPM_AUTH_TOKEN}" ]]; then echo "CERC_NPM_AUTH_TOKEN is not set" >&2 exit 1 fi +if [[ $# -eq 2 ]]; then + package_publish_version=$2 +else + package_publish_version=$( cat package.json | jq -r .version ) +fi local_npm_registry_url=$1 -package_publish_version=$2 npm config set @lirewine:registry ${local_npm_registry_url} npm config set @cerc-io:registry ${local_npm_registry_url} npm config set -- ${local_npm_registry_url}:_authToken ${CERC_NPM_AUTH_TOKEN}