npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

periodicjs.ext.dbseed

v10.4.2

Published

An extension for seeding db with data

Downloads

253

Readme

periodicjs.ext.dbseed Coverage Status Build Status

An extension that exports data in seed format and imports data in seed format to your periodic application.

API Documentation

Usage

Importing Data

You can import data using CLI

$ cd path/to/application/root
### Using the CLI
$ periodicjs ext periodicjs.ext.dbseed import path/to/seed/file.json 
### Calling Manually
$ node index.js --cli --command --ext --name=periodicjs.ext.dbseed --task=import --args=path/to/seed/file.json

Exporting Data

You can export data using CLI

$ cd path/to/application/root
### Using the CLI
$ periodicjs ext periodicjs.ext.dbseed export path/to/seed/file.json 
### Calling Manually
$ node index.js --cli --command --ext --name=periodicjs.ext.dbseed --task=export --args=path/to/seed/file.json

Configuration

You can configure DB Seed to exclude core datas in your database during the import and export process.

You can also configure how many core data documents are permitted in a file before it's split into a new file.

Customized import and export transforms are coming soon.

Default Configuration

{
  settings: {
    defaults: true,
    export: {
      ignore_core_datas: [ 'configuration', 'extension' ],
      split_count:1000,
    },
    import: {
      ignore_core_datas: [ 'configuration', 'extension' ],
    },
  },
  databases: {
  },
};

Seed Format

The seed format is an array of data to import into any configured core data database (SQL, Mongo, Loki, etc). Regardless of the underlying database, the format for seeds are the name.

A seed is comprised of a core data name, and core data documents, the combination of { core-data-name: [core data documents] } is what is referred to as a seed.

A seed file contains an array of seeds:

//example seed file
[
   {
     standard_item:[
       {
         "_id": 1,
         "title": "doc1"
       },
       {
         "_id": 2,
         "title": "doc2"
       },
       {
         "_id": 3,
         "title": "doc3"
       }
     ]
   },
   {
     standard_item:[
       {
         "_id": 4,
         "title": "doc4"
       },
       {
         "_id": 5,
         "title": "doc5"
       },
       {
         "_id": 6,
         "title": "doc6"
       }
     ]
   },
   {
     standard_user:[
       {
         "_id": 1,
         "email": "[email protected]"
       },
       {
         "_id": 2,
         "email": "[email protected]"
       },
       {
         "_id": 3,
         "email": "[email protected]"
       }
     ]
   }
 ]

Example data

There's a sample seed document in periodicjs.ext.dbseed/examples/exampleseed.json that you can use to seed your database.

$ periodicjs extension periodicjs.ext.dbseed import node_modules/periodicjs.ext.dbseed/examples/exampleseed.json 

Installation

Installing the Extension

Install like any other extension, run npm run install periodicjs.ext.dbseed from your periodic application root directory and then normally you would run periodicjs addExtension periodicjs.ext.dbseed but this is handled by npm post install.

$ cd path/to/application/root
$ npm run install periodicjs.ext.dbseed
$ periodicjs addExtension periodicjs.ext.dbseed //handled by post install npm script

Uninstalling the Extension

Run npm run uninstall periodicjs.ext.dbseed from your periodic application root directory and then normally you would run periodicjs removeExtension periodicjs.ext.dbseed but this is handled by npm post uninstall.

$ cd path/to/application/root
$ npm run uninstall periodicjs.ext.dbseed
$ periodicjs removeExtension periodicjs.ext.dbseed //handled by post uninstall npm script

Testing

Make sure you have grunt installed

$ npm install -g grunt-cli

Then run grunt test or npm test

$ grunt test && grunt coveralls #or locally $ npm test

For generating documentation

$ grunt doc
$ jsdoc2md commands/**/*.js config/**/*.js controllers/**/*.js  transforms/**/*.js utilities/**/*.js index.js > doc/api.md

##Notes

  • Check out https://github.com/typesettin/periodicjs for the full Periodic Documentation