Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

dev-deploy: create neardev directory if it doesn't exist #362

Merged
merged 6 commits into from
May 13, 2020

Conversation

mikedotexe
Copy link
Contributor

If there's no neardev directory, near dev-deploy will fail with:

Error:  [Error: ENOENT: no such file or directory, open 'neardev/dev-account'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'neardev/dev-account'
}
error Command failed with exit code 1.

This is new behavior as of 0.23.0, let's address this quickly.

Tested by going into guest-book example locally:
../near-shell/bin/near dev-deploy

rm -rf neardev
then running it again
rm neardev/dev-account*
then running it again

Copy link
Contributor

@chadoh chadoh left a comment

Choose a reason for hiding this comment

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

I would prefer we did the equivalent of mkdir -p in the normal flow, rather than creating the directory in the catch block

@mikedotexe
Copy link
Contributor Author

I would prefer we did the equivalent of mkdir -p in the normal flow, rather than creating the directory in the catch block

That won't work for Windows, but I did consider adding the mkdir package for this. I know there's always pushback against adding new dependencies for one small change, so I decided to do it this way.

@chadoh
Copy link
Contributor

chadoh commented May 9, 2020

Right, I said "something like mkdir -p because I thought windows might give problems with actual mkdir -p.

I think we could use something like this:

if (!fs.existsSync('./neardev')) await fs.promises.mkdir('./neardev')

(Not sure I got that syntax right)

Would this work on Windows?

commands/dev-deploy.js Outdated Show resolved Hide resolved
@mikedotexe mikedotexe requested a review from chadoh May 11, 2020 23:46
@vgrichina
Copy link
Contributor

This change d426201 only works well if all the occurrences are replaced:
https://github.com/near/near-shell/search?l=JavaScript&q=neardev

@vgrichina vgrichina merged commit b56d908 into master May 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants