-
Notifications
You must be signed in to change notification settings - Fork 2
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
splits cards.csv into separate files; loads from these on seed:db #36
Conversation
Error was in unreplaced |
Fix has been pushed. |
bin/seed-deck.js
Outdated
@@ -12,17 +12,17 @@ program | |||
.option('-d, --description <string>', 'deck description') | |||
.parse(process.argv); | |||
|
|||
const files = fs.readdirSync(program.path); | |||
const image_files = fs.readdirSync(program.path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: imageFiles
for following JS conventions
bin/seed-deck.js
Outdated
|
||
console.log(`Upserted ${files.length} cards in "${program.name}"`); | ||
process.exit(); | ||
console.log(`Upserted ${image_files.length} cards in "${program.name}"`); | ||
})(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: newline at end of file to pass .eslint
rules (if we don't have that rule, we should add it)
Thank you so much @benheller |
Out of curiosity, do you know why the yarn process does not exit and return to the command line? |
Addresses #35
I am having a hard time figuring out if this script works.
When I run
yarn seed:db
with this change, I get the following command line output:And then the process hangs.
I suspect the may be an unresolved promise in each one of the calls to seed-deck.js? But I don't know what it could be or how to debug this kind of problem.
I have tried replacing the path to the csv files with
'./' + program.path + '.csv'
(instead ofprogram.path + '.csv'
, which is closer to the original construction) but it does not improve the situation.