Needlessly Promiscuous, Modularize!

npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

gulp-mongoose-scenario

1.3.0 • Public • Published

Gulp-Mongoose-Scenario

Gulp wrapper for mongoose-scenario.

Installation

Install via NPM:

npm install --save-dev gulp-mongoose-scenario

Usage:

var gulp = require('gulp');
var scenario = require('gulp-mongoose-scenario');
 
gulp.task('db', ()=> {
    // Load all config files including your main DB handler
    global.config = require('./config/global');
    require('./config/db');
 
    // Load all modules
    require('./models/users');
    require('./models/projects');
    require('./models/products');
    require('./models/productCategories');
 
    // Slurp in all the .json files located in models/scenarios and run them though mongoose-scenario
 
    return gulp.src('models/scenarios/**/*.json')
        .pipe(scenario({connection: db, nuke: true}))
});

If you wish to use .js files rather than raw JSON, run use something like gulp-eval earlier in the pipeline:

var eval = require('gulp-eval');
var gulp = require('gulp');
 
gulp.task('scenario', ()=>
    gulp.src('models/scenarios/**/*.{js,json}')
        .pipe(eval())
        .pipe(scenario({connection: db, nuke: true}))
)

install

npm i gulp-mongoose-scenario

Downloadsweekly downloads

39

version

1.3.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability