Commit fc818c93 authored by Alexandros Georgantas's avatar Alexandros Georgantas

chore(app): application upgrade

parent 4a44ab14
**/_build
**/node_modules
**/coverage
**/dist
......@@ -13,3 +13,7 @@ uploads/*
yarn-error.log
data
scripts/link.sh
epubcheck_data/*
epubcheck_log/*
epubchecker_data/*
epubchecker_log/*
\ No newline at end of file
{
"linters": {
"*.{js,jsx}": ["prettier --write", "eslint --fix", "stylelint", "git add"]
},
ignore: ["**/CHANGELOG.md"]
"*.{js,jsx}": ["prettier --write", "eslint --fix", "git add"],
"*.{json,md,css,scss}": ["prettier --write", "git add"]
}
......@@ -4,11 +4,19 @@
"@babel/preset-react"
],
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-json-strings",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
"@babel/plugin-proposal-function-sent",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions",
"@babel/plugin-proposal-class-properties"
"@babel/plugin-proposal-throw-expressions"
]
}
......@@ -3,11 +3,10 @@ import { css } from 'styled-components'
export default css`
margin-left: auto;
margin-right: auto;
width: 150px;
margin-top: 20px;
width: 100px;
img {
filter: grayscale(100%);
margin-bottom: 30px;
margin-top: 30px;
max-width: 100%;
}
`
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<div id="root"></div>
</body>
</html>
......@@ -2,6 +2,9 @@
<html>
<head>
<meta charset="utf-8">
<link rel="icon"
type="image/png"
href="/assets/favicon.png">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
......
......@@ -2,9 +2,13 @@
<html>
<head>
<meta charset="utf-8">
<link rel="icon"
type="image/png"
href="/assets/favicon.png">
<title>Editoria</title>
</head>
<body>
<div id="root"></div>
<script type="text/javascript" charset="utf-8" src="/assets/app.js"></script>
<script type="text/javascript" charset="utf-8" src="/assets/js/bundle.js"></script>
</body>
</html>
......@@ -10,7 +10,7 @@ import GlobalTeamsManager from 'pubsweet-component-editoria-global-teams/src/Con
import Login from 'editoria-component-login/src/LoginContainer'
import Signup from 'editoria-component-signup/src/SignupContainer'
import UserProfile from 'pubsweet-component-editoria-user-profile/src/ConnectedUserProfile'
import PasswordReset from 'pubsweet-component-password-reset-frontend/PasswordReset'
import PasswordReset from '@pubsweet/component-password-reset-client'
// Editor
import Wax from 'pubsweet-component-wax/src/ConnectedWax'
......@@ -70,15 +70,11 @@ export default (
<Redirect exact path="/" to="/books" />
<Route
path="/login"
render={props => (
<Login {...props} logo="/assets/pubsweet-rgb-small.jpg" />
)}
render={props => <Login {...props} logo="/assets/editoria.png" />}
/>
<Route
path="/signup"
render={props => (
<Signup {...props} logo="/assets/pubsweet-rgb-small.jpg" />
)}
render={props => <Signup {...props} logo="/assets/editoria.png" />}
/>
<Route component={PasswordReset} path="/password-reset" />
<PageLayout>
......@@ -107,7 +103,6 @@ export default (
exact
path="/books/:bookId/bookComponents/:bookComponentId/preview"
/>
{/* <PrivateRoute component={UsersManager} path="/users" /> */}
<PrivateRoute component={GlobalTeamsManager} path="/globalTeams" />
</Switch>
</Page>
......
[
"@pubsweet/model-user",
"@pubsweet/model-team",
"@pubsweet/model-fragment",
"@pubsweet/job-xsweet",
"pubsweet-component-password-reset-backend",
"pubsweet-component-password-reset-frontend",
"@pubsweet/component-password-reset-server",
"pubsweet-component-vivliostyle-viewer",
"pubsweet-component-pagedjs-viewer",
"pubsweet-component-wax",
"pubsweet-component-theme-editoria",
"editoria-component-login",
"editoria-component-signup",
"editoria-data-model/src/applicationParameter",
......@@ -31,4 +27,4 @@
"pubsweet-component-editoria-templates",
"editoria-api",
"editoria-file-server"
]
\ No newline at end of file
]
version: '3'
services:
language-tool:
image: silviof/docker-languagetool
restart: always
ports:
- ${LANGUAGE_PORT}:8010
job-xsweet:
image: pubsweet/job-xsweet
build:
context: https://gitlab.coko.foundation/pubsweet/pubsweet.git#xsweet-docker
dockerfile: components/server/job-xsweet/Dockerfile
args:
WAIT_SERVICE_PORT: ${POSTGRES_HOST}:${POSTGRES_PORT}
restart: always
container_name: job-xsweet
hostname: job-xsweet
environment:
- DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
job-epubcheck:
image: editoria/job-epubcheck
build:
context: https://gitlab.coko.foundation/editoria/editoria.git
dockerfile: packages/job-epubcheck/Dockerfile
args:
WAIT_SERVICE_PORT: ${POSTGRES_HOST}:${POSTGRES_PORT}
restart: always
container_name: job-epubcheck
hostname: job-epubcheck
environment:
- DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
volumes:
- ./uploads:/uploads/
job-pandoc:
image: editoria/job-pandoc
build:
context: https://gitlab.coko.foundation/editoria/editoria.git
dockerfile: packages/job-pandoc/Dockerfile
args:
WAIT_SERVICE_PORT: ${POSTGRES_HOST}:${POSTGRES_PORT}
restart: always
container_name: job-pandoc
hostname: job-pandoc
environment:
- DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
volumes:
- ./uploads:/uploads/
job-pdf:
image: editoria/job-pdf
build:
context: https://gitlab.coko.foundation/editoria/editoria.git
dockerfile: packages/job-pdf/Dockerfile
args:
WAIT_SERVICE_PORT: ${POSTGRES_HOST}:${POSTGRES_PORT}
restart: always
container_name: job-pdf
hostname: job-pdf
security_opt:
- seccomp:seccomp.json
environment:
- DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
volumes:
- ./uploads:/uploads/
# postgres:
# image: postgres:10-alpine
# restart: always
# container_name: postgres
# hostname: postgres
# ports:
# - ${POSTGRES_PORT}:5432
# expose:
# - ${POSTGRES_PORT}
# environment:
# - POSTGRES_USER
# - POSTGRES_DB
# - POSTGRES_PASSWORD
# - POSTGRES_PORT
# volumes:
# - ./database/data:/var/lib/postgresql/data
\ No newline at end of file
......@@ -18,61 +18,41 @@
"license": "MIT",
"version": "2.0.7",
"dependencies": {
"@apollo/react-hooks": "^3.0.0",
"@pubsweet/coko-theme": "^5.0.7",
"@pubsweet/db-manager": "3.0.7",
"@pubsweet/job-xsweet": "1.2.9",
"@pubsweet/logger": "^0.2.21",
"@pubsweet/model-fragment": "3.0.8",
"@pubsweet/model-team": "2.0.8",
"@pubsweet/model-user": "4.0.8",
"@pubsweet/ui": "^10.3.0",
"@pubsweet/ui-toolkit": "^2.2.0",
"@pubsweet/coko-theme": "^5.1.22",
"@pubsweet/component-password-reset-client": "^3.1.21",
"@pubsweet/component-password-reset-server": "^2.2.5",
"@pubsweet/db-manager": "3.1.5",
"@pubsweet/logger": "^0.2.40",
"@pubsweet/ui": "^12.3.1",
"@pubsweet/ui-toolkit": "^2.2.19",
"authsome": "^0.1.0",
"codemirror": "^5.45.0",
"cypress": "^3.3.0",
"editoria-api": "^0.4.7",
"editoria-common": "^0.2.0",
"editoria-component-login": "^1.3.1",
"editoria-component-signup": "^1.1.3",
"editoria-data-model": "^0.3.1",
"editoria-file-server": "^0.1.1",
"formik": "^1.5.1",
"highlight.js": "^9.13.1",
"editoria-api": "^0.5.1",
"editoria-common": "^0.2.3",
"editoria-component-login": "^1.3.3",
"editoria-component-signup": "^1.1.5",
"editoria-data-model": "^0.3.3",
"editoria-file-server": "^0.1.2",
"history": "^4.7.2",
"lodash": "4.17.4",
"lodash": "^4.17.15",
"nodemon": "^1.19.1",
"pagedjs": "0.1.34",
"pagedjs-cli": "0.0.9",
"path-to-regexp": "^2.4.0",
"prop-types": "^15.6.0",
"pubsweet": "^4.1.2",
"pubsweet-client": "^9.2.3",
"pubsweet-component-bookbuilder": "^1.5.3",
"pubsweet-component-editoria-dashboard": "^0.3.3",
"pubsweet-component-editoria-global-teams": "^0.2.6",
"pubsweet-component-editoria-navigation": "^0.3.0",
"pubsweet-component-editoria-templates": "^0.2.0",
"pubsweet-component-pagedjs-viewer": "^0.1.2",
"pubsweet-component-editoria-user-profile": "^0.1.0",
"pubsweet-component-password-reset-backend": "2.0.3",
"pubsweet-component-password-reset-frontend": "3.0.7",
"pubsweet-component-theme-editoria": "^0.0.5",
"pubsweet-component-users-manager": "^3.0.0",
"pubsweet": "^5.1.8",
"pubsweet-client": "^10.1.5",
"pubsweet-component-bookbuilder": "^1.5.7",
"pubsweet-component-editoria-dashboard": "^0.3.6",
"pubsweet-component-editoria-global-teams": "^0.2.9",
"pubsweet-component-editoria-navigation": "^0.3.3",
"pubsweet-component-editoria-templates": "^0.2.3",
"pubsweet-component-editoria-user-profile": "^0.1.3",
"pubsweet-component-pagedjs-viewer": "^0.1.3",
"pubsweet-component-vivliostyle-viewer": "^1.0.2",
"pubsweet-component-wax": "^0.11.4",
"pubsweet-server": "^13.7.2",
"pubsweet-theme-plugin": "^0.0.3",
"react": "^16.2.0",
"react-beautiful-dnd": "^10.0.4",
"react-codemirror2": "^5.1.0",
"react-dom": "^16.2.0",
"react-modal": "^3.8.1",
"react-router-dom": "^5.0.0",
"recompose": "^0.26.0",
"styled-components": "^4.1.2",
"typeface-fira-sans": "^0.0.43",
"waait": "^1.0.2"
"pubsweet-component-wax": "^0.11.8",
"pubsweet-server": "^13.9.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-router-dom": "^5.1.2",
"styled-components": "^4.1.3"
},
"devDependencies": {
"@babel/core": "^7.0.0",
......@@ -90,74 +70,57 @@
"@commitlint/cli": "^6.0.5",
"@commitlint/config-conventional": "^6.0.4",
"app-module-path": "^2.2.0",
"autobind-decorator": "^1.3.4",
"babel-eslint": "^9.0.0",
"babel-jest": "^23.4.2",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.0",
"babel-preset-es2015-native-modules": "^6.9.4",
"babel-preset-minify": "^0.3.0",
"babili-webpack-plugin": "^0.0.11",
"bootstrap-sass": "^3.3.7",
"clean-webpack-plugin": "^0.1.17",
"babel-preset-minify": "^0.5.0",
"commitizen": "^2.9.6",
"compression-webpack-plugin": "^1.1.6",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.4",
"compression-webpack-plugin": "^2.0.0",
"copy-webpack-plugin": "^5.0.2",
"css-loader": "^2.1.1",
"cz-conventional-changelog": "^2.1.0",
"enzyme": "^2.7.1",
"enzyme-to-json": "^1.4.5",
"eslint": "^4.13.1",
"eslint": "^4.17.0",
"eslint-config-pubsweet": "^0.0.6",
"eslint-loader": "^1.6.0",
"eslint-plugin-cypress": "^2.2.1",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jest": "^21.4.2",
"eslint-plugin-jest": "^21.9.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-prettier": "^2.3.1",
"eslint-plugin-node": "^6.0.0",
"eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-react": "^7.4.0",
"eslint-plugin-react": "^7.6.1",
"eslint-plugin-standard": "^3.0.1",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"faker": "^4.1.0",
"file-loader": "^2.0.0",
"fs-extra": "^5.0.0",
"html-webpack-plugin": "^4.0.0-beta.5",
"html-webpack-plugin": "^3.2.0",
"husky": "^0.14.3",
"identity-obj-proxy": "^3.0.0",
"jest": "^18.1.0",
"joi-browser": "^10.0.6",
"joi-browser": "^13.0.1",
"json-loader": "^0.5.4",
"lint-staged": "^6.0.0",
"lint-staged": "^6.1.0",
"mini-css-extract-plugin": "^0.9.0",
"node-dev": "^4.0.0",
"node-sass": "^4.5.2",
"pouchdb-adapter-memory": "^6.1.1",
"prettier": "^1.8.2",
"react-addons-test-utils": "^15.4.2",
"react-hot-loader": "^4.6.0",
"react-test-renderer": "^15.4.2",
"prettier": "^1.10.2",
"react-hot-loader": "^4.8.3",
"regenerator-runtime": "^0.11.0",
"sass-loader": "^6.0.3",
"sass-loader": "^8.0.2",
"script-loader": "^0.7.0",
"sinon": "^1.17.7",
"sinon-as-promised": "^4.0.2",
"smtp-server": "^3.3.0",
"standard": "^10.0.1",
"standard-version": "^4.4.0",
"string-replace-loader": "^1.3.0",
"style-loader": "^0.19.0",
"standard-version": "^7.1.0",
"style-loader": "^0.23.1",
"stylelint": "^8.2.0",
"stylelint-config-prettier": "^2.0.0",
"stylelint-config-pubsweet": "^0.0.3",
"stylelint-config-recommended": "^2.1.0",
"stylelint-config-styled-components": "^0.1.1",
"stylelint-processor-styled-components": "^1.3.1",
"testcafe": "^0.18.6",
"testcafe-react-selectors": "^1.0.5",
"uglifyjs-webpack-plugin": "^1.1.2",
"url-loader": "^0.6.2",
"webpack": "^4.29.0",
"webpack-dev-middleware": "^1.12.0",
"webpack-hot-middleware": "^2.20.0",
"testcafe": "^1.4.2",
"testcafe-react-selectors": "^3.0.0",
"url-loader": "^1.1.2",
"webpack": "^4.39.3",
"webpack-cli": "^3.3.6",
"webpack-dev-server": "^3.7.2",
"webpack-hot-middleware": "^2.25.0",
"winston-daily-rotate-file": "^3.2.1"
},
"jest": {
......
......@@ -12,10 +12,3 @@ const createAdmin = async userData => {
}
module.exports = createAdmin
createAdmin({
username: 'admin1',
password: 'password',
email: 'admin1@example.com',
admin: true,
})
// TODO:
// const logger = require('@pubsweet/logger')
// const { editoriaDataModel } = require('editoria-data-model')
// const map = require('lodash/map')
// const { models } = editoriaDataModel
// const { Division, BookComponent, BookComponentState, BookComponentTranslation } = models
// const unfreezeUploading = async () => {
// try {
// const frontMatterDivisions = await Division.query().where('uploading', true)
// logger.info(`Found ${hanged.length} with hanging uploading`)
// await Promise.all(
// map(hanged, async bookcomponentState => {
// logger.info(`Unfreezing ${bookcomponentState.id}`)
// return BookComponentState.query().patchAndFetchById(
// bookcomponentState.id,
// {
// uploading: false,
// },
// )
// }),
// )
// const after = await BookComponentState.query().where('uploading', true)
// if (after.length === 0) {
// logger.info('Job done')
// } else {
// logger.info(`Remaining ${after}`)
// }
// } catch (e) {
// throw new Error(e)
// }
// }
// module.exports = unfreezeUploading
// unfreezeUploading()
#!/bin/bash
set -x
yarn migrate && node ./scripts/seedsRunner.js && node app.js
......@@ -10,7 +10,6 @@ const {
const makeTeam = async type => {
const names = {
productionEditor: 'Production Editor',
author: 'Author',
}
logger.info(`Create ${names[type]} team`)
......@@ -32,33 +31,22 @@ const makeTeam = async type => {
const seed = async () => {
logger.info('### RUNNING GLOBAL TEAMS SEED SCRIPTS ###')
logger.info('=> Checking if global teams exist...')
try {
const teams = await Team.findByField({ global: true })
const productionEditorTeam = teams.find(t => t.role === 'productionEditor')
const authorTeam = teams.find(t => t.role === 'author')
if (productionEditorTeam && authorTeam) {
if (productionEditorTeam) {
logger.info('All global teams found, exiting...')
} else {
if (!productionEditorTeam) {
logger.warn('No Production Editor team found')
await makeTeam('productionEditor')
} else {
logger.info('Production Editor team already exists')
}
if (!authorTeam) {
logger.warn('No Author team found')
await makeTeam('author')
} else {
logger.info('Author team already exists')
}
logger.warn('No Production Editor team found')
await makeTeam('productionEditor')
}
} catch (err) {
logger.warn('No global teams found')
await makeTeam('productionEditor')
await makeTeam('author')
}
logger.info('Team seed successfully finished')
......
const logger = require('@pubsweet/logger')
const { User } = require('@pubsweet/models')
const createAdmin = async userData => {
logger.info('Creating user', userData.username)
const user = new User(userData)
await user.save()
logger.info(`Successfully added user: ${user.username}`)
return user
}
module.exports = createAdmin
#!/usr/bin/env node
const logger = require('@pubsweet/logger')
const db = require('@pubsweet/db-manager/src/db')
const {
model: ApplicationParameter,
} = require('editoria-data-model/src/applicationParameter')
const config = require('../../config/modules/book-builder')
const truncate = async () => {
await db.raw(`truncate table application_parameter cascade`)
logger.info(`truncate table application parameter`)
}
const createApplicationParams = async () => {
const areas = Object.keys(config)
await truncate()
await Promise.all(
areas.map(async area => {
const parameters = await new ApplicationParameter({
context: 'bookBuilder',
area,
config: JSON.stringify(config[area]),
}).save()
logger.info(
`New Application Parameter created: ${JSON.stringify(config[area])}`,
)
return parameters
}),
)
}
module.exports = createApplicationParams
const logger = require('@pubsweet/logger')
const {
model: BookCollection,
} = require('editoria-data-model/src/bookCollection')
const {
model: BookCollectionTranslation,
} = require('editoria-data-model/src/bookCollectionTranslation')
const createBookCollection = async () => {
let collection
await new BookCollection().save().then(res => (collection = res))
logger.info(collection)
await new BookCollectionTranslation({
collectionId: collection.id,
languageIso: 'en',
title: 'Books',
})
.save()
.then(res => logger.info(res))
}
module.exports = createBookCollection
const logger = require('@pubsweet/logger')
const {
editoriaDataModel: {
models: { Team },
},
} = require('editoria-data-model')
const makeTeam = async type => {
const names = {
productionEditor: 'Production Editor',
}
logger.info(`Create ${names[type]} team`)
await Team.query().upsertGraphAndFetch(
{
global: true,
members: [],
name: names[type],
role: type,
},
{ relate: true },
)
// await team.save()
logger.info(`${names[type]} team successfully created`)
}
const createGlobalTeams = async () => {
logger.info('### RUNNING GLOBAL TEAMS SEED SCRIPTS ###')
logger.info('=> Checking if global teams exist...')
try {
const teams = await Team.findByField({ global: true })
const productionEditorTeam = teams.find(t => t.role === 'productionEditor')
if (productionEditorTeam) {
logger.info('All global teams found, exiting...')
} else {
logger.warn('No Production Editor team found')
await makeTeam('productionEditor')
}
} catch (err) {
logger.warn('No global teams found')
await makeTeam('productionEditor')
}
logger.info('Team seed successfully finished')
}
module.exports = createGlobalTeams
const createAdminUser = require('./createAdminUser')
const createApplicationParams = require('./createApplicationParams')
const createBookCollection = require('./createBookCollection')
const createGlobalTeams = require('./createGlobalTeams')
module.exports = {
createAdminUser,
createApplicationParams,
createBookCollection,
createGlobalTeams,
}
const logger = require('@pubsweet/logger')
const {
createAdminUser,
createApplicationParams,
createBookCollection,
createGlobalTeams,
} = require('./seeds')
const runner = async () => {
try {
await createAdminUser({
username: 'admin',