Skip to content

Commit

Permalink
chore: initial launch script
Browse files Browse the repository at this point in the history
  • Loading branch information
jac18281828 committed Dec 6, 2024
1 parent e60ca34 commit 72e201a
Show file tree
Hide file tree
Showing 19 changed files with 928 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "Existing Dockerfile",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile"
},
"containerEnv": {
"PRIVATE_KEY": "${localEnv:PRIVATE_KEY}",
"PUBLIC_KEY": "${localEnv:PUBLIC_KEY}",
"RPC_URL": "${localEnv:RPC_URL}",
"OPG_URL": "${localEnv:OPG_URL}",
"OPS_URL": "${localEnv:OPS_URL}",
"ARS_URL": "${localEnv:ARS_URL}",
"HOLESKY_URL": "${localEnv:HOLESKY_URL}",
"ETHERSCAN_API_KEY": "${localEnv:ETHERSCAN_API_KEY}",
"ARBISCAN_API_KEY": "${localEnv:ARBISCAN_API_KEY}"
}
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: 'devcontainers'
directory: '/'
schedule:
interval: weekly
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --dev
env:
PATH: ${{ runner.workspace }}/.bun/bin:$PATH
- name: Run build with Bun
run: bun run build
env:
PATH: ${{ runner.workspace }}/.bun/bin:$PATH
20 changes: 20 additions & 0 deletions .github/workflows/commit-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: commitlint
on:
push:
pull_request:
workflow_dispatch:
jobs:
run-commitlint-on-pull-request:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Install dependencies
run: npm install -g @commitlint/{cli,config-conventional}
- name: Validate all commits from PR
run: npx commitlint --from HEAD~${{ github.event.pull_request.commits }} --to HEAD --verbose
24 changes: 24 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --dev
- name: Format check
run: bun run prettier:check
- name: Lint
run: bun run lint
22 changes: 22 additions & 0 deletions .github/workflows/yamlfmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Yamlfmt
on:
push:
pull_request:
workflow_dispatch:
jobs:
run-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.4
- name: Install yamlfmt
run: |
go install github.com/google/yamlfmt/cmd/yamlfmt@latest
strip $(which yamlfmt)
- name: Run yamlfmt
run: yamlfmt -lint .github/*.yml .github/workflows/*.yml
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.env
node_modules/
build/
dist/
output/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!*.ts
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 130,
"tabWidth": 2
}
58 changes: 58 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "install",
"type": "shell",
"command": "bun install --dev",
"group": {
"kind": "build",
"isDefault": false
}
},
{
"label": "fmt",
"type": "shell",
"command": "bun run prettier:check",
"group": {
"kind": "build",
"isDefault": false
},
"dependsOn": "install"
},
{
"label": "build",
"type": "shell",
"command": "bun run build",
"group": {
"kind": "build",
"isDefault": false
},
"dependsOn": "fmt"
},
{
"label": "lint",
"type": "shell",
"dependsOn": "build",
"command": "bun run lint",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "test",
"type": "shell",
"dependsOn": "lint",
"command": "bun run test",
"problemMatcher": [],
"group": {
"kind": "test",
"isDefault": true
}
}
]
}
62 changes: 62 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Stage 1: Build yamlfmt
FROM golang:1 AS go-builder
# defined from build kit
# DOCKER_BUILDKIT=1 docker build . -t ...
ARG TARGETARCH

# Install yamlfmt
WORKDIR /yamlfmt
RUN go install github.com/google/yamlfmt/cmd/yamlfmt@latest && \
strip $(which yamlfmt) && \
yamlfmt --version

FROM jac18281828/tsdev:latest

ENV DEBIAN_FRONTEND=noninteractive
RUN sudo apt-get update && \
sudo apt-get install -y -q --no-install-recommends \
unzip && \
sudo apt-get clean && \
sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ENV USER=tsdev
# Install Python 3.10
# fixes node-gyp error
RUN sudo apt-get update -y && sudo apt-get upgrade -y
RUN sudo apt-get remove python3 -y
RUN sudo apt-get autoremove -y
RUN sudo apt-get install -y wget \
build-essential \
checkinstall \
libncursesw5-dev \
libssl-dev \
libsqlite3-dev \
tk-dev \
libgdbm-dev \
libc6-dev \
libbz2-dev \
libffi-dev \
zlib1g-dev
RUN mkdir -p /usr/local/src
RUN sudo chown -R ${USER}:${USER} /usr/local/src
WORKDIR /usr/local/src
RUN wget https://www.python.org/ftp/python/3.10.9/Python-3.10.9.tgz
RUN tar xzf Python-3.10.9.tgz && rm Python-3.10.9.tgz
WORKDIR /usr/local/src/Python-3.10.9
RUN ./configure --enable-optimizations
RUN make -j
RUN sudo make install && sudo make clean

# Install yamlfmt
COPY --chown=${USER}:${USER} --from=go-builder /go/bin/yamlfmt /go/bin/yamlfmt

WORKDIR /workspaces/react_metamask
COPY --chown=tsdev:tsdev . .

USER tsdev
ADD --chown=${USER}:${USER} --chmod=555 https://bun.sh/install /bun/install.sh

RUN /bun/install.sh && \
sudo rm -rf /bun

ENV PATH="/home/tsdev/.bun/bin:/go/bin:${PATH}"
Binary file added bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const Configuration = { extends: ['@commitlint/config-conventional'] };
export default Configuration;
3 changes: 3 additions & 0 deletions env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PRIVATE_KEY=
RPC_URL=
PUBLIC_KEY=
12 changes: 12 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';

/** @type {import('eslint').Linter.Config[]} */
export default [
{ files: ['**/*.{js,mjs,cjs,ts}'] },
{ files: ['**/*.js'], languageOptions: { sourceType: 'commonjs' } },
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];
31 changes: 31 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "chicken_pools_cli",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"clean": "rm -rf build",
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint src/**/*.ts",
"prettier:fix": "prettier --write .",
"prettier:check": "prettier --check .",
"launch": "ts-node src/launch_eth.ts",
"build": "tsc",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"devDependencies": {
"@eslint/js": "^9.16.0",
"globals": "^15.13.0",
"typescript": "^5.7.2",
"typescript-eslint": "^8.17.0"
},
"dependencies": {
"dotenv": "^16.4.7",
"eslint": "^9.16.0",
"ethers": "^6.13.4",
"prettier": "^3.4.2",
"ts-node": "^10.9.2"
}
}
Loading

0 comments on commit 72e201a

Please sign in to comment.