Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/westtrade/sails-waterline-fixtures
JSON fixtures for Sails.
https://github.com/westtrade/sails-waterline-fixtures
Last synced: 1 day ago
JSON representation
JSON fixtures for Sails.
- Host: GitHub
- URL: https://github.com/westtrade/sails-waterline-fixtures
- Owner: westtrade
- License: mit
- Created: 2015-12-16T08:18:02.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-17T22:56:21.000Z (almost 9 years ago)
- Last Synced: 2024-11-02T04:33:51.085Z (14 days ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# sails-waterline-fixtures
[![Codacy](https://img.shields.io/codacy/6842498f08bb440b9e927ae454bdcd3f.svg)](https://www.codacy.com/app/westtrade/sails-waterline-fixtures)
[![Build Status](https://img.shields.io/travis/westtrade/sails-waterline-fixtures.svg?style=flat)](https://travis-ci.org/westtrade/sails-waterline-fixtures)
[![NPM version](https://img.shields.io/npm/v/sails-waterline-fixtures.svg?style=flat)](http://badge.fury.io/js/sails-waterline-fixtures)
[![Dependency Status](https://gemnasium.com/westtrade/sails-waterline-fixtures.svg?style=flat)](https://gemnasium.com/westtrade/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.
```javascript
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.
```bash
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
```json
[
{
"model":"modelname",
"items":[
{
"id":1,
"attribute":"foo"
},
{
"id":50,
"attribute":"bar"
}
]
},
{
"model":"anothermodel",
"items":[
{
"id":7,
"name":"test"
}
]
}
]```
### Timeout fixtures
### Infinite fixtures