Commit 7ead4392 authored by Jure's avatar Jure

Merge branch 'cli-refactor' into 'master'

Cli refactor

See merge request !7
parents 09d307b6 3df4a9b7
Pipeline #2376 failed with stage
in 32 minutes and 15 seconds
# PubSweet App
Welcome to the skeleton application!
## Quickstart
```bash
cd my-app-name
pubsweet setupdb (or npm run setupdb)
pubsweet start (or npm start)
```
## Customising the skeleton application
- Change `name` in `package.json` to your desired name
- Modify app config in the `/config` directory and webpack config in `/webpack`.
- Run `pubsweet add <components>` or `pubsweet remove <components>` to add or remove components. Mount these components on routes in `app/routes.jsx`
- Rewrite this README!
module.exports = {
'pubsweet-server': {
dbPath: 'PUBSWEET_DB',
sse: 'PUBSWEET_SSE'
}
}
......@@ -2,10 +2,13 @@ const path = require('path')
const blogmode = require('authsome/src/modes/blog')
const Joi = require('joi')
const logger = require('winston')
module.exports = {
'pubsweet-server': {
dbPath: process.env.PUBSWEET_DB || path.join(__dirname, '..', 'api', 'db'),
sse: process.env.PUBSWEET_SSE
dbPath: path.join(__dirname, '..', 'api', 'db', 'development'),
logger,
API_ENDPOINT: '/api'
},
authsome: {
mode: blogmode,
......
const config = require('./default.js')
module.exports = config
const config = require('./default.js')
const path = require('path')
module.exports = config
module.exports = {
'pubsweet-server': {
dbPath: path.join(__dirname, '..', 'api', 'db', 'production')
}
}
const config = require('./default.js')
const path = require('path')
module.exports = config
module.exports = {
'pubsweet-server': {
dbPath: path.join(__dirname, '..', 'api', 'db', 'test')
}
}
......@@ -24,7 +24,7 @@
"pubsweet-component-signup": "^0.4.0",
"pubsweet-component-teams-manager": "^0.2.1",
"pubsweet-component-users-manager": "^0.2.1",
"pubsweet-server": "1.0.0-alpha.2",
"pubsweet-server": "git+https://git@gitlab.coko.foundation/pubsweet/pubsweet-server.git",
"pubsweet-theme-plugin": "^0.0.1",
"react-router-redux": "next"
},
......@@ -75,9 +75,8 @@
},
"scripts": {
"lint": "eslint app test webpack",
"start": "node src/scripts/start.js",
"start": "pubsweet start",
"setupdb": "pubsweet setupdb",
"pubsweet": "pubsweet",
"test": "jest"
},
"jest": {
......
......@@ -2,28 +2,22 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 1200000
const logger = require('@pubsweet/logger')
const fixtures = require('./fixtures')
const dbconfig = fixtures.dbconfig
const dbConfig = fixtures.dbconfig
const flow = require('./helpers/flow')
const pubsweet = require('./helpers/pubsweet')
const dbManager = require('@pubsweet/db-manager')
const start = require('pubsweet/src/start/index.js')
describe('start', () => {
let server
beforeAll(async (done) => {
try {
await require('../src/scripts/generate-env')()
await require('../src/scripts/newdb')({
properties: require('../src/scripts/db-properties'),
override: dbconfig
})
await dbManager.setupDb(dbConfig)
logger.info('Starting server')
require('../src/scripts/start')(_server => {
server = _server
logger.info('Server started')
done()
})
server = await start()
logger.info('Server started')
done()
} catch (e) {
done.fail(e)
}
......@@ -45,12 +39,12 @@ describe('start', () => {
it('should allow admin to log in', async () => {
const promise = flow()
.use(pubsweet.login(dbconfig))
.use(pubsweet.login(dbConfig))
.waitForUrl(/manage.posts/)
.wait('nav')
.evaluate(() => document.querySelector('h2').innerText)
.end()
await expect(promise).resolves.toBe(dbconfig.collection)
await expect(promise).resolves.toBe(dbConfig.collection)
})
})
This diff is collapsed.
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