Skip to content

Commit

Permalink
Merge pull request #846 from PierreBrisorgueil/fixscriptName
Browse files Browse the repository at this point in the history
fix(scripts): fix scripts path 🐛
  • Loading branch information
PierreBrisorgueil authored Jun 21, 2020
2 parents 22ac1e0 + eef9078 commit ee05ab0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"test:coveralls": "cross-env NODE_ENV=test gulp testCoverage && cat ./coverage/lcov.info | coveralls",
"seed:dev": "cross-env NODE_ENV=development gulp seed",
"seed:prod": "cross-env NODE_ENV=production gulp seed",
"seed:mongodump": "./scripts/db/mongoDump.sh",
"seed:mongorestore": "node ./scripts/db/mongoRestore.js",
"seed:mongodump": "./scripts/db/mongodump.sh",
"seed:mongorestore": "node ./scripts/db/mongorestore.js",
"seed:mongodrop": "gulp drop",
"generate:sllCerts": "scripts/generate-ssl-certs.sh",
"lint": "gulp lint",
Expand Down
2 changes: 1 addition & 1 deletion scripts/db/mongoDump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ if [ -z ${NODE_ENV+x} ]; then NODE_ENV=development; fi

db=$(grep -i 'mongodb://' ./config/defaults/${NODE_ENV}.js | awk -F/ '{print $NF}' | rev | cut -c3- | rev )

mongodump -d ${db} --out=./scripts/data/dump
mongodump -d ${db} --out=./scripts/db/dump
4 changes: 2 additions & 2 deletions scripts/db/mongoRestore.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ const seedData = async () => {
const database = config.db.uri.split('/')[config.db.uri.split('/').length - 1];
console.log(chalk.bold.green(`database selected: ${database}`));

fs.readdirSync(path.resolve(`./scripts/data/dump/${database}`)).forEach((file) => {
fs.readdirSync(path.resolve(`./scripts/db/dump/${database}`)).forEach((file) => {
if (file.slice(-4) === 'bson' && !exceptions.includes(file.split('.')[0])) {
const collection = file.slice(0, -5);

const buffer = fs.readFileSync(path.resolve(`./scripts/data/dump/${database}/${collection}.bson`));
const buffer = fs.readFileSync(path.resolve(`./scripts/db/dump/${database}/${collection}.bson`));
let bfIdx = 0;
const items = [];
while (bfIdx < buffer.length) bfIdx = bson.deserializeStream(buffer, bfIdx, 1, items, items.length);
Expand Down

0 comments on commit ee05ab0

Please sign in to comment.