-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Allows to generate seeders from a custom template * Allows to install a custom template when running the install command
- Loading branch information
Showing
31 changed files
with
736 additions
and
117 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import mongoose from 'mongoose'; | ||
|
||
const mongoURL = | ||
process.env.MONGO_URL || | ||
'mongodb://localhost:27017/md-seed-generate-sandbox-1'; | ||
|
||
/** | ||
* Seeders List | ||
* order is important | ||
* @type {Object} | ||
*/ | ||
export const seedersList = {}; | ||
/** | ||
* Connect to mongodb implementation | ||
* @return {Promise} | ||
*/ | ||
export const connect = async () => | ||
await mongoose.connect( | ||
mongoURL, | ||
{ useNewUrlParser: true } | ||
); | ||
/** | ||
* Drop/Clear the database implementation | ||
* @return {Promise} | ||
*/ | ||
export const dropdb = async () => mongoose.connection.db.dropDatabase(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "md-seed-example", | ||
"version": "2.0.0", | ||
"description": "Example of using mongoose-data-seed", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "Avi Sharvit <sharvita@gmail.com> (https://sharvit.github.io)", | ||
"license": "MIT", | ||
"dependencies": { | ||
"mongoose": "^5.0.0" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/e2e/generate-sandboxes/sandbox-2/custom-seeder-template.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
console.log( | ||
'I am <%= seederName %> and I created by a custom seeder template.' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import mongoose from 'mongoose'; | ||
|
||
const mongoURL = | ||
process.env.MONGO_URL || | ||
'mongodb://localhost:27017/md-seed-generate-sandbox-1'; | ||
|
||
/** | ||
* Seeders List | ||
* order is important | ||
* @type {Object} | ||
*/ | ||
export const seedersList = {}; | ||
/** | ||
* Connect to mongodb implementation | ||
* @return {Promise} | ||
*/ | ||
export const connect = async () => | ||
await mongoose.connect( | ||
mongoURL, | ||
{ useNewUrlParser: true } | ||
); | ||
/** | ||
* Drop/Clear the database implementation | ||
* @return {Promise} | ||
*/ | ||
export const dropdb = async () => mongoose.connection.db.dropDatabase(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "md-seed-example", | ||
"version": "2.0.0", | ||
"description": "Example of using mongoose-data-seed", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "Avi Sharvit <sharvita@gmail.com> (https://sharvit.github.io)", | ||
"license": "MIT", | ||
"dependencies": { | ||
"mongoose": "^5.0.0" | ||
}, | ||
"mdSeed": { | ||
"seedersFolder": "./my-custom-seeders-folder", | ||
"customSeederTemplate": "./custom-seeder-template.js" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.