Socket
Socket
Sign inDemoInstall

sails-waterline-fixtures

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sails-waterline-fixtures

JSON fixtures for Sails.


Version published
Maintainers
1
Created
Source

sails-waterline-fixtures

JSON fixtures for Sails. Data automatically loaded, updated and checked every time after lift your sails app, or change in fixtures directory.

ROADMAP

  • load data from diffrent file types (JSON, JS, CSON, jsongen)
  • update exist-data on reloading
  • update data on changes in fixtures folder
  • add option disabled fixtures on production environment
  • Check that`s worked with relations
  • Time based data generator
  • Time based data infinite generator
  • Random time based data generator
  • Move documentation to wiki
  • Fixtures with timeout for controllers and Srvices

Howto

  1. Setup your models
  2. Edit your bootstrap.js
  3. Fill data
  4. sails lift

Bootstrap config

Simply call #init(config, callback), it will handle the rest.


var fixtures = require('sails-fixtures');

module.exports.bootstrap = function(next) {

  fixtures.init(next);

};

If you use nodemon or any other library for livereload server on change, and whant to use fixtures livereload feature, you will need to add your fixtures folder to .nodemonignore file.


echo "fixtures" >> .nodemonignore

Configuration

| Option name | Default value | Data type | Available values | |------------------------|---------------------------------------------------|-----------------------------| | dir | ${ process.cwd() }/fixtures | String | | reloadOnChange | true | Boolean | | formats | 'json' | String or Array of String | | updateOnRestart | true | Boolean | | preventOnProduction | true | Boolean |

Data format

Fixtures are loaded in parallel. Their contents are loaded in series in specified order.

Fixtures can be writen in different forma like

[
  {
    "model":"modelname",
    "items":[
      {
        "id":1,
        "attribute":"foo"
      },
      {
        "id":50,
        "attribute":"bar"
      }
    ]
  },
  {
    "model":"anothermodel",
    "items":[
      {
        "id":7,
        "name":"test"
      }
    ]
  }
]


Timeout fixtures

Infinite fixtures

Keywords

FAQs

Package last updated on 17 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc