From 0b7341c5a98e34261995435d1e2e1c88a70407da Mon Sep 17 00:00:00 2001 From: barriebyron Date: Wed, 21 Jun 2023 10:45:10 -0400 Subject: [PATCH 1/2] snarky latest install suggestion and other CLI prompt edits --- src/lib/config.js | 2 +- src/lib/deploy.js | 18 +++++++++--------- src/lib/example.js | 4 ++-- src/lib/file.js | 4 ++-- src/lib/project.js | 6 +++--- src/lib/system.js | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/lib/config.js b/src/lib/config.js index bc823735..a079378c 100644 --- a/src/lib/config.js +++ b/src/lib/config.js @@ -26,7 +26,7 @@ async function config() { } catch (err) { let str; if (err.code === 'ENOENT') { - str = `config.json not found. Make sure you're in a zkApp project.`; + str = `config.json not found. Make sure you're in a zkApp project directory.`; } else { str = 'Unable to read config.json.'; console.error(err); diff --git a/src/lib/deploy.js b/src/lib/deploy.js index f0182a41..e97a0aa2 100644 --- a/src/lib/deploy.js +++ b/src/lib/deploy.js @@ -31,7 +31,7 @@ async function deploy({ alias, yes }) { } catch (err) { let str; if (err.code === 'ENOENT') { - str = `config.json not found. Make sure you're in a zkApp project.`; + str = `config.json not found. Make sure you're in a zkApp project directory.`; } else { str = 'Unable to read config.json.'; console.error(err); @@ -48,9 +48,9 @@ async function deploy({ alias, yes }) { config.deployAliases = config?.networks; if (hasBreakingChanges(installedCliVersion, latestCliVersion)) { - log(red(`You are using an old zkapp-cli version ${installedCliVersion}.`)); + log(red(`You are using an earlier zkapp-cli version ${installedCliVersion}.`)); log(red(`The current version is ${latestCliVersion}.`)); - log(red('Run `npm update -g zkapp-cli && npm update snarkyjs`.')); + log(red('Run `npm update -g zkapp-cli && npm install snarkyjs@latest`.')); return; } @@ -70,7 +70,7 @@ async function deploy({ alias, yes }) { // Makes the step text green upon success, else uses reset. const style = state.submitted && !state.cancelled ? state.styles.success : reset; - return style('Which deploy alias would you like to deploy to?'); + return style('Which deploy alias do you want to deploy to?'); }, prefix: (state) => { // Shows a cyan question mark when not submitted. @@ -137,7 +137,7 @@ async function deploy({ alias, yes }) { return { smartContracts }; }); - // Identify which smart contract should be deployed for this deploy alias. + // Identify which smart contract to be deployed for this deploy alias. let contractName = chooseSmartContract(config, build, alias); // If no smart contract is specified for this deploy alias in config.json & @@ -244,7 +244,7 @@ async function deploy({ alias, yes }) { } catch (_) { log( red( - ` Failed to find the "${contractName}" smart contract in your build directory.\n Please confirm that your config.json contains the name of the smart contract that you desire to deploy to this deploy alias.` + ` Failed to find the "${contractName}" smart contract in your build directory.\n Please confirm that your config.json contains the name of the smart contract that you want to deploy to this deploy alias.` ) ); @@ -493,7 +493,7 @@ async function deploy({ alias, yes }) { process.exit(0); } -// Get the desired blockchain explorer url with txn hash +// Get the specified blockchain explorer url with txn hash function getTxnUrl(graphQLUrl, txn) { const MINASCAN_BASE_URL = `https://minascan.io/berkeley/zk-transaction/`; const MINA_EXPLORER_BASE_URL = `https://berkeley.minaexplorer.com/transaction/`; @@ -542,7 +542,7 @@ async function getInstalledCliVersion() { While SnarkyJS and the zkApp CLI have a major version of 0, a change of the minor version represents a breaking change. When SnarkyJS and the zkApp CLI have a major version of 1 or higher, -changes to the major version of the zkApp CLI will represnt +changes to the major version of the zkApp CLI will represent breaking changes, following semver. */ function hasBreakingChanges(version1, version2) { @@ -580,7 +580,7 @@ async function findSmartContracts(path) { } /** - * Choose which smart contract should be deployed for this deploy alias. + * Choose which smart contract to deploy for this deploy alias. * @param {object} config The config.json in object format. * @param {object} deploy The build/build.json in object format. * @param {string} deployAliasName The deploy alias name. diff --git a/src/lib/example.js b/src/lib/example.js index d4cc8097..24f45df9 100644 --- a/src/lib/example.js +++ b/src/lib/example.js @@ -216,7 +216,7 @@ function kebabCase(str) { /** * Fetch an example & place in the `src` directory. - * @param {string} example Name of the example, as found in our Github repo. + * @param {string} example Name of the example, as found in our GitHub repo. * @param {string} name Destination dir name. * @param {string} lang ts or js * @returns {Promise} True if successful; false if not. @@ -269,7 +269,7 @@ function isEmpty(path) { } /** - * Given a desired directory name, will return that dir name if it is available, + * Given a specified directory name, will return that dir name if it is available, * or the next next available dir name with a numeric suffix: <#>. * @param {string} str Desired dir name. * @param {number} i Counter for the recursive function. diff --git a/src/lib/file.js b/src/lib/file.js index ac40672c..7689cf53 100644 --- a/src/lib/file.js +++ b/src/lib/file.js @@ -59,9 +59,9 @@ describe('${projName}.js', () => { } /** - * parsePath() parses cwd & user's desired name with optional path. + * parsePath() parses cwd & user's specified name with optional path. * @param {string} cwd Current working directory. E.g. process.cwd(). - * @param {string} _path User's desired filename with optional path. + * @param {string} _path User's specified filename with optional path. * E.g. `path/to/name` or `name` (with no path). * @returns {{fullPath: string, projName: string, userPath: string}} */ diff --git a/src/lib/project.js b/src/lib/project.js index 495c7543..65548dae 100644 --- a/src/lib/project.js +++ b/src/lib/project.js @@ -22,7 +22,7 @@ const isWindows = process.platform === 'win32'; * Create a new zkApp project with recommended dir structure, Prettier config, * testing lib, etc. Warns if already exists and does NOT overwrite. * @param {object} argv - The arguments object provided by yargs. - * @param {string} argv.name - The user's desired project name. + * @param {string} argv.name - The user's specified project name. * @param {string} argv.ui - The name of the UI framework to use. * @return {Promise} */ @@ -59,7 +59,7 @@ async function project({ name, ui }) { ui = res.ui; } - sh.mkdir('-p', name); // Create path/to/dir with their desired name + sh.mkdir('-p', name); // Create path/to/dir with their specified name sh.cd(name); // Set dir for shell commands. Doesn't change user's dir in their CLI. // If user wants a UI framework installed alongside their smart contract, @@ -402,7 +402,7 @@ async function scaffoldNext(projectName) { message: (state) => message( state, - 'Do you want to setup your project for deployment to Github Pages?' + 'Do you want to set up your project for deployment to GitHub Pages?' ), choices: ['no', 'yes'], prefix: (state) => prefix(state), diff --git a/src/lib/system.js b/src/lib/system.js index cd488696..91bcfb37 100644 --- a/src/lib/system.js +++ b/src/lib/system.js @@ -3,7 +3,7 @@ const sh = require('child_process').execSync; function system() { const installedSnarkyJSversion = getInstalledSnarkyJSversion(); - console.log('Please include the following when submitting a Github issue:'); + console.log('Be sure to include the following system information when submitting a GitHub issue:'); envinfo .run( { From 502d3c0b1d35c1eedf1c6657ba7d1844c03078e9 Mon Sep 17 00:00:00 2001 From: barriebyron Date: Wed, 21 Jun 2023 12:55:34 -0400 Subject: [PATCH 2/2] use present tense for key payer creation --- src/lib/project.js | 2 +- src/lib/prompts.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/project.js b/src/lib/project.js index 65548dae..55e1c630 100644 --- a/src/lib/project.js +++ b/src/lib/project.js @@ -570,7 +570,7 @@ async function scaffoldNext(projectName) { console.log( 'Using project name ' + projectName + - ' for github repo name. Please change in next.config.js and pages/reactCOIServiceWorker.tsx if this is not correct or changes' + ' for GitHub repo name. Change in next.config.js and pages/reactCOIServiceWorker.tsx if this is not correct or changes' ); let newNextConfig = nextConfig.replace( diff --git a/src/lib/prompts.js b/src/lib/prompts.js index 2b96f258..20637163 100644 --- a/src/lib/prompts.js +++ b/src/lib/prompts.js @@ -89,7 +89,7 @@ const prompts = { }, { name: `Create a new fee payer key pair - NOTE: the private key will be stored in plain text on this computer.`, + NOTE: The private key is created on this computer and is stored in plain text.`, value: 'create', }, ], @@ -174,7 +174,7 @@ const prompts = { message: (state) => { const style = state.submitted && !state.cancelled ? green : reset; return style(`Account private key (base58): - NOTE: the private key will be stored in plain text on this computer. + NOTE: The private key is created on this computer and is stored in plain text. Do NOT use an account which holds a substantial amount of MINA.`); }, validate: async (val) => { @@ -248,7 +248,7 @@ function getFeepayorChoices(cachedFeepayerAliases) { }, { name: `Create a new fee payer key pair - NOTE: the private key will be stored in plain text on this computer.`, + NOTE: The private key is created on this computer and is stored in plain text.`, value: 'create', }, ];