Skip to content

Commit

Permalink
Address code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
janedegtiareva committed Apr 22, 2020
1 parent e6684af commit 1f79bbd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 0 additions & 1 deletion commands/create-account.js
Expand Up @@ -33,7 +33,6 @@ module.exports = {

async function createAccount(options) {
await eventtracking.track(eventtracking.EVENT_ID_CREATE_ACCOUNT_START, {});
console.log("?")
options.initialBalance = utils.format.parseNearAmount(options.initialBalance);
// NOTE: initialBalance is passed as part of config here
let near = await connect(options);
Expand Down
2 changes: 1 addition & 1 deletion test/index.sh
@@ -1,7 +1,7 @@
#!/bin/bash
OVERALL_RESULT=0
mkdir ~/.near-config
cp ./test/testsettings ~/.near-config/settings
cp ./test/testsettings ~/.near-config/settings.json
for test in ./test/test_*; do
echo ""
echo "Running $test"
Expand Down
4 changes: 2 additions & 2 deletions utils/eventtracking.js
Expand Up @@ -6,7 +6,7 @@ const chalk = require('chalk'); // colorize output
const readline = require('readline');
const settings = require('./settings');

const TRACKING_ENABLED_KEY = 'trackingEnaled';
const TRACKING_ENABLED_KEY = 'trackingEnabled';
const TRACKING_SESSION_ID_KEY = 'trackingSessionId';

const track = async (eventType, eventProperties) => {
Expand Down Expand Up @@ -52,7 +52,7 @@ const track = async (eventType, eventProperties) => {

try {
const mixPanelProperties = {
distinct_id: shellSettings.trackingSessionId
distinct_id: shellSettings[TRACKING_SESSION_ID_KEY]
};
Object.assign(mixPanelProperties, eventProperties);
mixpanel.track(eventType, mixPanelProperties);
Expand Down
10 changes: 6 additions & 4 deletions utils/settings.js
Expand Up @@ -4,14 +4,16 @@ const path = require('path');


// Persistent shell settings
const SETTINGS_FILE_NAME = 'settings.json';
const SETTINGS_DIR = '.near-config';

const getShellSettings = () => {
const nearPath = path.join(homedir, '.near-config');
const nearPath = path.join(homedir, SETTINGS_DIR);
try {
if (!fs.existsSync(nearPath)) {
fs.mkdirSync(nearPath);
}
const shellSettingsPath = path.join(nearPath, 'settings');
const shellSettingsPath = path.join(nearPath, SETTINGS_FILE_NAME);
if (!fs.existsSync(shellSettingsPath)) {
return {};
} else {
Expand All @@ -24,12 +26,12 @@ const getShellSettings = () => {
};

const saveShellSettings = (settings) => {
const nearPath = path.join(homedir, '.near-config');
const nearPath = path.join(homedir, SETTINGS_DIR);
try {
if (!fs.existsSync(nearPath)) {
fs.mkdirSync(nearPath);
}
const shellSettingsPath = path.join(nearPath, 'settings');
const shellSettingsPath = path.join(nearPath, SETTINGS_FILE_NAME);
fs.writeFileSync(shellSettingsPath, JSON.stringify(settings));
} catch (e) {
console.log(e);
Expand Down

0 comments on commit 1f79bbd

Please sign in to comment.