Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edits to change SnarkyJS latest install suggestion and other CLI prompt fixes #437

Merged
merged 2 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 9 additions & 9 deletions src/lib/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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}.`));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

general advice in language is to use earlier instead of older
https://github.com/o1-labs/docs2/wiki/Word-list#earlier
image

and

image

(not sure we need to provide a version number since we detect the earlier version)

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;
}

Expand All @@ -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?');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"like" and "desire" are emotive, let's use imperative language for the prompts

},
prefix: (state) => {
// Shows a cyan question mark when not submitted.
Expand Down Expand Up @@ -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.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we all want to use "should" but in technical situations, we want to avoid
see https://developers.google.com/style/word-list#letter-s
image

let contractName = chooseSmartContract(config, build, alias);

// If no smart contract is specified for this deploy alias in config.json &
Expand Down Expand Up @@ -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.`
)
);

Expand Down Expand Up @@ -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/`;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/lib/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep! we misspell GitHub in many places in our docs and code (oof)

* @param {string} name Destination dir name.
* @param {string} lang ts or js
* @returns {Promise<boolean>} True if successful; false if not.
Expand Down Expand Up @@ -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: <dirName><#>.
* @param {string} str Desired dir name.
* @param {number} i Counter for the recursive function.
Expand Down
4 changes: 2 additions & 2 deletions src/lib/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
*/
Expand Down
6 changes: 3 additions & 3 deletions src/lib/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>}
*/
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/lib/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
{
Expand Down