Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 28 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,34 @@ following table is a place holder:
| `//products/ceres` | zilliqa.com/apps | |
| `//products/neo-savant` | ide.zilliqa.com | |

#### Building and publishing `zilliqa-js`

To publish the `zilliqa-js` packages, you can use the provided Dockerfile to ensure a consistent build environment.

First, build the Docker image:

```sh
docker build -t zilliqa_js_publish -f build_and_publish.Dockerfile .
```

Then, run the container in interactive mode:

```sh
docker run --rm -it zilliqa_js_publish sh
```

Finally, from within the container's shell, publish the packages using `pnpm`. First run it with `--dry-run` to test publish without publishing anything.

```sh
pnpm publish --dry-run
```

If everything looks correct then run

```sh
pnpm publish
```

## Building

To disable our git queries on build, set the `DISABLE_WORKSPACE_STATUS`
Expand Down Expand Up @@ -118,36 +146,6 @@ which is served on port `80`.

#### Building libraries

#### Building and publishing `zilliqa-js`

Checkout out the repository. First ensure that tests are passing:

```sh
bazelisk test //zilliqa/js/...
```

Next navigate to the `zilliqa/js` folder. If you have not done so, install all
dependencies:

```sh
pnpm i
```

Then build all libraries:

```sh
pnpm -r build
```

Finally, publish:

```sh
pnpm -r publish
```

Add `--dry-run` in the event you want to test publish without publishing
anything.

#### Building and running Docker images

For the purpose of building Docker images, you do not need Docker installed
Expand Down
31 changes: 31 additions & 0 deletions build_and_publish.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Use the official Node.js 18 image as the base
FROM node:18

# Set the working directory inside the container
WORKDIR /app

# Install Python and build tools required for native dependencies
RUN apt-get update && apt-get install -y python3 build-essential

# Install pnpm version 8.x globally, which is compatible with lockfileVersion 6.0
RUN npm install -g pnpm@8

# Copy package.json and pnpm-lock.yaml to the working directory
COPY pnpm-lock.yaml .
COPY tsconfig.base.json .
COPY package.json .

# Generate the pnpm-workspace.yaml file with the specified content
RUN echo 'packages:\n - "zilliqa/js/account"\n - "zilliqa/js/blockchain"\n - "zilliqa/js/contract"\n - "zilliqa/js/core"\n - "zilliqa/js/crypto"\n - "zilliqa/js/proto"\n - "zilliqa/js/subscriptions"\n - "zilliqa/js/typings"\n - "zilliqa/js/util"\n - "zilliqa/js/zilliqa"' > pnpm-workspace.yaml

COPY zilliqa/js zilliqa/js/

# Install project dependencies.
RUN pnpm -r install --frozen-lockfile

# Build the project
ENV NODE_OPTIONS=--max-old-space-size=4096
RUN for pkg in zilliqa/js/typings zilliqa/js/core zilliqa/js/proto zilliqa/js/util zilliqa/js/crypto zilliqa/js/account zilliqa/js/blockchain zilliqa/js/contract zilliqa/js/subscriptions zilliqa/js/zilliqa; do echo "Building $pkg..."; pnpm --dir "$pkg" build; done

# See Readme > Building and publishing `zilliqa-js` for the complete publishing process.
CMD ["echo", "1"]
28 changes: 28 additions & 0 deletions zilliqa/js/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Dependencies
node_modules
/npm-debug.log
.npm

# Node.js specific
npm-debug.log*
yarn-error.log*

# Git ignore
.git
.gitignore

# OS generated files
.DS_Store
.vscode
.idea
.env

# Build artifacts
dist
build
*.log

# Test files
coverage
*.test.js
*.spec.js
Loading