Skip to content
Commits on Source (6)
module.exports = {
extends: ['@commitlint/config-conventional'],
}
const { commitizen } = require('@coko/lint')
commitizen.scopes = ['service', '*']
const modified = {
...commitizen,
skipQuestions: ['body', 'footer'], // do NOT skip 'breaking'
scopes: ['service', '*'],
askForBreakingChangeFirst: true,
}
module.exports = commitizen
module.exports = modified
database
node_modules
temp
.*
config/*.env
*.config.*
docker-compose.yml
docker-compose.*.yml
Dockerfile
logs
*.log
.yarn/cache
.yarn/install-state.gz
!.yarnrc.yml
!.cz-config.js
!.eslintrc.js
!.prettierrc.js
XSweet/*
\ No newline at end of file
......@@ -8,3 +8,12 @@ tmp/
temp/
uploads/*
.env*
# Yarn files
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
variables:
IMAGE_NAME: cokoapps/xsweet/xsweet-dev
TAG: $CI_REGISTRY/$IMAGE_NAME:$CI_COMMIT_REF_NAME.$CI_COMMIT_SHA
stages:
- Build development
- Lint & Test
- Release
build:
stage: Build development
image: docker:27
services:
- docker:27-dind
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
script:
- docker build -f Dockerfile-development --tag $TAG .
- docker push $TAG
lint:
stage: Lint & Test
image: $TAG
script:
- cd /home/node/xsweet
- yarn coko-lint run --skip-stylelint
release:
stage: Release
image: cokoapps/release-docker:20
services:
- docker:27-dind
only:
- main
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ''
GIT_AUTHOR_NAME: $RELEASE_BOT_NAME
GIT_AUTHOR_EMAIL: $RELEASE_BOT_EMAIL
GIT_COMMITTER_NAME: $RELEASE_BOT_NAME
GIT_COMMITTER_EMAIL: $RELEASE_BOT_EMAIL
GITLAB_TOKEN: $RELEASE_BOT_TOKEN
before_script:
- docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
script:
- npx semantic-release
const { lintstaged } = require('@coko/lint')
module.exports = lintstaged
CHANGELOG.md
README.md
saxon/
XSweet/
module.exports = {
branches: ['main'],
plugins: [
[
'@semantic-release/commit-analyzer',
{
releaseRules: [
{
type: 'revert',
release: 'patch',
},
{
type: 'refactor',
release: 'minor',
},
],
},
],
'@semantic-release/release-notes-generator',
'@semantic-release/changelog',
'@semantic-release/git',
[
'@semantic-release/gitlab',
{
assets: [
{
label: 'Dockerhub release',
url: 'https://hub.docker.com/r/cokoapps/xsweet/tags',
},
],
},
],
[
'@semantic-release/exec',
{
prepareCmd:
'docker build --tag cokoapps/xsweet:${nextRelease.version} .',
publishCmd: 'docker push cokoapps/xsweet:${nextRelease.version}',
},
],
],
}
const { stylelint } = require('@coko/lint')
module.exports = stylelint
nodeLinker: node-modules
# [3.0.0](https://gitlab.coko.foundation/cokoapps/xsweet/compare/v2.3.3...v3.0.0) (2024-11-06)
### chore
* upgrade to coko server v4 ([635530b](https://gitlab.coko.foundation/cokoapps/xsweet/commit/635530bbdf12a378b0d1a6e46e84e73d6a1d2b8f))
### BREAKING CHANGES
* Renamed environment variable PUBSWEET_SECRET to SECRET
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
......
FROM node:20.0.0-alpine3.16
RUN apk update && apk add --no-cache ranger vim bash coreutils unzip openjdk11-jre-headless git ruby gcompat
RUN apk update && apk add --no-cache bash coreutils unzip openjdk11-jre-headless git ruby gcompat
# install mathtype – ruby and gcompat above were addded to make nokogiri work correctly.
RUN gem install mathtype
RUN corepack enable
WORKDIR /home/node/xsweet
# Download XSweet
RUN wget https://gitlab.coko.foundation/XSweet/XSweet/-/archive/3.0/XSweet-3.0.zip -O xsweet.zip; unzip xsweet.zip; rm xsweet.zip
......@@ -19,10 +20,11 @@ RUN chown -R node:node /home/node/xsweet
USER node
COPY --chown=node:node .yarnrc.yml .
COPY --chown=node:node package.json ./package.json
COPY --chown=node:node yarn.lock ./yarn.lock
RUN yarn
RUN yarn install --immutable
COPY --chown=node:node . .
......@@ -30,6 +32,4 @@ RUN chmod +x ./scripts/move_xslts.sh
RUN chmod +x ./scripts/execute_chain.sh
RUN ./scripts/move_xslts.sh
ENTRYPOINT ["sh", "./scripts/setupProdServer.sh"]
CMD ["node", "./server/startServer.js"]
CMD ["yarn", "coko-server", "start"]
......@@ -3,9 +3,10 @@ FROM node:20.0.0-alpine3.16
RUN apk update && apk add --no-cache ranger vim bash coreutils unzip openjdk11-jre-headless git ruby gcompat
# install mathtype – ruby and gcompat above were addded to make nokogiri work correctly.
RUN gem install mathtype
RUN corepack enable
WORKDIR /home/node/xsweet
# Download XSweet
RUN wget https://gitlab.coko.foundation/XSweet/XSweet/-/archive/3.0/XSweet-3.0.zip -O xsweet.zip; unzip xsweet.zip; rm xsweet.zip
......@@ -19,10 +20,11 @@ RUN chown -R node:node /home/node/xsweet
USER node
COPY --chown=node:node .yarnrc.yml .
COPY --chown=node:node package.json ./package.json
COPY --chown=node:node yarn.lock ./yarn.lock
RUN yarn
RUN yarn install --immutable
COPY --chown=node:node . .
......
const permissions = {
// eslint-disable-next-line consistent-return
before: () => true,
}
module.exports = permissions
module.exports = [
'@coko/service-auth',
'@coko/service-auth/src/models/service-client',
'./server/',
]
[
"@coko/service-auth",
"@coko/service-auth/src/models/service-client",
"./server/"
]
module.exports = {
'pubsweet-server': {
secret: 'PUBSWEET_SECRET',
db: {
user: 'POSTGRES_USER',
password: 'POSTGRES_PASSWORD',
host: 'POSTGRES_HOST',
database: 'POSTGRES_DB',
port: 'POSTGRES_PORT',
},
host: 'SERVER_HOST',
port: 'SERVER_PORT',
protocol: 'SERVER_PROTOCOL',
secret: 'SECRET',
port: 'SERVER_PORT',
db: {
user: 'POSTGRES_USER',
password: 'POSTGRES_PASSWORD',
host: 'POSTGRES_HOST',
database: 'POSTGRES_DB',
port: 'POSTGRES_PORT',
},
clientID: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET',
}
const winston = require('winston')
const path = require('path')
/* eslint-disable import/extensions */
const components = require('./components')
/* eslint-enable import/extensions */
const logger = new winston.Logger({
transports: [
new winston.transports.Console({
colorize: true,
handleExceptions: true,
humanReadableUnhandledException: true,
}),
],
})
const {
DOCX_TO_HTML_AND_SPLIT_JOB,
DOCX_TO_HTML_JOB,
} = require('../server/api/constants')
module.exports = {
authsome: {
mode: path.join(__dirname, 'authsome.js'),
},
publicKeys: ['pubsweet', 'pubsweet-server'],
pubsweet: {
components,
},
teams: {
global: {
admin: {
displayName: 'Admin',
role: 'admin',
components,
db: {},
port: 3000,
useGraphQLServer: false,
onStartup: [
{
label: 'Create client runner through environment',
execute: async () => {
const {
createServiceClientFromEnvironment,
/* eslint-disable-next-line global-require */
} = require('@coko/service-auth')
await createServiceClientFromEnvironment()
},
},
nonGlobal: {},
},
'pubsweet-server': {
db: {},
logger,
useJobQueue: true,
port: 3000,
protocol: 'http',
host: 'localhost',
useGraphQLServer: false,
pool: { min: 0, max: 10, idleTimeoutMillis: 1000 },
},
],
jobQueues: [
{
name: DOCX_TO_HTML_JOB,
handler: async job => {
/* eslint-disable-next-line global-require */
const { DOCXToHTMLAsyncHandler } = require('../server/api/useCase')
const { data } = job
const {
filePath,
callbackURL,
serviceCallbackTokenId,
objectId,
responseToken,
useMath,
} = data
const responseParams = {
callbackURL,
serviceCallbackTokenId,
objectId,
responseToken,
}
await DOCXToHTMLAsyncHandler(filePath, responseParams, useMath)
return true
},
},
{
name: DOCX_TO_HTML_AND_SPLIT_JOB,
handler: async job => {
const {
DOCXToHTMLAndSplitAsyncHandler,
/* eslint-disable-next-line global-require */
} = require('../server/api/useCase')
const { data } = job
const {
filePath,
callbackURL,
serviceCallbackTokenId,
responseToken,
useMath,
} = data
const responseParams = {
callbackURL,
serviceCallbackTokenId,
responseToken,
}
await DOCXToHTMLAndSplitAsyncHandler(filePath, responseParams, useMath)
return true
},
},
],
}
version: '2'
services:
server:
build:
......@@ -8,13 +6,11 @@ services:
ports:
- ${SERVER_PORT:-3000}:${SERVER_PORT:-3000}
environment:
- PUBSWEET_SECRET=${PUBSWEET_SECRET}
- NODE_ENV=production
- SECRET=${SECRET}
- SERVER_PORT=${SERVER_PORT}
- SERVER_HOST=${SERVER_HOST}
- SERVER_PROTOCOL=${SERVER_PROTOCOL}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_PORT=${POSTGRES_PORT}
- NODE_ENV=production
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}