Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upNew command - cavy init #9
Conversation
|
(Related: #8) |
|
Now we have three sub-commands, instead of two that are basically the same, how do you feel about swapping to Commander's git-style sub-commands? https://github.com/tj/commander.js#git-style-sub-commands? |
|
|
||
| // Create a exampleTest.js file in the specified folder in the route of the | ||
| // project. | ||
| mkdirSync(`./${folderName}`); |
jalada
Apr 16, 2019
Contributor
- Can we sanitise this input?
- Do we need the
./? Does that break this on Windows?
» node cavy.js init foo/bar
cavy: Adding Cavy to your project...
fs.js:121
throw err;
^
Error: ENOENT: no such file or directory, mkdir './foo/bar'
- Can we sanitise this input?
- Do we need the
./? Does that break this on Windows?
» node cavy.js init foo/bar
cavy: Adding Cavy to your project...
fs.js:121
throw err;
^
Error: ENOENT: no such file or directory, mkdir './foo/bar'
jalada
Apr 16, 2019
Contributor
As per below, perhaps disregard my point about ./.
As per below, perhaps disregard my point about ./.
AbigailMcP
Apr 17, 2019
Author
Collaborator
Agreed, should test on Windows, a couple of people have raised issues that I think could be down to Windows environments. And if the GitHub dev survey is anything to go by...
Agreed, should test on Windows, a couple of people have raised issues that I think could be down to Windows environments. And if the GitHub dev survey is anything to go by...
jalada
Apr 17, 2019
Contributor
Oh now interesting, maybe I shouldn't have used the word sanitise. Because now if I did cavy init myproject/specs will I end up with a folder called myprojectspecs? I think it'd be better to return an error to avoid anything unexpected.
Oh now interesting, maybe I shouldn't have used the word sanitise. Because now if I did cavy init myproject/specs will I end up with a folder called myprojectspecs? I think it'd be better to return an error to avoid anything unexpected.
| writeFileSync(`./${folderName}/exampleSpec.js`, specContent); | ||
|
|
||
| // Don't overwrite any index.test.js file that already exists. | ||
| if (DEFAULT_ENTRY_FILE) { |
jalada
Apr 16, 2019
Contributor
This is always true; I think you mean to check the file exists?
This is always true; I think you mean to check the file exists?
AbigailMcP
Apr 17, 2019
Author
Collaborator
Oops!
Oops!
Co-Authored-By: AbigailMcP <abigail@pixielabs.io>
|
@jalada - this is ready for you to look at again. |
|
Definitely time for something in the README! |
|
|
Includes
cavy initthat creates an exampleindex.test.jsfile andexampleSpec.jsin a specs folder.specsfolder. Fall back onspecsif no argument is given.To think about
index.test.jsfile then at the moment I'm just ignoring that set up step (no overwrite). Happy to hear other people's opinions on what could happen.To do
To test
npm linkthis branch to test out locally in the Cavy Directory sample app