Remove nonprofits seeding procedures
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
"url": "https://github.com/freecodecamp/freecodecamp.git"
|
"url": "https://github.com/freecodecamp/freecodecamp.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"only-once": "npm run create-rev && echo '\n\nseeding database\n\n' && node seed && node seed/nonprofits && echo",
|
"only-once": "npm run create-rev && echo '\n\nseeding database\n\n' && node seed && echo '\n\nSeeding Completed\n\n'",
|
||||||
"create-rev": "node -e \"console.log('\\n\\ncreating manifest\\n\\n'); require('fs').writeFileSync('server/rev-manifest.json', '{}');\"",
|
"create-rev": "node -e \"console.log('\\n\\ncreating manifest\\n\\n'); require('fs').writeFileSync('server/rev-manifest.json', '{}');\"",
|
||||||
"build": "NODE_ENV=production gulp build -p",
|
"build": "NODE_ENV=production gulp build -p",
|
||||||
"start": "babel-node server/server.js",
|
"start": "babel-node server/server.js",
|
||||||
@ -14,12 +14,11 @@
|
|||||||
"start-production": "node pm2Start",
|
"start-production": "node pm2Start",
|
||||||
"lint": "npm run lint-js && npm run lint-json",
|
"lint": "npm run lint-js && npm run lint-json",
|
||||||
"lint-challenges": "jsonlint -q seed/challenges/**/*.json",
|
"lint-challenges": "jsonlint -q seed/challenges/**/*.json",
|
||||||
"lint-nonprofits": "jsonlint -q seed/nonprofits.json",
|
|
||||||
"lint-server": "jsonlint -q server/*.json",
|
"lint-server": "jsonlint -q server/*.json",
|
||||||
"lint-resources": "jsonlint -q server/resources/*.json",
|
"lint-resources": "jsonlint -q server/resources/*.json",
|
||||||
"lint-utils": "jsonlint -q server/utils/*.json",
|
"lint-utils": "jsonlint -q server/utils/*.json",
|
||||||
"lint-js": "eslint --ext=.js,.jsx server/ common/ config/ client/",
|
"lint-js": "eslint --ext=.js,.jsx server/ common/ config/ client/",
|
||||||
"lint-json": "npm run lint-server && npm run lint-nonprofits && npm run lint-challenges && npm run lint-resources && npm run lint-utils",
|
"lint-json": "npm run lint-server && npm run && npm run lint-challenges && npm run lint-resources && npm run lint-utils",
|
||||||
"test-challenges": "babel-node seed/test-challenges.js | tap-spec",
|
"test-challenges": "babel-node seed/test-challenges.js | tap-spec",
|
||||||
"pretest": "npm run lint",
|
"pretest": "npm run lint",
|
||||||
"test": "npm run test-challenges"
|
"test": "npm run test-challenges"
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
/* eslint-disable no-process-exit */
|
|
||||||
require('babel/register');
|
|
||||||
require('dotenv').load();
|
|
||||||
|
|
||||||
var Rx = require('rx');
|
|
||||||
var app = require('../server/server');
|
|
||||||
|
|
||||||
var Nonprofits = app.models.Nonprofit;
|
|
||||||
var nonprofits = require('./nonprofits.json');
|
|
||||||
var destroy = Rx.Observable.fromNodeCallback(Nonprofits.destroyAll, Nonprofits);
|
|
||||||
var create = Rx.Observable.fromNodeCallback(Nonprofits.create, Nonprofits);
|
|
||||||
|
|
||||||
destroy()
|
|
||||||
.flatMap(function() {
|
|
||||||
if (!nonprofits) {
|
|
||||||
return Rx.Observable.throw(new Error('No nonprofits found'));
|
|
||||||
}
|
|
||||||
return create(nonprofits);
|
|
||||||
})
|
|
||||||
.subscribe(
|
|
||||||
function(nonprofits) {
|
|
||||||
console.log('successfully saved %d nonprofits', nonprofits.length);
|
|
||||||
},
|
|
||||||
function(err) { throw err; },
|
|
||||||
function() {
|
|
||||||
console.log('nonprofit seed completed');
|
|
||||||
process.exit(0);
|
|
||||||
}
|
|
||||||
);
|
|
Reference in New Issue
Block a user