0.1.7 • Published 2 years ago

@manuscripts/manuscript-article-editor v0.1.7

Weekly downloads
-
License
CPAL-1.0
Repository
-
Last release
2 years ago

manuscripts-article-editor

This repository contains the editor package of Manuscripts app to be used in a react application.

Dependencies

Manuscripts is highly modular: it is composed out of a series of NPM published modules following a few different themes.

Data model

Data synchronisation

Editor components

ProseMirror specifics

Export

Reusable UI components

Datasets

Utilities

Installation

Run yarn install @manuscripts/article-editor in your application.

Build (for production)

The variables listed in .env.example must all be defined as environment variables in your project.

Run yarn build to build the app to the dist folder.

Deploy the files to S3 with scripts/deploy.sh.

Running the client in development mode

  1. cp .env.example .env. The variables listed in .env.example have appropriate default values for running in a mode where the backend API server is running locally (this is optional, and you can complete local development tasks in the absence of the backend services). See steps below under "Running the backend API in Docker" for steps to launch the API server locally.
  2. Run docker volume create --name=yarn-cache to create a yarn cache for the backend services that you will launch in the next step. This step is only needed once.
  3. docker-compose up jupyter to start the services needed for development.
  4. yarn start to start the app in development mode (using webpack-dev-server and react-hot-loader).
  5. To avoid signing up an account, open http://localhost:8080/developer to create a dummy user profile. Now you're good to go.

Running the backend API in Docker

  1. Add any environment variables needed for the API server in docker/server/.env.
  2. docker login registry.gitlab.com to log in to GitLab’s Container Registry using your GitLab username and password (or a deploy token for read-only access to the registry images).
  3. Run docker-compose pull to pull the latest server Docker images.
  4. first run Initialize the backend services: scripts/api/initialize.sh. If running on Windows or MacOS, it may be necessary to increase the RAM allocated to Docker. (This can be done through Docker Desktop > Preferences > Resources > Advanced > Memory.)
  5. subsequent runs Start the backend services: docker-compose up api
  6. Run docker-compose up jupyter to start the additional services.
  7. Open chrome://flags/#cookies-without-same-site-must-be-secure and set to Disabled.
  8. Run yarn start to start the frontend.
  9. Open Chrome, and enter http://localhost:8080/signup to create a user account. Confirmation emails generally won't be sent from a locally-running API, but you can ignore that message (see APP_SKIP_ACCOUNT_VERIFICATION in docker/server/defaults.env)
  10. To stop the service, run docker-compose down. Add an optional -v flag to delete the data volumes.

Running the Manuscripts stack in Kubernetes via Docker Desktop

  1. Make sure kubectl is using the appropriate context:
    1. Run kubectl config current-context to show the current context.
    2. Run kubectl config get-contexts to list the available contexts.
    3. Run kubectl config set-context docker-desktop to set the context.
  2. To build the client image, run docker-compose build client
  3. To start the services, run docker stack deploy --compose-file <(docker-compose config) manuscripts
  4. To stop the services, run docker stack rm manuscripts

Template publishing

  1. Make sure you are using the test environment. (@manuscripts/data fetch published templates from the test environment: https://gitlab.com/mpapp-public/manuscripts-data/-/blob/master/scripts/fetch-published-templates.js#L6)
  2. Make sure you are logged in as a user who is allowed to publish templates (APP_COUCHBASE_ALLOWED_OWNERS) or you are using (have access to) one of the projects which is allowed to publish templates (APP_COUCHBASE_ALLOWED_PROJECTS).
  3. Create a manuscript, edit the title (will be used as the template title), and specify requirements. Then publish the template (This can be done through Project menu > Publish Template).
  4. Release new version of manuscripts-data. (The build process will fetch published, user-generated template data from a manuscripts-api endpoint and adds it to the data published as @manuscripts/data)
  5. Release new version of manuscripts-requirements after updating the @manuscripts/data dependency version. (Essential for the validation process and building the quality report.)
  6. Upgrade pressroom-js after updating @manuscripts/data and @manuscripts/requirements dependencies.
  7. Update fusion-kubernetes-env with the new pressroom-js image tag.
  8. Upgrade this repository dependencies (@manuscripts/data and @manuscripts/requirements).

Testing

Unit tests

Run yarn test to run the unit tests in Jest.

Running tests with Cypress

  1. Run yarn run cypress:open to launch the Cypress runner.
  2. From the Cypress runner, select an individual test to run or select Run all specs

Development

See the manuscripts-frontend wiki for more information.

Developing manuscripts-api

  1. If needed, initialize the backend services: scripts/api/initialize.sh
  2. Start the other backend services in Docker: docker-compose up sync-gateway jupyter
  3. Start the API: scripts/api/start-local.sh

Developing @manuscripts/style-guide

  1. Clone @manuscripts/style-guide to a folder alongside this one, run yarn install to install its dependencies, run yarn link to make it available as a local dependency, then run yarn dev in that folder to start building it.
  2. In this folder, run yarn link @manuscripts/style-guide to use the linked module as a local dependency.

Analysis

Run yarn stats to generate a stats.json file, then yarn analyze to open webpack-bundle-analyzer's visualization of the webpack bundle.

Configuration

The service is configured using environment variables, .env.example file placed at the root of the repository.

@absinthe/socket@absinthe/socket-apollo-link@apollo/react-hooks@babel/core@babel/plugin-proposal-class-properties@babel/plugin-proposal-nullish-coalescing-operator@babel/plugin-proposal-optional-chaining@babel/plugin-proposal-unicode-property-regex@babel/plugin-syntax-dynamic-import@babel/preset-env@babel/preset-react@babel/preset-typescript@babel/runtime@formatjs/intl-relativetimeformat@formatjs/intl-utils@manuscripts/assets@manuscripts/comment-editor@manuscripts/csl-locales@manuscripts/data@manuscripts/library@manuscripts/manuscript-editor@manuscripts/manuscript-transform@manuscripts/manuscripts-json-schema@manuscripts/manuscripts-json-schema-utils@manuscripts/pouchdb-adapter-http@manuscripts/pouchdb-adapter-idb@manuscripts/requirements@manuscripts/resizer@manuscripts/rxdb@manuscripts/style-guide@manuscripts/sync-client@manuscripts/title-editor@manuscripts/track-changes@reach/tabs@sentry/browser@types/apollo-upload-client@types/codemirror@types/copy-webpack-plugin@types/deep-freeze@types/dompurify@types/extract-text-webpack-plugin@types/file-saver@types/google.analytics@types/html-webpack-plugin@types/jszip@types/jwt-decode@types/lodash@types/lodash-es@types/mousetrap@types/node@types/path-parse@types/pretty-bytes@types/qs@types/react@types/react-avatar-editor@types/react-beautiful-dnd@types/react-color@types/react-datepicker@types/react-dom@types/react-dropzone@types/react-helmet@types/react-modal@types/react-router-dom@types/react-select@types/react-window@types/string-hash@types/styled-components@types/uuid@types/webpack-merge@types/webpack-subresource-integrity@types/webpackbar@types/workbox-webpack-plugin@types/yupapollo-cache-inmemoryapollo-clientapollo-linkapollo-link-contextapollo-link-errorapollo-link-httpapollo-link-wsapollo-upload-clientapollo-utilitiesautotrackaxiosbabel-corebabel-loaderbabel-plugin-react-intlbabel-plugin-styled-componentsblob-to-bufferbroadcast-channelbundlesizeclean-webpack-pluginclipboard-copycomlinkcopy-webpack-plugincore-jscss-loadercsstypedate-fnsdeep-freezedompurifyextract-text-webpack-pluginfaviconsfavicons-webpack-pluginfile-loaderfile-saverformikfuzzysortgraphqlgraphql-taghistoryhtml-webpack-pluginhttp-status-codesintl-pluralrulesjszipjwt-decodelodash-esmimemousetrappath-parsephoenixpopper.jspouchdb-generate-replication-idpouchdb-replicationpretty-bytesprop-typesqsraw-loaderreactreact-avatar-editorreact-beautiful-dndreact-colorreact-datepickerreact-datetime-pickerreact-dndreact-dnd-html5-backendreact-domreact-dropzonereact-helmetreact-hot-loaderreact-intlreact-isreact-modalreact-modern-calendar-datepickerreact-popperreact-routerreact-router-domreact-selectreact-sizemereact-springreact-tooltipreact-useintervalreact-virtualized-auto-sizerreact-windowrxjsrxjs-compatstyle-loaderstyled-componentssubscriptions-transport-wsts-nodetypeface-latotypeface-pt-sanstypeface-pt-seriftypescriptuglifyjs-webpack-pluginuuidwebpackwebpack-cliwebpack-mergewebpack-subresource-integritywebpackbarworkbox-webpack-pluginworkbox-windowworker-pluginyup
0.1.7

2 years ago

0.1.5

2 years ago