Support building an npm package to gitea

This commit is contained in:
David Boreham 2022-12-12 14:40:11 -07:00
parent faa6027772
commit 46375082d6
4 changed files with 41 additions and 3 deletions

View File

@ -8,7 +8,8 @@ vulcanize/ipld-eth-db-validator
vulcanize/ipld-eth-beacon-indexer
vulcanize/ipld-eth-beacon-db
cerc-io/laconicd
cerc-io/laconic-cns-cli
cerc-io/laconic-sdk
cerc-io/laconic-registry-cli
cerc-io/mobymask-watcher
cerc-io/watcher-ts
vulcanize/assemblyscript

View File

@ -35,6 +35,10 @@ RUN \
# [Optional] Uncomment if you want to install more global node modules
# RUN su node -c "npm install -g <your-package-list-here>"
COPY entrypoint.sh entrypoint.sh
COPY build-npm-package.sh .
COPY entrypoint.sh .
ENTRYPOINT ["./entrypoint.sh"]
CMD node --version
# Placeholder CMD : generally this will be overridden at run time like :
# docker run -it -v /home/builder/cerc/laconic-sdk:/workspace cerc/builder-js sh -c 'cd /workspace && yarn && yarn build'
CMD node --version

View File

@ -0,0 +1,11 @@
## Building JS/TS Packages
As a temporary measure while the necessary functionality is being added to Stack Orchestrator,
it is possible to build packages manually by invoking `docker run` , for example as follows:
```
docker run -it --add-host host.docker.internal:host-gateway \
-v ${HOME}/cerc/laconic-sdk:/workspace cerc/builder-js \
sh -c 'cd /workspace && NPM_AUTH_TOKEN=6613572a28ebebaee20ccd90064251fa8c2b94f6 \
/build-npm-package.sh http://host.docker.internal:3000/api/packages/cerc-io/npm/ 1.2.3-test'
```

View File

@ -0,0 +1,22 @@
#!/bin/bash
# Usage: build-npm-package.sh <registry-url> <publish-with-this-version>
# Note: supply the registry auth token in NPM_AUTH_TOKEN
if [ -n "$CERC_ENABLE_SCRIPT_DEBUG" ]; then
set -x
fi
if [[ $# -ne 2 ]]; then
echo "Illegal number of parameters" >&2
exit 1
fi
if [[ -z "${NPM_AUTH_TOKEN}" ]]; then
echo "NPM_AUTH_TOKEN is not set" >&2
exit 1
fi
local_npm_registry_url=$1
package_publish_version=$2
npm config set @cerc-io:registry ${local_npm_registry_url}
npm config set -- ${local_npm_registry_url}:_authToken ${NPM_AUTH_TOKEN}
echo "Build and publish version ${package_publish_version}"
yarn install
yarn build
yarn publish --non-interactive --new-version ${package_publish_version} --no-git-tag-version