Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JackHamer09 committed Sep 29, 2023
0 parents commit 614181d
Show file tree
Hide file tree
Showing 24 changed files with 12,948 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@matterlabs/eslint-config-typescript"]
}
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
10 changes: 10 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This CODEOWNERS file sets the individuals responsible for code in the era-test-node repository.

# These users are the default owners for everything in the repo.
# They will be requested for review when someone opens a pull request.
* @matter-labs/devxp

# You can also specify code owners for specific directories or files.
# For example:
# /src/ @developer1 @developer2
# /docs/ @documenter
76 changes: 76 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributing to zkSync Era CLI

## Welcome! 🎉

Hello, contributor! Thanks for thinking about helping with the `zkSync Era CLI` project. This guide will help you understand how to contribute to our CLI tool.

## Getting Started

- **Fork the project.** First, fork the `zkSync Era CLI` repository to your GitHub account.

- **Download the project.** Now, get the project on your computer:

```bash
git clone https://github.com/<your-github-username>/zksync-cli.git
```

- **Make a new branch.** Give your branch a simple name that tells what you're working on:

```bash
git checkout -b my-new-feature
```

## Making Changes

- **Write your code.** Keep your code clear and easy to understand. It helps everyone.

- **Test your code.** Make sure your code is covered with tests and all tests are passing:

```bash
npm run test
```

- **Build and check your code.** Before you ask others to look at your code, make sure it works well. You can use these commands:

```bash
npm run build
npx zksync-cli [command] # you should be in the root directory of the project
```

- **Save your changes.** Use easy-to-understand messages when saving your changes.

- **Send your changes.** Now, put your code back on your GitHub:

```bash
git push origin my-new-feature
```

## Sending a Pull Request

- **Ask to add your changes.** Go to the `zkSync Era CLI` repository on GitHub. You'll see a button "Compare & pull request." Click it and tell us about your changes.

- **Wait for feedback.** Our team will look at your changes. We might ask you to change some things.

Remember, we have a system that checks your code automatically when you ask to add your changes. Make sure you pass that check!

## Code Style

We have rules about how to write code. This helps everyone understand and trust the code. Use this command to make sure your code follows our rules:

```bash
npm run lint
```

## Questions?

If you have questions, you can ask on our [zkSync Community Hub](https://github.com/zkSync-Community-Hub/zkSync-developers/discussions). We're here to help!

## Thank You!

After we add your changes to the `zkSync Era CLI` project, we'll be very thankful! Your help makes our project better.

We hope you enjoy helping and come back to help more. Thanks for being part of our team!

---

*Last update: September 7, 2023*
45 changes: 45 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: Bug report
about: Use this template for reporting issues
title: ""
labels: bug
assignees: ''

---

### 🐛 Bug Report for Portal zkcli module
#### 📝 Description

Provide a clear and concise description of the bug.

#### 🔄 Reproduction Steps

1. Step 1
2. Step 2
3. ...

#### 🤔 Expected Behavior

Describe what you expected to happen.

#### 😯 Current Behavior

Describe what actually happened.

#### 🖥️ Environment

- **Package version**: [e.g., 1.2.1]
- **Node version**: [e.g., node v16.14.0]
- **NPM/Yarn version**: [e.g., npm 8.3.1]
- **Operating System & Version**: [e.g., Ubuntu 20.04]
- **Other relevant environment details**:

#### 📋 Additional Context

Add any other context about the problem here. If applicable, add screenshots to help explain.

#### 📎 Log Output

```
Paste any relevant log output here.
```
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: zksync-developers Discussion
url: https://github.com/zkSync-Community-Hub/zkync-developers/discussions
about: Please provide feedback, and ask questions here.
- name: zksync-cli documentation page
url: https://era.zksync.io/docs/tools/zksync-cli
about: Please refer to the documentation for immediate answers.
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Feature request
about: Use this template for requesting features
title: ""
labels: feat
assignees: ''

---

### 🌟 Feature Request

#### 📝 Description

Provide a clear and concise description of the feature you'd like to see.

#### 🤔 Rationale

Explain why this feature is important and how it benefits the project.

#### 🖼️ Mockups/Examples

If applicable, provide mockups or examples of how the feature would work.

#### 📋 Additional Context

Add any other context or information about the feature request here.
17 changes: 17 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# What :computer:
* First thing updated with this PR
* Second thing updated with this PR
* Third thing updated with this PR

# Why :hand:
* Reason why first thing was added to PR
* Reason why second thing was added to PR
* Reason why third thing was added to PR

# Evidence :camera:
Include screenshots, screen recordings, or `console` output here demonstrating that your changes work as intended

<!-- All sections below are optional. You can erase any section not applicable to your Pull Request. -->

# Notes :memo:
* Any notes/thoughts that the reviewers should know prior to reviewing the code?
24 changes: 24 additions & 0 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Pull Request Validation
on:
pull_request:

permissions:
checks: write
pull-requests: write

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint && npm run typecheck
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release
on:
push:
branches:
- main
- alpha
- beta
- '[0-9]+.*'

jobs:
release:
name: Release
runs-on: [self-hosted, ci-runner]
environment: production release
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies and build
run: npm ci && npm run build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }}
run: npx semantic-release
17 changes: 17 additions & 0 deletions .github/workflows/secrets_scanner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Leaked Secrets Scan
on: [pull_request]
jobs:
TruffleHog:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
fetch-depth: 0
- name: TruffleHog OSS
uses: trufflesecurity/trufflehog@0c66d30c1f4075cee1aada2e1ab46dabb1b0071a
with:
path: ./
base: ${{ github.event.repository.default_branch }}
head: HEAD
extra_args: --debug --only-verified
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Default
node_modules
.env

# Build
dist
5 changes: 5 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit
npm run commitlint
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
12 changes: 12 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Ignore everything
*

# Build
!dist/**/*
!Dockerfile
!docker-compose.yml

# Source
!package.json
!package-lock.json
!LICENSE-MIT
34 changes: 34 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"main",
"next",
"next-major",
{
"name": "beta",
"prerelease": true
},
{
"name": "alpha",
"prerelease": true
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@semantic-release/npm",
{
"npmPublish": true,
"tarballDir": "dist"
}
],
[
"@semantic-release/github",
{
"assets": "dist/*.tgz"
}
]
]
}
36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:latest
ARG VERSION
ARG NODE_TYPE

WORKDIR /app

# Update and install necessary packages
RUN apt-get update \
&& apt-get install -y curl jq unzip apache2 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN echo "Portal ${VERSION}: ${NODE_TYPE}"

# Download the release version specified by the build argument
RUN curl -s "https://api.github.com/repos/matter-labs/dapp-portal/releases/tags/${VERSION}" | \
jq -r --arg NODE_TYPE "$NODE_TYPE" '.assets[] | select(.name == "dist-node-"+$NODE_TYPE+".zip") | .browser_download_url' | \
head -n 1 | xargs -I {} curl -L -o dist.zip {}

# Unpack the zip archive
# The archive contains a single directory with the name of the release
# Move the contents of the directory to the Apache2 root directory
RUN mkdir -p /tmp/unzip-temp \
&& unzip dist.zip -d /tmp/unzip-temp/ \
&& FIRST_DIR=$(find /tmp/unzip-temp/ -mindepth 1 -maxdepth 1 -type d | head -n 1) \
&& mv $FIRST_DIR/* /var/www/html/ \
&& rm -rf /tmp/unzip-temp

# Configure Apache to serve on port 3000
RUN sed -i 's/Listen 80/Listen 3000/' /etc/apache2/ports.conf

# Expose the port 3000 for the service
EXPOSE 3000

# Start Apache2 in the foreground
CMD ["apachectl", "-D", "FOREGROUND"]
Loading

0 comments on commit 614181d

Please sign in to comment.