Commit 37cd940e authored by Jure's avatar Jure

Merge branch 'fix_seed_script' into 'master'

fix: fix and simplify seed script

See merge request !53
parents 5da504b0 8dfa2d80
Pipeline #11778 passed with stages
in 7 minutes and 31 seconds
......@@ -11,13 +11,14 @@
"main": "app.js",
"dependencies": {
"@pubsweet/coko-theme": "^5.0.5",
"@pubsweet/db-manager": "^2.2.1",
"@pubsweet/db-manager": "2.2.0",
"@pubsweet/default-theme": "4.0.5",
"@pubsweet/logger": "^0.2.10",
"@pubsweet/model-blog": "^0.0.3",
"@pubsweet/model-blogpost": "^0.0.3",
"@pubsweet/model-team": "^1.0.2",
"@pubsweet/model-user": "^3.0.0",
"@pubsweet/models": "0.1.2",
"@pubsweet/ui": "^9.1.1",
"authsome": "^0.1.0",
"pubsweet": "^3.1.1",
......@@ -26,7 +27,7 @@
"pubsweet-component-password-reset-backend": "^2.0.1",
"pubsweet-component-password-reset-frontend": "^3.0.5",
"pubsweet-component-signup": "^1.0.39",
"pubsweet-server": "^12.0.0",
"pubsweet-server": "12.0.1",
"react-router-redux": "next"
},
"devDependencies": {
......
#!/usr/bin/env node
const logger = require('@pubsweet/logger')
const { Collection, Fragment, User } = require('pubsweet-server/src/models')
const { Collection, User } = require('@pubsweet/models')
const { setupDb } = require('@pubsweet/db-manager')
const seed = async () => {
......@@ -23,44 +23,10 @@ const seed = async () => {
title: 'My Blog',
owners: [user.id],
})
await collection.save()
const fragment1 = await new Fragment({
title: 'A great paper',
authors: ['Yannis Barlas', 'Adam Hyde'],
owners: [user.id],
}).save()
const fragment2 = await new Fragment({
title: 'A magnificent paper',
authors: ['Alex Theg', 'Ana Ellis'],
owners: [user.id],
}).save()
const fragment3 = await new Fragment({
title: 'A superb paper',
authors: ['Charlie Rutter', 'Carly Strauss'],
owners: [user.id],
}).save()
const fragment4 = await new Fragment({
title: 'A fantastic paper',
authors: ['Alisson Zulowski', 'John Chodaki'],
owners: [user.id],
}).save()
// const fragment2 = await new Fragment({
// title: 'My second post',
// owners: [user.id],
// }).save()
collection.addFragment(fragment1)
collection.addFragment(fragment2)
collection.addFragment(fragment3)
collection.addFragment(fragment4)
await collection.save()
logger.info('Seeding complete.')
logger.info('Seeding complete. Kill this script with Ctrl-C.')
}
seed()
......@@ -175,7 +175,21 @@
typeface-fira-sans-condensed "^0.0.54"
typeface-vollkorn "^0.0.54"
"@pubsweet/db-manager@^2.2.1", "@pubsweet/db-manager@^2.2.2":
"@pubsweet/db-manager@2.2.0":
version "2.2.0"
resolved "https://registry.yarnpkg.com/@pubsweet/db-manager/-/db-manager-2.2.0.tgz#ba7ed9a7d857107e1c663ec2338804f1bb0d388e"
integrity sha512-7dDv+SxijmUKKuo805GlmYlikKJcTQbCOgG4rqg8MNxTwdQ0aP0qdvAPgdZnvLNhWltPRY2KB4ddCuJGhzzxjw==
dependencies:
"@pubsweet/logger" "^0.2.9"
fs-extra "^4.0.2"
isomorphic-fetch "^2.2.1"
joi "^14.3.0"
objection "^1.3.0"
pg "^7.4.1"
tmp "^0.0.33"
umzug "^2.1.0"
"@pubsweet/db-manager@^2.2.2":
version "2.2.2"
resolved "https://registry.yarnpkg.com/@pubsweet/db-manager/-/db-manager-2.2.2.tgz#d8a1a3069321c5e56113afcc77a9bc848dd71239"
integrity sha512-drmMil+GI66pyBuwGrqjF4dt2Qdx9ZLY1BIzjpNuVPb6AuTGHe+KBgGVitIOk9Dd0HkzEd0edUGP0aZU/fihQg==
......@@ -218,6 +232,15 @@
joi "^14.3.0"
lodash "^4.17.4"
"@pubsweet/logger@^0.2.9":
version "0.2.17"
resolved "https://registry.yarnpkg.com/@pubsweet/logger/-/logger-0.2.17.tgz#0c1d64442a0db338f205bdb0e854f55604aa6818"
integrity sha512-Qy/IaLc/CfjZmEdNMKP3aEqFnAmnw5GiEtPwHMQaojO69SBwdDHydXyI4fq0sb2k9kknBM5vVoAVfDcBYXThbg==
dependencies:
config "^3.0.1"
joi "^14.3.0"
lodash "^4.17.4"
"@pubsweet/model-blog@^0.0.3":
version "0.0.3"
resolved "https://registry.yarnpkg.com/@pubsweet/model-blog/-/model-blog-0.0.3.tgz#5eedc16a569753da17fcfc67dfda6c8fcc2604ad"
......@@ -282,7 +305,7 @@
passport-http-bearer "^1.0.1"
passport-local "^1.0.0"
"@pubsweet/models@^0.1.1", "@pubsweet/models@^0.1.2":
"@pubsweet/models@0.1.2", "@pubsweet/models@^0.1.1", "@pubsweet/models@^0.1.2":
version "0.1.2"
resolved "https://registry.yarnpkg.com/@pubsweet/models/-/models-0.1.2.tgz#91501225af43498d60d77bda155b1de0631c2b46"
integrity sha512-qkZbQf07pjiehlJdKYqXkWtdp8ytJirVvYadF1ASavByJvipQ0Nzl6zcrAIMBqu7GgbsPmke+6yoMv+gC/RO0g==
......@@ -8370,7 +8393,7 @@ prompt@^1.0.0:
utile "0.3.x"
winston "2.1.x"
"prompt@github:flatiron/prompt#1c95d1d8d333b5fbc13fa5f0619f3dcf0d514f87":
prompt@flatiron/prompt#1c95d1d8d333b5fbc13fa5f0619f3dcf0d514f87:
version "1.0.0"
resolved "https://codeload.github.com/flatiron/prompt/tar.gz/1c95d1d8d333b5fbc13fa5f0619f3dcf0d514f87"
dependencies:
......@@ -8534,7 +8557,7 @@ pubsweet-component-signup@^1.0.39:
redux "^3.7.2"
redux-form "^7.4.2"
pubsweet-server@^12.0.0, pubsweet-server@^12.0.1:
pubsweet-server@12.0.1, pubsweet-server@^12.0.1:
version "12.0.1"
resolved "https://registry.yarnpkg.com/pubsweet-server/-/pubsweet-server-12.0.1.tgz#25654aa35246d593d5c9882d7e576b7c8afa9dda"
integrity sha512-PqzC20lOVwMa+xnz5l33DnztQ9wZIOIIacgCL4MVkbgO6BL4ilF0fE/wY4IwnP5xnKQ2ceGfUKxWvUfNAxL/Wg==
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment