Skip to content

feat: new deploy script command#194

Closed
epsjunior wants to merge 51 commits intomainfrom
193-implement-deploy-scripts-command
Closed

feat: new deploy script command#194
epsjunior wants to merge 51 commits intomainfrom
193-implement-deploy-scripts-command

Conversation

@epsjunior
Copy link
Copy Markdown
Contributor

@epsjunior epsjunior commented Feb 27, 2025

Fixes

#193

Brief Overview

  • Enhanced Deploy Action to use spinners and logs.
  • Implemented a deploy (scripts) command inspired by Hardhat’s deploy system.
  • Improved developer experience by injecting genlayerClient and keypair.
  • Automated TypeScript transpilation for deploy scripts, removing the need for explicit imports.

Description

🔹 Problem Solved

  • Previously, initializeConsensusSmartContract was not awaited, leading to potential race conditions.
  • Deploying multiple contracts required manual handling of script execution.
  • Developers had to manually instantiate genlayerClient and manage keypairs in scripts.
  • In Hardhat, deploy scripts require a main function, but we wanted a more flexible and modern approach.

🔹 Changes Made

  • Extended BaseAction: Standardized spinner and logging behavior.
  • Fixed initializeConsensusSmartContract bug: Ensured it is awaited before proceeding.
  • Added deploy (scripts) command:
    • Supports multiple deploy scripts within a deploy folder.
    • Sorting behavior: Numeric scripts run first, followed by alphanumeric scripts.
    • Injects genlayerClient and the keypair from keyPairPath (CLI global config).
    • Automates TypeScript transpilation: Users also don’t need to import genlayer client when using Typescript (Hardhat users need to import hre when using typescript).
    • Unlike Hardhat, scripts must export a default function, which is executed automatically.
    • The new command accepts JS and TS scripts

🔹 Important Decisions

  • The script execution follows Hardhat-style sorting (numeric first, then alphanumeric).
  • Scripts must export a default function, rather than defining a main function like in Hardhat.
  • Automated transpilation eliminates the need for explicit imports of genlayer client.

🔹 Previously Aligned Architecture Changes

  • No architecture changes, but aligns with best practices from Hardhat.

Dependencies

  • "esbuild": ">=0.25.0"
    

Checklist

Extra Links

cristiam86 and others added 30 commits July 3, 2024 09:30
* test: setup jest configuration with typescript

* refactor: removed path alias and changed simulator service toa class injected in the command declaration

* test: added init action adn command tests

* docs: added testing section on readme file

* fix: handle Fetch Error (Mac M3)

* refactor: improved function response

* fix: await for runSimulator async function

* fix: added init action test

* fix: solving conflicts

* test: added reset docker images and containers calls from init
…erwritten (#38)

* feat: added initial warning about reseting the setup

* test: added a test for new step introduced
* feat: added initial warning about reseting the setup

* test: added a test for new step introduced

* feat: added optional branch when fetching the simulator from github

* feat: added branch name on init and up commands

* test: added tests for branch option on init command
* chore: added npm command for beta release

* ci: added github action for beta release
* fix: removed non existing simulator endpoint

* refactor: adapted ping simulator response for current and next version

* tests: removed non existing simulator endpoint test
* fix: removed non existing simulator endpoint

* refactor: adapted ping simulator response for current and next version

* tests: removed non existing simulator endpoint test
* add node and docker version checks

* remove redundant check

* set correct version numbers, add todo

* use config constant for versions

* refactor methods and improve error handling

* implement PR comments: split install and version checks in two separate checks, move checkVersion method to simulator service

* add tests for version checks on init command

* flip version issue evalution

* separate checks in two steps

* remove console log

---------

Co-authored-by: Den <den@Deniss-MacBook-Pro.local>
@epsjunior epsjunior changed the title 193 implement deploy scripts command feat: implement deploy scripts command Feb 27, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (45956f6) to head (8d7f045).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #194   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        27           
  Lines         1386      1465   +79     
  Branches       346       365   +19     
=========================================
+ Hits          1386      1465   +79     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@epsjunior epsjunior changed the title feat: implement deploy scripts command feat: Extend BaseAction for Spinner & Logs, Fix initializeConsensusSmartContract Bug, and Add Deploy Scripts Command Feb 27, 2025
@epsjunior epsjunior changed the title feat: Extend BaseAction for Spinner & Logs, Fix initializeConsensusSmartContract Bug, and Add Deploy Scripts Command feat: new deploy script command Feb 27, 2025
@epsjunior epsjunior requested a review from cristiam86 February 27, 2025 04:23
@epsjunior epsjunior requested review from cristiam86 and removed request for cristiam86 April 3, 2025 22:00
@cristiam86
Copy link
Copy Markdown
Contributor

Closing this one since it was merged on previous PR

@cristiam86 cristiam86 closed this Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants