From ba50e1626316166fffce683ed3931bb958aba5fc Mon Sep 17 00:00:00 2001 From: Jack Hamer Date: Mon, 9 Oct 2023 22:35:00 +0300 Subject: [PATCH 01/15] feat: new utils, improved dev manage commands --- src/commands/dev/clean.ts | 22 +++++++++++++++++++--- src/commands/dev/modules/Module.ts | 3 +++ src/commands/dev/restart.ts | 9 ++++++--- src/commands/dev/start.ts | 3 ++- src/commands/dev/stop.ts | 22 +++++++++++++++++++--- src/utils/files.ts | 7 +++++++ src/utils/git.ts | 20 ++++++++++++++++++++ 7 files changed, 76 insertions(+), 10 deletions(-) diff --git a/src/commands/dev/clean.ts b/src/commands/dev/clean.ts index 8cee763a..267d47b4 100644 --- a/src/commands/dev/clean.ts +++ b/src/commands/dev/clean.ts @@ -19,9 +19,22 @@ export const cleanModule = async (module: Module) => { } }; -export const handler = async () => { +export const handler = async (modulePackageNames?: string[]) => { try { - const modules = await configHandler.getConfigModules(); + const modules = []; + if (modulePackageNames) { + const allModules = await configHandler.getAllModules(); + for (const moduleName of modulePackageNames) { + const module = allModules.find((m) => m.package.name === moduleName); + if (!module) { + throw new Error(`Module "${moduleName}" not found`); + } + modules.push(module); + } + } else { + const configModules = await configHandler.getConfigModules(); + modules.push(...configModules); + } Logger.info(`Cleaning: ${modules.map((module) => module.name).join(", ")}...`); await Promise.all(modules.map((module) => cleanModule(module))); } catch (error) { @@ -31,4 +44,7 @@ export const handler = async () => { } }; -Program.command("clean").description("Clean data for all config modules").action(handler); +Program.command("clean") + .description("Clean data for all config modules") + .argument("[module...]", "NPM package names of the modules to clean") + .action(handler); diff --git a/src/commands/dev/modules/Module.ts b/src/commands/dev/modules/Module.ts index c825d1ef..ce30616f 100644 --- a/src/commands/dev/modules/Module.ts +++ b/src/commands/dev/modules/Module.ts @@ -44,6 +44,9 @@ abstract class Module { abstract install(): Promise; abstract isRunning(): Promise; + get startAfterNode(): boolean { + return false; + } abstract start(): Promise; getStartupInfo(): LogEntry[] | Promise { return []; diff --git a/src/commands/dev/restart.ts b/src/commands/dev/restart.ts index 57f8b347..7bc8ffdb 100644 --- a/src/commands/dev/restart.ts +++ b/src/commands/dev/restart.ts @@ -4,9 +4,9 @@ import { handler as stop } from "./stop.js"; import { track } from "../../utils/analytics.js"; import Logger from "../../utils/logger.js"; -export const handler = async () => { +export const handler = async (modulePackageNames?: string[]) => { try { - await stop(); + await stop(modulePackageNames); await start(); } catch (error) { Logger.error("There was an error while restarting the testing environment:"); @@ -15,4 +15,7 @@ export const handler = async () => { } }; -Program.command("restart").description("Restart local zkSync environment and modules").action(handler); +Program.command("restart") + .description("Restart local zkSync environment and modules") + .argument("[module...]", "NPM package names of the modules to restart") + .action(handler); diff --git a/src/commands/dev/start.ts b/src/commands/dev/start.ts index 2eefccf4..59511e3a 100644 --- a/src/commands/dev/start.ts +++ b/src/commands/dev/start.ts @@ -24,7 +24,8 @@ const installModules = async (modules: Module[]) => { const startModules = async (modules: Module[]) => { Logger.info(`\nStarting: ${modules.map((m) => m.name).join(", ")}...`); - await Promise.all(modules.map((m) => m.start())); + await Promise.all(modules.filter((e) => !e.startAfterNode).map((m) => m.start())); + await Promise.all(modules.filter((e) => e.startAfterNode).map((m) => m.start())); }; const stopOtherNodes = async (currentModules: Module[]) => { diff --git a/src/commands/dev/stop.ts b/src/commands/dev/stop.ts index a946fbc4..a3969aec 100644 --- a/src/commands/dev/stop.ts +++ b/src/commands/dev/stop.ts @@ -3,9 +3,22 @@ import configHandler from "./ConfigHandler.js"; import { track } from "../../utils/analytics.js"; import Logger from "../../utils/logger.js"; -export const handler = async () => { +export const handler = async (modulePackageNames?: string[]) => { try { - const modules = await configHandler.getConfigModules(); + const modules = []; + if (modulePackageNames) { + const allModules = await configHandler.getAllModules(); + for (const moduleName of modulePackageNames) { + const module = allModules.find((m) => m.package.name === moduleName); + if (!module) { + throw new Error(`Module "${moduleName}" not found`); + } + modules.push(module); + } + } else { + const configModules = await configHandler.getConfigModules(); + modules.push(...configModules); + } Logger.info(`Stopping: ${modules.map((m) => m.name).join(", ")}...`); await Promise.all(modules.map((m) => m.isInstalled().then((installed) => (installed ? m.stop() : undefined)))); } catch (error) { @@ -15,4 +28,7 @@ export const handler = async () => { } }; -Program.command("stop").description("Stop local zkSync environment and modules").action(handler); +Program.command("stop") + .description("Stop local zkSync environment and modules") + .argument("[module...]", "NPM package names of the modules to stop") + .action(handler); diff --git a/src/utils/files.ts b/src/utils/files.ts index 699d564d..3ede6365 100644 --- a/src/utils/files.ts +++ b/src/utils/files.ts @@ -34,3 +34,10 @@ export const writeFile = (filePath: string, data: string | NodeJS.ArrayBufferVie // Then write file fs.writeFileSync(filePath, data, "utf-8"); }; + +export const createSymlink = (targetPath: string, linkPath: string, type: "file" | "dir" | "junction" = "file") => { + if (fileOrDirExists(linkPath)) { + throw new Error(`${type} already exists at ${linkPath}`); + } + fs.symlinkSync(targetPath, linkPath, type); +}; diff --git a/src/utils/git.ts b/src/utils/git.ts index 818a8b67..51718ced 100644 --- a/src/utils/git.ts +++ b/src/utils/git.ts @@ -26,3 +26,23 @@ export const cloneRepo = async (repoUrl: string, destination: string) => { Logger.debug(`Cloning ${repoUrl} repository to ${destination}`); await executeCommand(command); }; + +export const getLatestReleaseVersion = async (repo: string): Promise => { + const apiUrl = `https://api.github.com/repos/${repo}/releases/latest`; + try { + const response = await fetch(apiUrl); + if (!response.ok) { + throw new Error(`GitHub API request failed with status: ${response.status}`); + } + const releaseInfo = await response.json(); + if (typeof releaseInfo?.tag_name !== "string") { + throw new Error(`Failed to parse the latest release version: ${JSON.stringify(releaseInfo)}`); + } + return releaseInfo.tag_name; + } catch (error) { + if (error instanceof Error) { + throw new Error(`Failed to fetch the latest release version: ${error.message}`); + } + throw error; + } +}; From d750ab1381e2316d77987df9e17c54b166d131d9 Mon Sep 17 00:00:00 2001 From: Jack Hamer Date: Mon, 9 Oct 2023 23:02:58 +0300 Subject: [PATCH 02/15] fix: stop and restart commands --- src/commands/dev/clean.ts | 4 ++-- src/commands/dev/restart.ts | 2 +- src/commands/dev/stop.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands/dev/clean.ts b/src/commands/dev/clean.ts index 267d47b4..d23d6087 100644 --- a/src/commands/dev/clean.ts +++ b/src/commands/dev/clean.ts @@ -19,10 +19,10 @@ export const cleanModule = async (module: Module) => { } }; -export const handler = async (modulePackageNames?: string[]) => { +export const handler = async (modulePackageNames: string[]) => { try { const modules = []; - if (modulePackageNames) { + if (modulePackageNames.length) { const allModules = await configHandler.getAllModules(); for (const moduleName of modulePackageNames) { const module = allModules.find((m) => m.package.name === moduleName); diff --git a/src/commands/dev/restart.ts b/src/commands/dev/restart.ts index 7bc8ffdb..8e0ea906 100644 --- a/src/commands/dev/restart.ts +++ b/src/commands/dev/restart.ts @@ -4,7 +4,7 @@ import { handler as stop } from "./stop.js"; import { track } from "../../utils/analytics.js"; import Logger from "../../utils/logger.js"; -export const handler = async (modulePackageNames?: string[]) => { +export const handler = async (modulePackageNames: string[]) => { try { await stop(modulePackageNames); await start(); diff --git a/src/commands/dev/stop.ts b/src/commands/dev/stop.ts index a3969aec..116df864 100644 --- a/src/commands/dev/stop.ts +++ b/src/commands/dev/stop.ts @@ -3,10 +3,10 @@ import configHandler from "./ConfigHandler.js"; import { track } from "../../utils/analytics.js"; import Logger from "../../utils/logger.js"; -export const handler = async (modulePackageNames?: string[]) => { +export const handler = async (modulePackageNames: string[]) => { try { const modules = []; - if (modulePackageNames) { + if (modulePackageNames.length) { const allModules = await configHandler.getAllModules(); for (const moduleName of modulePackageNames) { const module = allModules.find((m) => m.package.name === moduleName); From 614d6c2453c5ba1e0decc54ce1248440488c026e Mon Sep 17 00:00:00 2001 From: Jack Hamer Date: Tue, 10 Oct 2023 18:23:25 +0300 Subject: [PATCH 03/15] fix: npm commands on windows --- src/utils/helpers.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index 07d5bf2a..620d4f15 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -37,7 +37,10 @@ export const executeCommand = (command: string, options: ExecuteOptions = {}): P return new Promise((resolve, reject) => { const [cmd, ...args] = command.split(" "); - const child = spawn(cmd, args, { stdio: options.silent ? "pipe" : "inherit", cwd: options.cwd }); + const child = spawn(cmd === "npm" ? (/^win/.test(process.platform) ? "npm.cmd" : "npm") : cmd, args, { + stdio: options.silent ? "pipe" : "inherit", + cwd: options.cwd, + }); let output = ""; let errorOutput = ""; From 8d811586fe99513323a407f210519e1db4f474c8 Mon Sep 17 00:00:00 2001 From: Jack Hamer Date: Wed, 11 Oct 2023 13:45:18 +0300 Subject: [PATCH 04/15] fix: create modules path before running npm commands --- src/commands/dev/install.ts | 6 ++++-- src/commands/dev/modules/Module.ts | 7 +++++++ src/commands/dev/uninstall.ts | 4 +++- src/commands/dev/update.ts | 4 +++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/commands/dev/install.ts b/src/commands/dev/install.ts index a632fb16..54696f77 100644 --- a/src/commands/dev/install.ts +++ b/src/commands/dev/install.ts @@ -2,7 +2,7 @@ import chalk from "chalk"; import { Option } from "commander"; import Program from "./command.js"; -import { modulesPath } from "./modules/Module.js"; +import { createModulesFolder, modulesPath } from "./modules/Module.js"; import { track } from "../../utils/analytics.js"; import { executeCommand } from "../../utils/helpers.js"; import Logger from "../../utils/logger.js"; @@ -11,13 +11,15 @@ const linkOption = new Option("--link", "Use `npm link` instead of `npm install` export const handler = async (moduleNames: string[], options: { link: boolean }) => { try { + createModulesFolder(); + const command = options.link ? "npm link" : "npm install"; const fullCommand = `${command}${moduleNames.length ? ` ${moduleNames.join(" ")}` : ""}`; await executeCommand(fullCommand, { cwd: modulesPath }); if (moduleNames.length) { Logger.info( - `Add module${moduleNames.length > 1 ? "s" : ""} to your configuration with \`${chalk.magentaBright( + `\nAdd module${moduleNames.length > 1 ? "s" : ""} to your configuration with \`${chalk.magentaBright( "zksync-cli dev config" )}\`` ); diff --git a/src/commands/dev/modules/Module.ts b/src/commands/dev/modules/Module.ts index ce30616f..a6c4edf7 100644 --- a/src/commands/dev/modules/Module.ts +++ b/src/commands/dev/modules/Module.ts @@ -22,6 +22,13 @@ export type DefaultModuleFields = { export const modulesPath = getLocalPath("modules"); +export const createModulesFolder = () => { + if (fileOrDirExists(modulesPath)) { + return; + } + fs.mkdirSync(modulesPath, { recursive: true }); +}; + type ModuleConfigDefault = Record; abstract class Module { configHandler: ConfigHandler; diff --git a/src/commands/dev/uninstall.ts b/src/commands/dev/uninstall.ts index 8068b56d..8b74ab7f 100644 --- a/src/commands/dev/uninstall.ts +++ b/src/commands/dev/uninstall.ts @@ -3,7 +3,7 @@ import { Option } from "commander"; import { cleanModule } from "./clean.js"; import Program from "./command.js"; import configHandler from "./ConfigHandler.js"; -import { modulesPath } from "./modules/Module.js"; +import { createModulesFolder, modulesPath } from "./modules/Module.js"; import { findDefaultModules } from "./modules/utils/packages.js"; import { track } from "../../utils/analytics.js"; import { executeCommand } from "../../utils/helpers.js"; @@ -27,6 +27,8 @@ export const handler = async (moduleNames: string[], options: { unlink: boolean const modules = await configHandler.getAllModules(); await Promise.all(modules.filter((e) => moduleNames.includes(e.package.name)).map((module) => cleanModule(module))); + createModulesFolder(); + const command = options.unlink ? "npm unlink" : "npm uninstall"; const fullCommand = `${command}${moduleNames.length ? ` ${moduleNames.join(" ")}` : ""}`; diff --git a/src/commands/dev/update.ts b/src/commands/dev/update.ts index 5f997b8b..9a178259 100644 --- a/src/commands/dev/update.ts +++ b/src/commands/dev/update.ts @@ -3,7 +3,7 @@ import { Option } from "commander"; import Program from "./command.js"; import configHandler from "./ConfigHandler.js"; -import { modulesPath } from "./modules/Module.js"; +import { createModulesFolder, modulesPath } from "./modules/Module.js"; import { track } from "../../utils/analytics.js"; import { executeCommand } from "../../utils/helpers.js"; import Logger from "../../utils/logger.js"; @@ -19,6 +19,8 @@ type ModuleUpdateOptions = { export const handler = async (moduleNames: string[], options: ModuleUpdateOptions = {}) => { try { if (options.package) { + createModulesFolder(); + Logger.info(`Updating NPM packages: ${moduleNames.join(", ")}`); const fullCommand = `npm update${moduleNames.length ? ` ${moduleNames.join(" ")}` : ""}`; From 4bd9de0eb7c74f13e494669476144d9bb04be927 Mon Sep 17 00:00:00 2001 From: Jack Hamer Date: Fri, 13 Oct 2023 16:22:52 +0300 Subject: [PATCH 05/15] fix: add block explorer as default module --- README.md | 2 +- package-lock.json | 112 +++++++++++++++++++++ package.json | 1 + src/commands/dev/modules/utils/packages.ts | 6 ++ 4 files changed, 120 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ac8f8bb..2cd6999c 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Or you can install the CLI globally with `npm i -g zksync-cli` and run the comma ## 💻 Commands ### Local development commands -`zksync-cli dev` - Manage local zkSync development environment. It allows to easily start zkSync stack locally, for example: local Ethereum and zkSync nodes, Wallet and Bridge. +`zksync-cli dev` - Manage local zkSync development environment. It allows to easily start zkSync stack locally, for example: local Ethereum and zkSync nodes, Block Explorer, Wallet and Bridge. **General:** - `zksync-cli dev start` - start local development environment (will ask to configure if starting for the first time) diff --git a/package-lock.json b/package-lock.json index 206f98eb..55ae30e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "node-machine-id": "^1.1.12", "ofetch": "^1.3.3", "winston": "^3.10.0", + "zkcli-block-explorer": "^1.0.0", "zkcli-dockerized-node": "^1.0.2", "zkcli-in-memory-node": "^1.0.3", "zkcli-portal": "^1.0.1", @@ -12200,6 +12201,67 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/zkcli-block-explorer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.0.tgz", + "integrity": "sha512-DgWUTn/zrtQ/MIZdbbmmy83POQbZ0EhHGV00Yqh4vrwsTlkMjtaduWDu5FWZGH5q+L2sDb41rHadGgls7iaePg==", + "dependencies": { + "chalk": "^5.3.0", + "zksync-cli": "^0.7.0-alpha.4" + } + }, + "node_modules/zkcli-block-explorer/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/zkcli-block-explorer/node_modules/zksync-cli": { + "version": "0.7.0-alpha.4", + "resolved": "https://registry.npmjs.org/zksync-cli/-/zksync-cli-0.7.0-alpha.4.tgz", + "integrity": "sha512-hYJpPniAXhagJzGdrLaKZS8/BUsT0yp4vA/zNUUix3wk/bj1m4roRHzz8AFO2Rm+SyLWF0FdAEv/81EAJt/AZw==", + "dependencies": { + "@rudderstack/rudder-sdk-node": "^2.0.5", + "chalk": "4.1.2", + "commander": "^11.0.0", + "compare-versions": "^6.1.0", + "cross-env": "^7.0.3", + "dotenv": "^16.3.1", + "eslint-import-resolver-typescript": "^3.6.1", + "ethers": "5.7.2", + "inquirer": "^8.1.4", + "node-machine-id": "^1.1.12", + "ofetch": "^1.3.3", + "winston": "^3.10.0", + "zkcli-dockerized-node": "^1.0.2", + "zkcli-in-memory-node": "^1.0.3", + "zkcli-portal": "^1.0.1", + "zksync-web3": "^0.14.4" + }, + "bin": { + "zksync-cli": "bin/index.js" + } + }, + "node_modules/zkcli-block-explorer/node_modules/zksync-cli/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/zkcli-dockerized-node": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/zkcli-dockerized-node/-/zkcli-dockerized-node-1.0.2.tgz", @@ -21046,6 +21108,56 @@ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" }, + "zkcli-block-explorer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.0.tgz", + "integrity": "sha512-DgWUTn/zrtQ/MIZdbbmmy83POQbZ0EhHGV00Yqh4vrwsTlkMjtaduWDu5FWZGH5q+L2sDb41rHadGgls7iaePg==", + "requires": { + "chalk": "^5.3.0", + "zksync-cli": "^0.7.0-alpha.4" + }, + "dependencies": { + "chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==" + }, + "zksync-cli": { + "version": "0.7.0-alpha.4", + "resolved": "https://registry.npmjs.org/zksync-cli/-/zksync-cli-0.7.0-alpha.4.tgz", + "integrity": "sha512-hYJpPniAXhagJzGdrLaKZS8/BUsT0yp4vA/zNUUix3wk/bj1m4roRHzz8AFO2Rm+SyLWF0FdAEv/81EAJt/AZw==", + "requires": { + "@rudderstack/rudder-sdk-node": "^2.0.5", + "chalk": "4.1.2", + "commander": "^11.0.0", + "compare-versions": "^6.1.0", + "cross-env": "^7.0.3", + "dotenv": "^16.3.1", + "eslint-import-resolver-typescript": "^3.6.1", + "ethers": "5.7.2", + "inquirer": "^8.1.4", + "node-machine-id": "^1.1.12", + "ofetch": "^1.3.3", + "winston": "^3.10.0", + "zkcli-dockerized-node": "^1.0.2", + "zkcli-in-memory-node": "^1.0.3", + "zkcli-portal": "^1.0.1", + "zksync-web3": "^0.14.4" + }, + "dependencies": { + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + } + } + } + } + }, "zkcli-dockerized-node": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/zkcli-dockerized-node/-/zkcli-dockerized-node-1.0.2.tgz", diff --git a/package.json b/package.json index e701a914..ba00af31 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "node-machine-id": "^1.1.12", "ofetch": "^1.3.3", "winston": "^3.10.0", + "zkcli-block-explorer": "^1.0.0", "zkcli-dockerized-node": "^1.0.2", "zkcli-in-memory-node": "^1.0.3", "zkcli-portal": "^1.0.1", diff --git a/src/commands/dev/modules/utils/packages.ts b/src/commands/dev/modules/utils/packages.ts index b99bb994..334014e5 100644 --- a/src/commands/dev/modules/utils/packages.ts +++ b/src/commands/dev/modules/utils/packages.ts @@ -101,6 +101,7 @@ export const findDefaultModules = async (): Promise => { const packages = { "zkcli-in-memory-node": require("zkcli-in-memory-node/package.json") as PackageJSON, "zkcli-dockerized-node": require("zkcli-dockerized-node/package.json") as PackageJSON, + "zkcli-block-explorer": require("zkcli-block-explorer/package.json") as PackageJSON, "zkcli-portal": require("zkcli-portal/package.json") as PackageJSON, } as const; @@ -115,6 +116,11 @@ export const findDefaultModules = async (): Promise => { name: packages["zkcli-dockerized-node"].name, version: packages["zkcli-dockerized-node"].version, }, + { + module: ModulePortal as unknown as Module, + name: packages["zkcli-block-explorer"].name, + version: packages["zkcli-block-explorer"].version, + }, { module: ModulePortal as unknown as Module, name: packages["zkcli-portal"].name, From 97e2d77e7b7d2227d9ca11775f0ab8562ac1151f Mon Sep 17 00:00:00 2001 From: Jack Hamer Date: Fri, 13 Oct 2023 16:27:19 +0300 Subject: [PATCH 06/15] fix: add block explorer as default module --- src/commands/dev/modules/utils/packages.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/dev/modules/utils/packages.ts b/src/commands/dev/modules/utils/packages.ts index 334014e5..1a9182cf 100644 --- a/src/commands/dev/modules/utils/packages.ts +++ b/src/commands/dev/modules/utils/packages.ts @@ -1,6 +1,7 @@ import fs from "fs"; import { createRequire } from "module"; import path from "path"; +import ModuleBlockExplorer from "zkcli-block-explorer"; import ModuleDockerizedNode from "zkcli-dockerized-node"; import ModuleInMemoryNode from "zkcli-in-memory-node"; import ModulePortal from "zkcli-portal"; @@ -117,7 +118,7 @@ export const findDefaultModules = async (): Promise => { version: packages["zkcli-dockerized-node"].version, }, { - module: ModulePortal as unknown as Module, + module: ModuleBlockExplorer as unknown as Module, name: packages["zkcli-block-explorer"].name, version: packages["zkcli-block-explorer"].version, }, From 6e7a627d1ed42a1573aa30e3a89b535e2d4ed660 Mon Sep 17 00:00:00 2001 From: Jack Hamer Date: Fri, 13 Oct 2023 17:48:05 +0300 Subject: [PATCH 07/15] fix: update dockerized node --- package-lock.json | 95 ++++++++++++++++++++++++++++++++++++++++++----- package.json | 2 +- 2 files changed, 87 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index ee65e221..dc6ef285 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "inquirer": "^8.1.4", "winston": "^3.10.0", "zkcli-block-explorer": "^1.0.0", - "zkcli-dockerized-node": "^1.0.2", + "zkcli-dockerized-node": "^1.0.3", "zkcli-in-memory-node": "^1.0.3", "zkcli-portal": "^1.0.1", "zksync-web3": "^0.14.4" @@ -12259,12 +12259,12 @@ } }, "node_modules/zkcli-dockerized-node": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/zkcli-dockerized-node/-/zkcli-dockerized-node-1.0.2.tgz", - "integrity": "sha512-bC4a7QmmqzvKNCtGwBxD6l2n+fkv+NEi9oGwtXTS9bdVp/1N7m855LgVeSNBQoDd/OefpdWIzNG0enbTQ8xa+Q==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/zkcli-dockerized-node/-/zkcli-dockerized-node-1.0.3.tgz", + "integrity": "sha512-ZWlGoeeNF2tKHyHxmZwROGeO/riTXpAvT+VeDvMfMglBjcZgW5VkAoHjcyuiZxVA8Na/QmWxsA+CgdjzcGzsLg==", "dependencies": { "chalk": "^5.3.0", - "zksync-cli": "^0.6.0-alpha.19" + "zksync-cli": "^0.7.0-alpha.4" } }, "node_modules/zkcli-dockerized-node/node_modules/chalk": { @@ -12278,6 +12278,48 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/zkcli-dockerized-node/node_modules/zksync-cli": { + "version": "0.7.0-alpha.6", + "resolved": "https://registry.npmjs.org/zksync-cli/-/zksync-cli-0.7.0-alpha.6.tgz", + "integrity": "sha512-8RWxJwe3bYgoskL+xFMK/krEaHNy4dirAj7Xax/TNXuS3Wcv/3mFVjXUVv3M1bqlX6BsUkece5dMZTd23wrA+A==", + "dependencies": { + "@rudderstack/rudder-sdk-node": "^2.0.5", + "chalk": "4.1.2", + "commander": "^11.0.0", + "compare-versions": "^6.1.0", + "cross-env": "^7.0.3", + "dotenv": "^16.3.1", + "eslint-import-resolver-typescript": "^3.6.1", + "ethers": "5.7.2", + "inquirer": "^8.1.4", + "node-machine-id": "^1.1.12", + "ofetch": "^1.3.3", + "winston": "^3.10.0", + "zkcli-block-explorer": "^1.0.0", + "zkcli-dockerized-node": "^1.0.2", + "zkcli-in-memory-node": "^1.0.3", + "zkcli-portal": "^1.0.1", + "zksync-web3": "^0.14.4" + }, + "bin": { + "zksync-cli": "bin/index.js" + } + }, + "node_modules/zkcli-dockerized-node/node_modules/zksync-cli/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/zkcli-in-memory-node": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/zkcli-in-memory-node/-/zkcli-in-memory-node-1.0.3.tgz", @@ -21155,18 +21197,53 @@ } }, "zkcli-dockerized-node": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/zkcli-dockerized-node/-/zkcli-dockerized-node-1.0.2.tgz", - "integrity": "sha512-bC4a7QmmqzvKNCtGwBxD6l2n+fkv+NEi9oGwtXTS9bdVp/1N7m855LgVeSNBQoDd/OefpdWIzNG0enbTQ8xa+Q==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/zkcli-dockerized-node/-/zkcli-dockerized-node-1.0.3.tgz", + "integrity": "sha512-ZWlGoeeNF2tKHyHxmZwROGeO/riTXpAvT+VeDvMfMglBjcZgW5VkAoHjcyuiZxVA8Na/QmWxsA+CgdjzcGzsLg==", "requires": { "chalk": "^5.3.0", - "zksync-cli": "^0.6.0-alpha.19" + "zksync-cli": "^0.7.0-alpha.4" }, "dependencies": { "chalk": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==" + }, + "zksync-cli": { + "version": "0.7.0-alpha.6", + "resolved": "https://registry.npmjs.org/zksync-cli/-/zksync-cli-0.7.0-alpha.6.tgz", + "integrity": "sha512-8RWxJwe3bYgoskL+xFMK/krEaHNy4dirAj7Xax/TNXuS3Wcv/3mFVjXUVv3M1bqlX6BsUkece5dMZTd23wrA+A==", + "requires": { + "@rudderstack/rudder-sdk-node": "^2.0.5", + "chalk": "4.1.2", + "commander": "^11.0.0", + "compare-versions": "^6.1.0", + "cross-env": "^7.0.3", + "dotenv": "^16.3.1", + "eslint-import-resolver-typescript": "^3.6.1", + "ethers": "5.7.2", + "inquirer": "^8.1.4", + "node-machine-id": "^1.1.12", + "ofetch": "^1.3.3", + "winston": "^3.10.0", + "zkcli-block-explorer": "^1.0.0", + "zkcli-dockerized-node": "^1.0.2", + "zkcli-in-memory-node": "^1.0.3", + "zkcli-portal": "^1.0.1", + "zksync-web3": "^0.14.4" + }, + "dependencies": { + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + } + } } } }, diff --git a/package.json b/package.json index 5ad21c58..92ed6e9e 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "inquirer": "^8.1.4", "winston": "^3.10.0", "zkcli-block-explorer": "^1.0.0", - "zkcli-dockerized-node": "^1.0.2", + "zkcli-dockerized-node": "^1.0.3", "zkcli-in-memory-node": "^1.0.3", "zkcli-portal": "^1.0.1", "zksync-web3": "^0.14.4" From bef22d6aa829d25b93feb48d56c35bc80e5d4fbd Mon Sep 17 00:00:00 2001 From: Jack Hamer Date: Fri, 13 Oct 2023 18:37:52 +0300 Subject: [PATCH 08/15] fix: update block explorer module --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index dc6ef285..29b465d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "ethers": "5.7.2", "inquirer": "^8.1.4", "winston": "^3.10.0", - "zkcli-block-explorer": "^1.0.0", + "zkcli-block-explorer": "^1.0.1", "zkcli-dockerized-node": "^1.0.3", "zkcli-in-memory-node": "^1.0.3", "zkcli-portal": "^1.0.1", @@ -12198,9 +12198,9 @@ } }, "node_modules/zkcli-block-explorer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.0.tgz", - "integrity": "sha512-DgWUTn/zrtQ/MIZdbbmmy83POQbZ0EhHGV00Yqh4vrwsTlkMjtaduWDu5FWZGH5q+L2sDb41rHadGgls7iaePg==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.1.tgz", + "integrity": "sha512-shYAsJeHTuJm5TtDK7hJ+D5sRNfoCXa8vimEjxyNV06DU/RC930L3LoAyXGX7zAXe8HXT7PeGb3L/MbsVKqhCg==", "dependencies": { "chalk": "^5.3.0", "zksync-cli": "^0.7.0-alpha.4" @@ -21147,9 +21147,9 @@ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" }, "zkcli-block-explorer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.0.tgz", - "integrity": "sha512-DgWUTn/zrtQ/MIZdbbmmy83POQbZ0EhHGV00Yqh4vrwsTlkMjtaduWDu5FWZGH5q+L2sDb41rHadGgls7iaePg==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.1.tgz", + "integrity": "sha512-shYAsJeHTuJm5TtDK7hJ+D5sRNfoCXa8vimEjxyNV06DU/RC930L3LoAyXGX7zAXe8HXT7PeGb3L/MbsVKqhCg==", "requires": { "chalk": "^5.3.0", "zksync-cli": "^0.7.0-alpha.4" diff --git a/package.json b/package.json index 92ed6e9e..113eb0a9 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "ethers": "5.7.2", "inquirer": "^8.1.4", "winston": "^3.10.0", - "zkcli-block-explorer": "^1.0.0", + "zkcli-block-explorer": "^1.0.1", "zkcli-dockerized-node": "^1.0.3", "zkcli-in-memory-node": "^1.0.3", "zkcli-portal": "^1.0.1", From 1000f2f25fbfbf63bb80d0e4c3e107c89db8eb28 Mon Sep 17 00:00:00 2001 From: Jack Hamer Date: Mon, 16 Oct 2023 16:33:15 +0300 Subject: [PATCH 09/15] fix: update block explorer --- package-lock.json | 32 +++++++++++++++++++++++++------- package.json | 2 +- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 29b465d3..5119e54f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "ethers": "5.7.2", "inquirer": "^8.1.4", "winston": "^3.10.0", - "zkcli-block-explorer": "^1.0.1", + "zkcli-block-explorer": "^1.0.2-alpha.1", "zkcli-dockerized-node": "^1.0.3", "zkcli-in-memory-node": "^1.0.3", "zkcli-portal": "^1.0.1", @@ -12198,9 +12198,9 @@ } }, "node_modules/zkcli-block-explorer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.1.tgz", - "integrity": "sha512-shYAsJeHTuJm5TtDK7hJ+D5sRNfoCXa8vimEjxyNV06DU/RC930L3LoAyXGX7zAXe8HXT7PeGb3L/MbsVKqhCg==", + "version": "1.0.2-alpha.1", + "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.2-alpha.1.tgz", + "integrity": "sha512-edpe88K0mTgREio/8rGt4312xkKgplsvZGQYgfaycpCkLxgI26lLu1QahLBAdFPA0P+Ewd+dyxQ3nccN5kKc9A==", "dependencies": { "chalk": "^5.3.0", "zksync-cli": "^0.7.0-alpha.4" @@ -12278,6 +12278,15 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/zkcli-dockerized-node/node_modules/zkcli-block-explorer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.1.tgz", + "integrity": "sha512-shYAsJeHTuJm5TtDK7hJ+D5sRNfoCXa8vimEjxyNV06DU/RC930L3LoAyXGX7zAXe8HXT7PeGb3L/MbsVKqhCg==", + "dependencies": { + "chalk": "^5.3.0", + "zksync-cli": "^0.7.0-alpha.4" + } + }, "node_modules/zkcli-dockerized-node/node_modules/zksync-cli": { "version": "0.7.0-alpha.6", "resolved": "https://registry.npmjs.org/zksync-cli/-/zksync-cli-0.7.0-alpha.6.tgz", @@ -21147,9 +21156,9 @@ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" }, "zkcli-block-explorer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.1.tgz", - "integrity": "sha512-shYAsJeHTuJm5TtDK7hJ+D5sRNfoCXa8vimEjxyNV06DU/RC930L3LoAyXGX7zAXe8HXT7PeGb3L/MbsVKqhCg==", + "version": "1.0.2-alpha.1", + "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.2-alpha.1.tgz", + "integrity": "sha512-edpe88K0mTgREio/8rGt4312xkKgplsvZGQYgfaycpCkLxgI26lLu1QahLBAdFPA0P+Ewd+dyxQ3nccN5kKc9A==", "requires": { "chalk": "^5.3.0", "zksync-cli": "^0.7.0-alpha.4" @@ -21210,6 +21219,15 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==" }, + "zkcli-block-explorer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.1.tgz", + "integrity": "sha512-shYAsJeHTuJm5TtDK7hJ+D5sRNfoCXa8vimEjxyNV06DU/RC930L3LoAyXGX7zAXe8HXT7PeGb3L/MbsVKqhCg==", + "requires": { + "chalk": "^5.3.0", + "zksync-cli": "^0.7.0-alpha.4" + } + }, "zksync-cli": { "version": "0.7.0-alpha.6", "resolved": "https://registry.npmjs.org/zksync-cli/-/zksync-cli-0.7.0-alpha.6.tgz", diff --git a/package.json b/package.json index 113eb0a9..08ba19a3 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "ethers": "5.7.2", "inquirer": "^8.1.4", "winston": "^3.10.0", - "zkcli-block-explorer": "^1.0.1", + "zkcli-block-explorer": "^1.0.2-alpha.1", "zkcli-dockerized-node": "^1.0.3", "zkcli-in-memory-node": "^1.0.3", "zkcli-portal": "^1.0.1", From 6d4ac9a0575a90990c2ed02a9c1345b41650f1e4 Mon Sep 17 00:00:00 2001 From: Jack Hamer Date: Mon, 16 Oct 2023 16:44:17 +0300 Subject: [PATCH 10/15] fix: update dockerized node --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5119e54f..a86b7a7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "inquirer": "^8.1.4", "winston": "^3.10.0", "zkcli-block-explorer": "^1.0.2-alpha.1", - "zkcli-dockerized-node": "^1.0.3", + "zkcli-dockerized-node": "^1.0.4", "zkcli-in-memory-node": "^1.0.3", "zkcli-portal": "^1.0.1", "zksync-web3": "^0.14.4" @@ -12259,9 +12259,9 @@ } }, "node_modules/zkcli-dockerized-node": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/zkcli-dockerized-node/-/zkcli-dockerized-node-1.0.3.tgz", - "integrity": "sha512-ZWlGoeeNF2tKHyHxmZwROGeO/riTXpAvT+VeDvMfMglBjcZgW5VkAoHjcyuiZxVA8Na/QmWxsA+CgdjzcGzsLg==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/zkcli-dockerized-node/-/zkcli-dockerized-node-1.0.4.tgz", + "integrity": "sha512-AYNg+fSt1DTfbpJ6ofdqOUyLa9msiFPljnyQtLKImz2S7xlCZAjTkQLA7o9aWinnSgIPHecrRVxKdjW+OeNHXg==", "dependencies": { "chalk": "^5.3.0", "zksync-cli": "^0.7.0-alpha.4" @@ -21206,9 +21206,9 @@ } }, "zkcli-dockerized-node": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/zkcli-dockerized-node/-/zkcli-dockerized-node-1.0.3.tgz", - "integrity": "sha512-ZWlGoeeNF2tKHyHxmZwROGeO/riTXpAvT+VeDvMfMglBjcZgW5VkAoHjcyuiZxVA8Na/QmWxsA+CgdjzcGzsLg==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/zkcli-dockerized-node/-/zkcli-dockerized-node-1.0.4.tgz", + "integrity": "sha512-AYNg+fSt1DTfbpJ6ofdqOUyLa9msiFPljnyQtLKImz2S7xlCZAjTkQLA7o9aWinnSgIPHecrRVxKdjW+OeNHXg==", "requires": { "chalk": "^5.3.0", "zksync-cli": "^0.7.0-alpha.4" diff --git a/package.json b/package.json index 08ba19a3..351abe32 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "inquirer": "^8.1.4", "winston": "^3.10.0", "zkcli-block-explorer": "^1.0.2-alpha.1", - "zkcli-dockerized-node": "^1.0.3", + "zkcli-dockerized-node": "^1.0.4", "zkcli-in-memory-node": "^1.0.3", "zkcli-portal": "^1.0.1", "zksync-web3": "^0.14.4" From f336dd91af8f6ca1c8c0a0850db5e78a261c9b93 Mon Sep 17 00:00:00 2001 From: Jack Hamer Date: Mon, 16 Oct 2023 17:26:23 +0300 Subject: [PATCH 11/15] fix: clean before removing folder --- src/commands/dev/clean.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/dev/clean.ts b/src/commands/dev/clean.ts index 4791d448..75831cf5 100644 --- a/src/commands/dev/clean.ts +++ b/src/commands/dev/clean.ts @@ -10,8 +10,8 @@ export const cleanModule = async (module: Module) => { if (!isInstalled) { return; } - module.removeDataDir(); await module.clean(); + module.removeDataDir(); } catch (error) { Logger.error(`There was an error while cleaning module "${module.name}":`); Logger.error(error); From e93b952c781c7c2da9e717adab2bda2ef213e730 Mon Sep 17 00:00:00 2001 From: Jack Hamer Date: Mon, 16 Oct 2023 18:35:08 +0300 Subject: [PATCH 12/15] fix: check node version --- src/program.ts | 12 ++++++++---- src/utils/node.ts | 9 ++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/program.ts b/src/program.ts index a71d97f0..7b6fc600 100644 --- a/src/program.ts +++ b/src/program.ts @@ -18,10 +18,14 @@ program.name(Package.name).description(Package.description).version(Package.vers program.hook("preAction", async () => { const nodeVersion = await getNodeVersion(); const minimumNodeVersion = "18.0.0"; - if (compare(nodeVersion, minimumNodeVersion, "<")) { - Logger.error("Minimum Node.js version required: v18.x"); - Logger.error(`Current version: v${nodeVersion}`); - process.exit(1); + try { + if (compare(nodeVersion, minimumNodeVersion, "<")) { + Logger.error("Minimum Node.js version required: v18.x"); + Logger.error(`Current version: v${nodeVersion}`); + process.exit(1); + } + } catch (error) { + Logger.warn(`Failed to check Node.js version. Make sure you are using version ${minimumNodeVersion} or higher`); } }); diff --git a/src/utils/node.ts b/src/utils/node.ts index 0fbc0228..fc2690eb 100644 --- a/src/utils/node.ts +++ b/src/utils/node.ts @@ -5,9 +5,12 @@ let nodeVersion: string | undefined; export const getNodeVersion = async () => { if (nodeVersion) return nodeVersion; try { - const version = await executeCommand("node --version", { silent: true }); - nodeVersion = version.trim().slice(1); - return nodeVersion; + const version = (await executeCommand("node --version", { silent: true })).trim(); + const vIndex = version.indexOf("v"); + if (vIndex === -1) { + return version; + } + return version.slice(vIndex + 1); } catch { throw new Error("Node.js is not installed. Download: http://nodejs.org"); } From 0f0e1b50e60fd878e63b7889046a2ce6ee00dc00 Mon Sep 17 00:00:00 2001 From: Jack Hamer Date: Tue, 17 Oct 2023 11:37:02 +0300 Subject: [PATCH 13/15] fix: allow to unlink modules with same name --- src/commands/dev/uninstall.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/commands/dev/uninstall.ts b/src/commands/dev/uninstall.ts index 6478211f..018301a5 100644 --- a/src/commands/dev/uninstall.ts +++ b/src/commands/dev/uninstall.ts @@ -15,11 +15,13 @@ const unlinkOption = new Option( export const handler = async (moduleNames: string[], options: { unlink: boolean }) => { try { - const defaultModules = await findDefaultModules(); - for (const name of moduleNames) { - if (defaultModules.some((e) => e.name === name)) { - Logger.error(`Uninstalling default modules is not allowed: ${name}`); - return; + if (!options.unlink) { + const defaultModules = await findDefaultModules(); + for (const name of moduleNames) { + if (defaultModules.some((e) => e.name === name)) { + Logger.error(`Uninstalling default modules is not allowed: ${name}`); + return; + } } } From cb6cb2e03e9700000070f91ac7329a2adf5d0fa1 Mon Sep 17 00:00:00 2001 From: Jack Hamer Date: Tue, 17 Oct 2023 13:48:26 +0300 Subject: [PATCH 14/15] fix: update block explorer --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index a86b7a7d..54bfe3da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "ethers": "5.7.2", "inquirer": "^8.1.4", "winston": "^3.10.0", - "zkcli-block-explorer": "^1.0.2-alpha.1", + "zkcli-block-explorer": "^1.0.2-alpha.3", "zkcli-dockerized-node": "^1.0.4", "zkcli-in-memory-node": "^1.0.3", "zkcli-portal": "^1.0.1", @@ -12198,9 +12198,9 @@ } }, "node_modules/zkcli-block-explorer": { - "version": "1.0.2-alpha.1", - "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.2-alpha.1.tgz", - "integrity": "sha512-edpe88K0mTgREio/8rGt4312xkKgplsvZGQYgfaycpCkLxgI26lLu1QahLBAdFPA0P+Ewd+dyxQ3nccN5kKc9A==", + "version": "1.0.2-alpha.3", + "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.2-alpha.3.tgz", + "integrity": "sha512-j4n1qdHG4O/shBiyIEXYkYuja58n92iOni/a43mPmH3teE2DH+emQQwscB4EJ0kMLFb8e7gvObQtMpRFRrpm2A==", "dependencies": { "chalk": "^5.3.0", "zksync-cli": "^0.7.0-alpha.4" @@ -21156,9 +21156,9 @@ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" }, "zkcli-block-explorer": { - "version": "1.0.2-alpha.1", - "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.2-alpha.1.tgz", - "integrity": "sha512-edpe88K0mTgREio/8rGt4312xkKgplsvZGQYgfaycpCkLxgI26lLu1QahLBAdFPA0P+Ewd+dyxQ3nccN5kKc9A==", + "version": "1.0.2-alpha.3", + "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.2-alpha.3.tgz", + "integrity": "sha512-j4n1qdHG4O/shBiyIEXYkYuja58n92iOni/a43mPmH3teE2DH+emQQwscB4EJ0kMLFb8e7gvObQtMpRFRrpm2A==", "requires": { "chalk": "^5.3.0", "zksync-cli": "^0.7.0-alpha.4" diff --git a/package.json b/package.json index 351abe32..a6bb6330 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "ethers": "5.7.2", "inquirer": "^8.1.4", "winston": "^3.10.0", - "zkcli-block-explorer": "^1.0.2-alpha.1", + "zkcli-block-explorer": "^1.0.2-alpha.3", "zkcli-dockerized-node": "^1.0.4", "zkcli-in-memory-node": "^1.0.3", "zkcli-portal": "^1.0.1", From 21c21d4203a6e9c73120429feeda2c8d30b8a02d Mon Sep 17 00:00:00 2001 From: Jack Hamer Date: Tue, 17 Oct 2023 19:21:39 +0300 Subject: [PATCH 15/15] fix: use lastest version of block explorer module --- package-lock.json | 32 +++++++------------------------- package.json | 2 +- 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index 54bfe3da..2e1ef591 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "ethers": "5.7.2", "inquirer": "^8.1.4", "winston": "^3.10.0", - "zkcli-block-explorer": "^1.0.2-alpha.3", + "zkcli-block-explorer": "^1.0.2", "zkcli-dockerized-node": "^1.0.4", "zkcli-in-memory-node": "^1.0.3", "zkcli-portal": "^1.0.1", @@ -12198,9 +12198,9 @@ } }, "node_modules/zkcli-block-explorer": { - "version": "1.0.2-alpha.3", - "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.2-alpha.3.tgz", - "integrity": "sha512-j4n1qdHG4O/shBiyIEXYkYuja58n92iOni/a43mPmH3teE2DH+emQQwscB4EJ0kMLFb8e7gvObQtMpRFRrpm2A==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.2.tgz", + "integrity": "sha512-EMfHWpWDPGGz4K+ty5vLnxSiYmvCLBc1F4Kcg2sQjzQIWMqjSXS+Ur6Xuvt+VQHqrzIIlzOvhk5OCGJIBmi0oQ==", "dependencies": { "chalk": "^5.3.0", "zksync-cli": "^0.7.0-alpha.4" @@ -12278,15 +12278,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/zkcli-dockerized-node/node_modules/zkcli-block-explorer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.1.tgz", - "integrity": "sha512-shYAsJeHTuJm5TtDK7hJ+D5sRNfoCXa8vimEjxyNV06DU/RC930L3LoAyXGX7zAXe8HXT7PeGb3L/MbsVKqhCg==", - "dependencies": { - "chalk": "^5.3.0", - "zksync-cli": "^0.7.0-alpha.4" - } - }, "node_modules/zkcli-dockerized-node/node_modules/zksync-cli": { "version": "0.7.0-alpha.6", "resolved": "https://registry.npmjs.org/zksync-cli/-/zksync-cli-0.7.0-alpha.6.tgz", @@ -21156,9 +21147,9 @@ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" }, "zkcli-block-explorer": { - "version": "1.0.2-alpha.3", - "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.2-alpha.3.tgz", - "integrity": "sha512-j4n1qdHG4O/shBiyIEXYkYuja58n92iOni/a43mPmH3teE2DH+emQQwscB4EJ0kMLFb8e7gvObQtMpRFRrpm2A==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.2.tgz", + "integrity": "sha512-EMfHWpWDPGGz4K+ty5vLnxSiYmvCLBc1F4Kcg2sQjzQIWMqjSXS+Ur6Xuvt+VQHqrzIIlzOvhk5OCGJIBmi0oQ==", "requires": { "chalk": "^5.3.0", "zksync-cli": "^0.7.0-alpha.4" @@ -21219,15 +21210,6 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==" }, - "zkcli-block-explorer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/zkcli-block-explorer/-/zkcli-block-explorer-1.0.1.tgz", - "integrity": "sha512-shYAsJeHTuJm5TtDK7hJ+D5sRNfoCXa8vimEjxyNV06DU/RC930L3LoAyXGX7zAXe8HXT7PeGb3L/MbsVKqhCg==", - "requires": { - "chalk": "^5.3.0", - "zksync-cli": "^0.7.0-alpha.4" - } - }, "zksync-cli": { "version": "0.7.0-alpha.6", "resolved": "https://registry.npmjs.org/zksync-cli/-/zksync-cli-0.7.0-alpha.6.tgz", diff --git a/package.json b/package.json index a6bb6330..e42d9449 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "ethers": "5.7.2", "inquirer": "^8.1.4", "winston": "^3.10.0", - "zkcli-block-explorer": "^1.0.2-alpha.3", + "zkcli-block-explorer": "^1.0.2", "zkcli-dockerized-node": "^1.0.4", "zkcli-in-memory-node": "^1.0.3", "zkcli-portal": "^1.0.1",