Build js/ts projects #62

Merged
telackey merged 3 commits from dboreham/build-ts-repos into main 2022-12-12 21:42:14 +00:00
5 changed files with 46 additions and 2 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

@ -33,4 +33,12 @@ RUN \
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
# [Optional] Uncomment if you want to install more global node modules
# RUN su node -c "npm install -g <your-package-list-here>"
# RUN su node -c "npm install -g <your-package-list-here>"
COPY build-npm-package.sh .
COPY entrypoint.sh .
ENTRYPOINT ["./entrypoint.sh"]
# 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

View File

@ -0,0 +1,2 @@
#!/bin/sh
exec "$@"