Giter Site home page Giter Site logo

sharvit / mongoose-data-seed Goto Github PK

View Code? Open in Web Editor NEW
110.0 4.0 21.0 4.79 MB

Seed mongodb with data using mongoose models

Home Page: https://sharvit.github.io/mongoose-data-seed/

License: MIT License

JavaScript 99.33% HTML 0.67%
mongoose-data-seed seed-mongodb mongoose-seed

mongoose-data-seed's Introduction

Package Version semantic-release Downloads Status Build Status: Linux Coverage Status PRs Welcome dependencies Status devDependencies Status Greenkeeper badge code style: prettier FOSSA Status MIT License

mongoose-data-seed

Seed mongodb with data using mongoose models

cli example using md-seed run

Install

npm install --save mongoose-data-seed
md-seed init

md-seed init will ask you to choose a folder for your seeders.

md-seed init will create the seeders folder, generate md-seed-config.js and update your package.json.

Use

Generate seeder file

md-seed g users

Run all seeders

md-seed run

Or run specific seeders

md-seed run users posts comments

Options

Drop the database before seeding

md-seed run --dropdb

Seeder Example

import { Seeder } from 'mongoose-data-seed';
import { User } from '../server/models';

const data = [
  {
    email: '[email protected]',
    password: '123123',
    passwordConfirmation: '123123',
    isAdmin: true
  },
  {
    email: '[email protected]',
    password: '123123',
    passwordConfirmation: '123123',
    isAdmin: false
  }
];

class UsersSeeder extends Seeder {
  async shouldRun() {
    return User.countDocuments()
      .exec()
      .then(count => count === 0);
  }

  async run() {
    return User.create(data);
  }
}

export default UsersSeeder;

md-seed-config.js

md-seed expecting to get 3 values from md-seed-config.js

  1. seedersList - A key/value list of all your seeders, md-seed will run your seeders as they ordered in the list.
  2. connect - Connect to mongodb implementation (should return promise).
  3. dropdb - Drop/Clear the database implementation (should return promise).

Example

import mongoose from 'mongoose';

import Users from './seeders/users.seeder';
import Posts from './seeders/posts.seeder';
import Comments from './seeders/comments.seeder';

const mongoURL = process.env.MONGO_URL || 'mongodb://localhost:27017/dbname';

/**
 * Seeders List
 * order is important
 * @type {Object}
 */
export const seedersList = {
  Users,
  Posts,
  Comments,
};
/**
 * 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();

Configurations

mongoose-data-seed configurations will get loaded from the mdSeed field in your package.json file.

Field Default Value Description
seedersFolder './seeders' Path for your seeders-folder, seeders will be generated into this folder.
customSeederTemplate undefined Path to a custom template file to generate your seeders from.

Examples

  1. md-seed-example

License

MIT

FOSSA Status MIT License

mongoose-data-seed's People

Contributors

dependabot[bot] avatar foray1010 avatar greenkeeper[bot] avatar james-ingold avatar sharvit avatar wecarrasco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mongoose-data-seed's Issues

Using mongoose.createConnection instead of mongose.connect

Hi, I have some troubles with using your seeder. When I try to connect to mongodb, there is an error. which you can see in the applied screenshot. Maybe, it is better to use mongoose.createConnection instead of mongose.connect. Also, maybe there is more appropriate way to make the error warnings more informative? What do you think about it?
img-2017-05-07-14-59-55

Problem running inside docker-compose using volumes

Hello!

This is probably a bit too specific, but I wanted to ask here anyways. Perhaps other people have run into the same situation?

I am getting the following error when trying to run md-seed run inside a docker container. I am passing source code and mongoose models into the container via volumes

TypeError: this.connect is not a function
seed-docker |     at MdSeedRunner._callee2$ (/usr/local/lib/node_modules/mongoose-data-seed/dist/lib/core/md-seed-runner.js:171:29)

Error screenshot:

Screenshot from 2019-07-24 12-00-44

Here is my Dockerfile:

FROM node:11


ENV HOME=/home/seeduser/seed

COPY . $HOME

WORKDIR $HOME

RUN npm install -g mongoose-data-seed


CMD md-seed run --dropdb

Finally, docker-compose.yml:

version: "3"
services:
  seed:
    container_name: seed-docker
    # build: ./seed-docker    
    build:    
      context: .
      dockerfile: ./seed-docker/Dockerfile
    volumes:
      - /path/to/seed:/home/seeduser/seed/
      - /path/to/models:/home/seeduser/seed/models
    depends_on:
      - mongo
  mongo:
    container_name: mongo
    image: mongo
    ports:
      - "27017:27017"
    volumes:
      - data-volume:/data/db
    restart: always
    logging:
      driver: none
volumes:
  data-volume:

Not able to run seeders

I'm submitting aโ€ฆ

  • Regression (a behavior that used to work and stopped working in a new release)
  • Bug report
  • Feature request
  • Documentation issue or request
  • Support request

Expected Behavior

Current Behavior

node_modules/.bin/md-seed run --dropdb
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: md-seed-config.js
require() of ES modules is not supported.
require() of md-seed-config.js from node_modules/mongoose-data-seed/dist/lib/config.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename md-seed-config.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from package.json.

    at Module._extensions..js (internal/modules/cjs/loader.js:1080:13)
    at Object.newLoader [as .js] (node_modules/pirates/lib/index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.loadUserConfig (node_modules/mongoose-data-seed/dist/lib/config.js:127:12)
    at run (node_modules/mongoose-data-seed/dist/lib/commands/run/run.js:36:23)
    at _default (node_modules/mongoose-data-seed/dist/lib/commands/run/index.js:33:27)
    at runCommand (node_modules/mongoose-data-seed/dist/lib/commands/helpers.js:79:10) {
  code: 'ERR_REQUIRE_ESM'
}

Possible Solution

Steps to Reproduce (for bugs)

Environment

  • mongoose-data-seed version: 2.1.6
  • Node version: 14.13.1
  • NPM version: 6.14.8
  • Yarn version (if you use Yarn):
  • Operating system: Mac
  • Link to your project:

An in-range update of prettier is breaking the build ๐Ÿšจ

The devDependency prettier was updated from 1.18.2 to 1.19.0.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

prettier is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for Prettier 1.19: Long awaited Vue option, TypeScript 3.7 and new JavaScript features

diff

๐Ÿ”— Release Notes

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

md-seed command not found

Running the instructions from the readme,

npm install --save mongoose-data-seed
md-seed init

command not found: md-seed. Probably need to update the docs to install globally

An in-range update of babel7 is breaking the build ๐Ÿšจ

There have been updates to the babel7 monorepo:

    • The devDependency @babel/core was updated from 7.5.5 to 7.6.0.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the babel7 group definition.

babel7 is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

An in-range update of babel7 is breaking the build ๐Ÿšจ

There have been updates to the babel7 monorepo:

    • The devDependency @babel/core was updated from 7.5.5 to 7.6.0.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the babel7 group definition.

babel7 is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

Run command returns TypeError: Seeder is not a constructor

I'm trying to run $ md-seed run command, but receive TypeError:

TypeError: Seeder is not a constructor

I'm submitting aโ€ฆ

  • Regression (a behavior that used to work and stopped working in a new release)
  • Bug report
  • Feature request
  • Documentation issue or request
  • Support request

Expected Behavior

Seeder executed successfully.

Current Behavior

$ md-seed run

โœ” Successfully connected to MongoDB!

Seeding Results:
โœ– CountriesSeeder
TypeError: Seeder is not a constructor
    at MdSeedRunner._runSeeder (/home/test-app/node_modules/mongoose-data-seed/dist/lib/core/md-seed-runner.js:192:22)
    at MdSeedRunner._runSeeders (/home/test-app/node_modules/mongoose-data-seed/dist/lib/core/md-seed-runner.js:161:18)
    at MdSeedRunner._run (/home/test-app/node_modules/mongoose-data-seed/dist/lib/core/md-seed-runner.js:76:18)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)

Environment

  • mongoose-data-seed version: 2.1.3
  • Node version: v11.6.0
  • Yarn version: 1.17.3
  • Operating system: Linux

Cannot use ES6 imports in md-seed run command

I have babel packages installed in project and ES6 imports are working well, but they are not working in mongoose-data-seed.

Here are my Babel dependencies:

"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/node": "^7.5.5",
"@babel/preset-env": "^7.5.5",

I'm submitting aโ€ฆ

  • Regression (a behavior that used to work and stopped working in a new release)
  • Bug report
  • Feature request
  • Documentation issue or request
  • Support request

Expected Behavior

Run seeders.

Current Behavior

Throwing exception when running $ md-seed run

/home/test-app/md-seed-config.js:1
(function (exports, require, module, __filename, __dirname) { import mongoose from 'mongoose';
                                                                     ^^^^^^^^

SyntaxError: Unexpected identifier

Environment

  • mongoose-data-seed version: 2.1.3
  • Node version: v11.6.0
  • Yarn version: 1.17.3
  • Operating system: Linux

Docs

I'm submitting aโ€ฆ

  • Regression (a behavior that used to work and stopped working in a new release)
  • Bug report
  • Feature request
  • Documentation issue or request
  • Support request

Feature Request

It would be good to have better docs for this repo. Today I discovered that you can trigger two create in a single run by using an array, things like this could be nice to have it on a docs.

An in-range update of babel7 is breaking the build ๐Ÿšจ


๐Ÿšจ Reminder! Less than one month left to migrate your repositories over to Snyk before Greenkeeper says goodbye on June 3rd! ๐Ÿ’œ ๐Ÿšš๐Ÿ’จ ๐Ÿ’š

Find out how to migrate to Snyk at greenkeeper.io


There have been updates to the babel7 monorepo:

    • The devDependency @babel/cli was updated from 7.10.0 to 7.10.1.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the babel7 group definition.

babel7 is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v7.10.2

v7.10.2 (2020-05-30)

Thanks @fivetanley and @hamlim for their first PRs!

๐Ÿš€ New Feature

๐Ÿ› Bug Fix

  • babel-helper-compilation-targets
    • #11648 fix: don't mutate InputTarget's passed to @babel/helper-compilation-targets (@fivetanley)
  • babel-helper-create-class-features-plugin, babel-preset-env
  • babel-generator
  • babel-generator, babel-types
  • babel-plugin-syntax-module-attributes, babel-standalone
    • #11631 Fix moduleAttributesVersion errors with stage-0 preset in babel standalone (@hamlim)

๐Ÿ’… Polish

  • babel-core
    • #11643 fix: add new plugin names to missing plugin helpers (@JLHwung)

๐Ÿ  Internal

  • babel-parser
    • #11653 refactor: split locationParser into ParserErrors and error message (@JLHwung)

Committers: 6

Commits

The new version differs by 11 commits.

  • b0350e5 v7.10.2
  • b5c4a46 refactor: split locationParser into ParserErrors and error message (#11653)
  • 15d6da0 fix: don't mutate InputTarget's passed to @babel/helper-compilation-targets (#11648)
  • e6d873e Class features loose should have precedence over preset-env (#11634)
  • 5b24d79 fix: add bigIntSuffix to minified output (#11645)
  • 69198be feature: babel-eslint-parser passes through config options (#11639)
  • 6b7a6dc fix: add new plugin names to missing plugin helpers (#11643)
  • d7d36a6 Add support for printing ImportAttribute (#11641)
  • 8e41f26 Fix moduleAttributesVersion errors with stage-0 preset in babel standalone (#11631)
  • ddfdf00 Update CHANGELOG.md [skip ci]
  • 1b670c2 Add v7.10.1 to CHANGELOG.md [skip ci]

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

DeprecationWarning: collection.count is deprecated

The seeder generator generates code which uses Mongoose's collection.count method.

class UsersSeeder extends Seeder {
  async shouldRun() {
    return UserModel.count()
      .exec()
      .then(count => count === 0);
  }

  async run() {
    return UserModel.create(data);
  }
}

As of "mongoose": "^5.2.1", this method has been deprecated.

When run, that code gives the following warning:

DeprecationWarning: collection.count is deprecated, and will be removed in a future version. Use collection.countDocuments or collection.estimatedDocumentCount instead

An in-range update of eslint is breaking the build ๐Ÿšจ

The devDependency eslint was updated from 6.4.0 to 6.5.0.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v6.5.0
  • 73596cb Update: Add enforceForSwitchCase option to use-isnan (#12106) (Milos Djermanovic)
  • d592a24 Fix: exclude \u000d so new line won't convert to text (fixes #12027) (#12031) (zamboney)
  • e85d27a Fix: no-regex-spaces false positives and invalid autofix (fixes #12226) (#12231) (Milos Djermanovic)
  • b349bf7 Fix: prefer-named-capture-group incorrect locations (fixes #12233) (#12247) (Milos Djermanovic)
  • 7dc1ea9 Fix: no-useless-return autofix removes comments (#12292) (Milos Djermanovic)
  • 0e68677 Fix: no-extra-bind autofix removes comments (#12293) (Milos Djermanovic)
  • 6ad7e86 Fix: no-extra-label autofix removes comments (#12298) (Milos Djermanovic)
  • acec201 Fix: no-undef-init autofix removes comments (#12299) (Milos Djermanovic)
  • d89390b Fix: use async reading of stdin in bin/eslint.js (fixes #12212) (#12230) (Barrie Treloar)
  • 334ca7c Update: no-useless-rename also reports default values (fixes #12301) (#12322) (Kai Cataldo)
  • 41bfe91 Update: Fix handling of chained new expressions in new-parens (#12303) (Milos Djermanovic)
  • 160b7c4 Chore: add autofix npm script (#12330) (Kai Cataldo)
  • 04b6adb Chore: enable eslint-plugin-jsdoc (refs #11146) (#12332) (Kai Cataldo)
  • 9b86167 Docs: Add new ES environments to Configuring ESLint (#12289) (Milos Djermanovic)
  • c9aeab2 Docs: Add supported ECMAScript version to README (#12290) (Milos Djermanovic)
  • 8316e7b Fix: no-useless-rename autofix removes comments (#12300) (Milos Djermanovic)
  • 29c12f1 Chore: cache results in runtime-info (#12320) (Kai Cataldo)
  • f5537b2 Fix: prefer-numeric-literals autofix removes comments (#12313) (Milos Djermanovic)
  • 11ae6fc Update: Fix call, new and member expressions in no-extra-parens (#12302) (Milos Djermanovic)
  • a7894eb New: add --env-info flag to CLI (#12270) (Kai Cataldo)
  • 61392ff Sponsors: Sync README with website (ESLint Jenkins)
  • 2c6bf8e Docs: English fix (#12306) (Daniel Nixon)
  • 6f11877 Sponsors: Sync README with website (ESLint Jenkins)
  • 2e202ca Docs: fix links in array-callback-return (#12288) (Milos Djermanovic)
  • e39c631 Docs: add example for CLIEngine#executeOnText 3rd arg (#12286) (Kai Cataldo)
  • d4f9a16 Update: add support for JSXFragments in indent rule (fixes #12208) (#12210) (Kai Cataldo)
  • c6af95f Sponsors: Sync README with website (ESLint Jenkins)
  • 8cadd52 Sponsors: Sync README with website (ESLint Jenkins)
  • f9fc695 Chore: enable default-param-last (#12244) (่–›ๅฎš่ฐ”็š„็Œซ)
  • 9984c3e Docs: Update README team and sponsors (ESLint Jenkins)
Commits

The new version differs by 32 commits.

  • 76fb571 6.5.0
  • 7359a80 Build: changelog update for 6.5.0
  • 73596cb Update: Add enforceForSwitchCase option to use-isnan (#12106)
  • d592a24 Fix: exclude \u000d so new line won't convert to text (fixes #12027) (#12031)
  • e85d27a Fix: no-regex-spaces false positives and invalid autofix (fixes #12226) (#12231)
  • b349bf7 Fix: prefer-named-capture-group incorrect locations (fixes #12233) (#12247)
  • 7dc1ea9 Fix: no-useless-return autofix removes comments (#12292)
  • 0e68677 Fix: no-extra-bind autofix removes comments (#12293)
  • 6ad7e86 Fix: no-extra-label autofix removes comments (#12298)
  • acec201 Fix: no-undef-init autofix removes comments (#12299)
  • d89390b Fix: use async reading of stdin in bin/eslint.js (fixes #12212) (#12230)
  • 334ca7c Update: no-useless-rename also reports default values (fixes #12301) (#12322)
  • 41bfe91 Update: Fix handling of chained new expressions in new-parens (#12303)
  • 160b7c4 Chore: add autofix npm script (#12330)
  • 04b6adb Chore: enable eslint-plugin-jsdoc (refs #11146) (#12332)

There are 32 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

An in-range update of babel7 is breaking the build ๐Ÿšจ

There have been updates to the babel7 monorepo:

    • The devDependency @babel/core was updated from 7.6.4 to 7.7.0.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the babel7 group definition.

babel7 is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

Add the option to generate custom seeder template

When running md-seed g users, it will generate a seeder from a template provided by mongoose-data-seed.

It would be nice to add an option to the md-seed-generator.json so you can define your own seeder template.

An in-range update of core-js is breaking the build ๐Ÿšจ

The dependency core-js was updated from 3.4.6 to 3.4.7.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

core-js is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for 3.4.7 - 2019.12.03
  • Fixed an NPM publishing issue
FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

md-seed run command display an error.

Node Version: v10.12.0
npm version: 6.4.1
Mongo Version: MongoDB shell version v4.2.3

After run md-seed run command i get following error.

{ SyntaxError: /Applications/MAMP/htdocs/recat-partice/react_admin/md-seed-config.js: Support for the experimental syntax 'exportDefaultFrom' isn't currently enabled (12:8):

10 | * @type {Object}
11 | */

12 | export seedersList = {
| ^
13 | Users,
14 | Categorys
15 | };

Add @babel/plugin-proposal-export-default-from (https://git.io/vb4yH) to the 'plugins' section of your Babel config to enable transformation.
at Parser._raise (/Users/reivo/.nvm/versions/node/v10.12.0/lib/node_modules/mongoose-data-seed/node_modules/@babel/parser/lib/index.js:742:17)
at Parser.raiseWithData (/Users/reivo/.nvm/versions/node/v10.12.0/lib/node_modules/mongoose-data-seed/node_modules/@babel/parser/lib/index.js:735:17)
at Parser.expectPlugin (/Users/reivo/.nvm/versions/node/v10.12.0/lib/node_modules/mongoose-data-seed/node_modules/@babel/parser/lib/index.js:8762:18)
at Parser.maybeParseExportDefaultSpecifier (/Users/reivo/.nvm/versions/node/v10.12.0/lib/node_modules/mongoose-data-seed/node_modules/@babel/parser/lib/index.js:12199:12)
at Parser.parseExport (/Users/reivo/.nvm/versions/node/v10.12.0/lib/node_modules/mongoose-data-seed/node_modules/@babel/parser/lib/index.js:12151:29)
at Parser.parseStatementContent (/Users/reivo/.nvm/versions/node/v10.12.0/lib/node_modules/mongoose-data-seed/node_modules/@babel/parser/lib/index.js:11185:27)
at Parser.parseStatement (/Users/reivo/.nvm/versions/node/v10.12.0/lib/node_modules/mongoose-data-seed/node_modules/@babel/parser/lib/index.js:11081:17)
at Parser.parseBlockOrModuleBlockBody (/Users/reivo/.nvm/versions/node/v10.12.0/lib/node_modules/mongoose-data-seed/node_modules/@babel/parser/lib/index.js:11656:25)
at Parser.parseBlockBody (/Users/reivo/.nvm/versions/node/v10.12.0/lib/node_modules/mongoose-data-seed/node_modules/@babel/parser/lib/index.js:11642:10)
at Parser.parseTopLevel (/Users/reivo/.nvm/versions/node/v10.12.0/lib/node_modules/mongoose-data-seed/node_modules/@babel/parser/lib/index.js:11012:10)
loc: Position { line: 12, column: 7 },
pos: 293,
missingPlugin: [ 'exportDefaultFrom' ],
code: 'BABEL_PARSE_ERROR' }

Why i get the error will you explain?
Thanks.

run seeds programatically

is it possible to run the commands programmatically? On a quick glance it seems that run is only exposed through the binary.

Something like:

import { run } from 'mongoose-data-seed'
run('users', 'posts', 'comments').then(() => console.log('seeding done'))

Invalid Greenkeeper configuration file

We have detected a problem with your Greenkeeper config file ๐Ÿšจ

Greenkeeper currently canโ€™t work with your greenkeeper.json config file because it is invalid. We found the following issue:

  1. Could not parse greenkeeper.json, it appears to not be a valid JSON file.

Please correct this and commit the fix to your default branch (usually master). Greenkeeper will pick up your changes and try again. If in doubt, please consult the config documentation.

Hereโ€™s an example of a valid greenkeeper.json:

{
  "groups": {
    "frontend": {
      "packages": [
        "webapp/package.json",
        "cms/package.json",
        "analytics/package.json"
      ]
    },
    "build": {
      "packages": [
        "package.json"
      ]
    }
  },
  "ignore": [
    "standard",
    "eslint"
  ]
}

This files tells Greenkeeper to handle all dependency updates in two groups. All files in the frontend group will receive updates together, in one issue or PR, and the root-level package.json in the build group will be treated separately. In addition, Greenkeeper will never send updates for the standard and eslint packages.

๐Ÿค– ๐ŸŒด

An in-range update of mongoose is breaking the build ๐Ÿšจ

The dependency mongoose was updated from 5.6.8 to 5.6.9.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

mongoose is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 19 commits.

  • 188b4e7 chore: release 5.6.9
  • 347eeeb chore: add papersowl as sponsor
  • 379a807 style: fix lint
  • 4a84546 fix(schema): fix test failures from previous fix of #8034
  • 6149ba3 docs(index): add dcsl as sponsor
  • f47e936 fix(schema): allow declaring ObjectId array with { type: 'ObjectID' }, last 'D' case insensitive
  • bc71f25 test(schema): repro #8034
  • ad41e38 Merge branch 'master' of github.com:Automattic/mongoose
  • 9023f30 docs(guide): add missing further reading link and link to other tutorial
  • 419cfef Merge pull request #8048 from Fonger/fix/version-error-memory-leak
  • 612c4f9 chore: now working on 5.6.9
  • 4408e55 fix(cursor): correctly handle batchSize option with query cursor
  • eff168d test(query): repro #8039
  • b850278 fix(populate): handle virtual populate with count = 0 if virtual embedded in doc array
  • 548ab98 test(populate): repro #7573 part 2

There are 19 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

An in-range update of eslint is breaking the build ๐Ÿšจ

The devDependency eslint was updated from 6.1.0 to 6.2.0.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v6.2.0
  • fee6acb Update: support bigint and dynamic import (refs #11803) (#11983) (Toru Nagashima)
  • afd8012 New: noInlineConfig setting (refs eslint/rfcs#22) (#12091) (Toru Nagashima)
  • 3d12378 Update: Fix accessor-pairs to enforce pairs per property in literals (#12062) (Milos Djermanovic)
  • 8cd00b3 New: function-call-argument-newline (#12024) (finico)
  • 30ebf92 Fix: prefer-template autofix produces syntax error with octal escapes (#12085) (Milos Djermanovic)
  • 13c3988 Fix: Check literal type explicitly in dot-notation (#12095) (Milos Djermanovic)
  • 3e5ceca Fix: Handle empty string property names in getFunctionNameWithKind (#12104) (Milos Djermanovic)
  • 9a043ff Fix: no-duplicate-case false positives on Object.prototype keys (#12107) (Milos Djermanovic)
  • fe631af Chore: minor typo fix (#12112) (James George)
  • 4cb7877 Fix: fix no-extra-parens ignores some nodes (#11909) (Pig Fang)
  • 2dc23b8 Update: fix no-dupe-keys false negatives on empty string names (#12069) (Milos Djermanovic)
  • 19ab666 Fix: yoda exceptRange false positives on empty string property names (#12071) (Milos Djermanovic)
  • d642150 Update: Check empty string property names in sort-keys (#12073) (Milos Djermanovic)
  • acce6de Fix: class-methods-use-this reports 'undefined' names (#12103) (Milos Djermanovic)
  • 92ec2cb Fix: Allow bind call with a single spread element in no-extra-bind (#12088) (Milos Djermanovic)
  • bfdb0c9 Fix: no-extra-boolean-cast invalid autofix for Boolean() without args (#12076) (Milos Djermanovic)
  • 34ccc0c Chore: Remove TDZ scope type condition from no-unused-vars (#12055) (Milos Djermanovic)
  • 01d38ce Docs: Remove TDZ scope from the scope manager interface documentation (#12054) (Milos Djermanovic)
  • 1aff8fc Update: warn about mixing ternary and logical operators (fixes #11704) (#12001) (Karthik Priyadarshan)
  • 11be2f8 Docs: do not recommend global-installed usage (#12016) (่–›ๅฎš่ฐ”็š„็Œซ)
  • cf31dab Fix: no-restricted-syntax - correct the schema (#12051) (Brad Zacher)
  • fbec99e Update: fix class-methods-use-this false negatives with exceptMethods (#12077) (Milos Djermanovic)
  • fb08b7c Docs: Remove readonly/writable global logic from no-undef (fixes #11963) (#12053) (Milos Djermanovic)
  • 5b5934b Sponsors: Sync README with website (ESLint Jenkins)
  • 9156760 Sponsors: Sync README with website (ESLint Jenkins)
  • f5e0cc4 Update: Check computed method keys in no-extra-parens (#11973) (Milos Djermanovic)
  • d961438 Docs: Fix Incorrect Documentation (#12045) (Michael Miceli)
  • 887d08c Sponsors: Sync README with website (ESLint Jenkins)
  • d90183f Docs: add a case to func-names (#12038) (Chiawen Chen)
  • 8a5b62d Docs: no use eslint.linter in code example (#12037) (่–›ๅฎš่ฐ”็š„็Œซ)
  • 5831767 Update: report location of func-names (fixes #12022) (#12028) (Pig Fang)
Commits

The new version differs by 33 commits.

  • 320b7bd 6.2.0
  • 9601f5a Build: changelog update for 6.2.0
  • fee6acb Update: support bigint and dynamic import (refs #11803) (#11983)
  • afd8012 New: noInlineConfig setting (refs eslint/rfcs#22) (#12091)
  • 3d12378 Update: Fix accessor-pairs to enforce pairs per property in literals (#12062)
  • 8cd00b3 New: function-call-argument-newline (#12024)
  • 30ebf92 Fix: prefer-template autofix produces syntax error with octal escapes (#12085)
  • 13c3988 Fix: Check literal type explicitly in dot-notation (#12095)
  • 3e5ceca Fix: Handle empty string property names in getFunctionNameWithKind (#12104)
  • 9a043ff Fix: no-duplicate-case false positives on Object.prototype keys (#12107)
  • fe631af Chore: minor typo fix (#12112)
  • 4cb7877 Fix: fix no-extra-parens ignores some nodes (#11909)
  • 2dc23b8 Update: fix no-dupe-keys false negatives on empty string names (#12069)
  • 19ab666 Fix: yoda exceptRange false positives on empty string property names (#12071)
  • d642150 Update: Check empty string property names in sort-keys (#12073)

There are 33 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

Did it have any debug message when create seed failure?

Current when create seed failure it only have "X" icon and nothing message displayed.

Like that

Seeding Results:
โœ– Client
โœ– ResourceServer
โœ– User

Did it have any way to display message ? Like DEBUG=XXX or NODE_ENV=XXX something like ?

"md-seed" is not recognized as an internal or external command

Hi!

I've installed your npm package with Yarn on a Feathersjs platform.
After installation I tried to launch md-seed init but console continues to give me this error.

I tried also with NPM 5.6 but same error message appear.

Node: 8.9.1
Yarn: 1.3.2
Windows 10 64 bit

Mongoose 5 Compatibility

Hey there, Thanks for the extension.
Just wanted to inform you that I get this warning each time I run md-seed run and it's pretty obvious what it says. Maybe you could check mongoose version to see whether useMongoClient should be used or not. Oh and seeding still works though.

Here's the full error anyway:

WARNING: The `useMongoClient` option is no longer necessary in mongoose 5.x, please remove it.
    at handleUseMongoClient (/Users/masoud/Desktop/Work/peeker/proshat-workflows/node_modules/mongoose/lib/connection.js:506:17)
    at NativeConnection.Connection.openUri (/Users/masoud/Desktop/Work/peeker/proshat-workflows/node_modules/mongoose/lib/connection.js:407:7)
    at Mongoose.connect (/Users/masoud/Desktop/Work/peeker/proshat-workflows/node_modules/mongoose/lib/index.js:208:15)
    at /Users/masoud/.nvm/versions/node/v8.9.2/lib/node_modules/mongoose-data-seed/dist/bin/run/index.js:75:14
    at new Promise (<anonymous>)
    at run (/Users/masoud/.nvm/versions/node/v8.9.2/lib/node_modules/mongoose-data-seed/dist/bin/run/index.js:73:10)
    at exports.default (/Users/masoud/.nvm/versions/node/v8.9.2/lib/node_modules/mongoose-data-seed/dist/bin/run/index.js:24:10)
    at Object.<anonymous> (/Users/masoud/.nvm/versions/node/v8.9.2/lib/node_modules/mongoose-data-seed/dist/bin/index.js:55:27)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Function.Module.runMain (module.js:676:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3```

Combine the 2 md-seed config files or allow to define location on run

It seems a little overkill to require 2 config files for a seeder library at the root of a project. With an already way to many requirements of app, env, build, test files required at the project root can you at least combine the 2 file requirements into 1? i.e. md-seed-config.js has all the data required for your library?

If not, can you allow to define the config file location when running the md-seed command? i.e. md-seed --config='./server/seeds/seed-config.js'

Error: Cannot find module 'core-js/stable'

I'm submitting aโ€ฆ

  • Regression (a behavior that used to work and stopped working in a new release)
  • Bug report
  • Feature request
  • Documentation issue or request
  • Support request

Current Behavior

image

Environment

  • mongoose-data-seed version: 2.1.6
  • Node version: v14.15.4
  • Yarn version : 1.22.17
  • Operating system: Windows

Support for Typescript seeders or allow passing custom extension

Help on how to use this in a typescript project. The js files are tied to the package. Please is there a way to allow custom extension from the command.

I'm submitting aโ€ฆ

  • Regression (a behavior that used to work and stopped working in a new release)
  • Bug report
  • Feature request
  • Documentation issue or request
  • Support request

Expected Behavior

The command should allow passing a --ext=ts to specify the file extension we work with

Current Behavior

Currently only JS files are generated

Possible Solution

Changing this line in dist\utils\helpers.js to ts extension and I was able to use this for my project. If possible allow us pass a custom js or ts extension we want to use.

const normalizeSeederFileName = name => `${(0, _lodash.kebabCase)(name)}.seeder.ts`;

An in-range update of mongoose is breaking the build ๐Ÿšจ

The dependency mongoose was updated from 5.6.6 to 5.6.7.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

mongoose is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 21 commits.

  • 99c0366 chore: release 5.6.7
  • 0c4ab58 style: fix lint
  • 080c4c4 docs(query+lean): add links to mongoose-lean-virtuals, mongoose-lean-getters, mongoose-lean-defaults
  • 51bbec5 Merge branch 'master' of github.com:Automattic/mongoose
  • 3bf0bcc fix(timestamps): handle timestamps: false in child schema
  • 23d30e0 test(timestamps): repro #8007
  • ef95a51 Merge pull request #8022 from Mangosteen-Yang/patch-3
  • beab87a [docs] add example for issue #7803
  • cf938e2 Merge pull request #8015 from kolya182/update-nyc
  • dea5962 chore: peg exact version of nyc
  • 2fa506e Merge pull request #8013 from chrisweilacker/patch-2
  • de8d91a docs(mongoose): add example to mongoose constructor
  • 152a477 Update nyc. Fix vulns. Use https for homepage.
  • 3c21d23 Updated Schema.path to proper s.path
  • 54a0bb7 fix(document): support validators on nested arrays

There are 21 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

Incorrect installing v 2.1.0

When installing latest version (2.1.0) it looks like some of files are ignored. No templates folder, no bin attached, etc. Here is screenshot how it looks like inside of node_modules directory.
Screen Shot 2019-08-04 at 12 52 46 PM

Just use yarn add mongoose-data-seed

if i use yarn add [email protected] (previous version) works fine

Custom md-seed-config.js location

I were needed to wrap all sources to the src directory, so my Babel ignoring root directory where md-seed-config.js file is located. It would be great to have configurable config file location. I want to place config file to ./src/md-seed-config.js.

I'm submitting aโ€ฆ

  • Regression (a behavior that used to work and stopped working in a new release)
  • Bug report
  • Feature request
  • Documentation issue or request
  • Support request

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.