feat(package): adjust packages to workspaces

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2022-11-02 16:24:45 +01:00 committed by David Mehren
parent 046a173891
commit 2241a3faea
26 changed files with 5157 additions and 11075 deletions

View file

@ -1,4 +1,9 @@
{
/**
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: CC0-1.0
**/
module.exports = {
"root": true,
"parserOptions": {
"tsconfigRootDir": ".",
@ -7,7 +12,9 @@
]
},
"rules": {
"prettier/prettier": "error",
"prettier/prettier": ["error",
require('./.prettierrc.json')
],
"no-use-before-define": "off",
"no-debugger": "warn",
"default-param-last": "off",

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC0-1.0

View file

@ -1,7 +0,0 @@
nodeLinker: node-modules
plugins:
- path: ../.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
yarnPath: ../.yarn/releases/yarn-3.3.0.cjs

View file

@ -1,36 +0,0 @@
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
#
# SPDX-License-Identifier: CC-BY-SA-4.0
# BUILD
FROM node:18-alpine@sha256:9eff44230b2fdcca57a73b8f908c8029e72d24dd05cac5339c79d3dedf6b208b AS builder
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ARG BUILD_VERSION=CLIENT_VERSION_MISSING
WORKDIR /app
COPY --chown=node .yarn ../.yarn
COPY --chown=node frontend ./
RUN rm -rf public/public && \
rm -rf src/pages/api && \
yarn install --immutable && \
sed -i "s/CLIENT_VERSION_MISSING/${BUILD_VERSION}/" src/version.json && \
yarn build
# RUNNER
FROM node:18-alpine@sha256:9eff44230b2fdcca57a73b8f908c8029e72d24dd05cac5339c79d3dedf6b208b
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
WORKDIR /app
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder --chown=node:node /app/.next/static ./.next/static
COPY --from=builder --chown=node:node /app/.next/standalone ./
USER node
ENV PORT 3001
EXPOSE 3001/tcp
CMD ["node", "server.js"]

View file

@ -0,0 +1,48 @@
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
#
# SPDX-License-Identifier: CC-BY-SA-4.0
# BUILD
FROM docker.io/node:18-alpine@sha256:9eff44230b2fdcca57a73b8f908c8029e72d24dd05cac5339c79d3dedf6b208b AS builder
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ARG BUILD_VERSION=CLIENT_VERSION_MISSING
ENV YARN_CACHE_FOLDER /tmp/.yarn
USER node
WORKDIR /usr/src/app
COPY --chown=node .yarn/plugins .yarn/plugins
COPY --chown=node .yarn/releases .yarn/releases
COPY --chown=node .yarnrc.yml .yarnrc.yml
COPY --chown=node package.json package.json
COPY --chown=node yarn.lock yarn.lock
COPY --chown=node backend/package.json backend/
COPY --chown=node frontend frontend
RUN --mount=type=cache,sharing=locked,uid=1000,gid=1000,target=/tmp/.yarn \
yarn install --immutable && yarn workspaces focus @hedgedoc/frontend
WORKDIR /usr/src/app/frontend
RUN rm -rf public/public && \
rm -rf src/pages/api && \
sed -i "s/CLIENT_VERSION_MISSING/${BUILD_VERSION}/" src/version.json
RUN yarn build
# RUNNER
FROM docker.io/node:18-alpine@sha256:9eff44230b2fdcca57a73b8f908c8029e72d24dd05cac5339c79d3dedf6b208b
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
WORKDIR /usr/src/app
COPY --from=builder --chown=node:node /usr/src/app/frontend/.next/standalone ./
COPY --from=builder --chown=node:node /usr/src/app/frontend/.next/static ./.next/static
COPY --from=builder /usr/src/app/frontend/next.config.js next.config.js
COPY --from=builder /usr/src/app/frontend/public ./public
USER node
ENV PORT 3001
EXPOSE 3001/tcp
CMD ["node", "frontend/server.js"]

View file

@ -85,7 +85,10 @@ const rawNextConfig = {
}
])
},
output: 'standalone'
output: 'standalone',
experimental: {
outputFileTracingRoot: path.join(__dirname, '../')
}
}
const completeNextConfig = withBundleAnalyzer(rawNextConfig)

View file

@ -1,5 +1,5 @@
{
"name": "@hedgedoc/react-client",
"name": "@hedgedoc/frontend",
"version": "2.0.0-dev",
"private": true,
"license": "AGPL-3.0",
@ -79,6 +79,7 @@
"i18next": "22.0.6",
"i18next-browser-languagedetector": "7.0.1",
"i18next-resources-to-backend": "1.0.0",
"isomorphic-ws": "5.0.0",
"js-yaml": "4.1.0",
"katex": "0.16.3",
"luxon": "3.1.1",
@ -146,6 +147,7 @@
"@types/sass": "1.43.1",
"@types/testing-library__jest-dom": "5.14.5",
"@types/uuid": "8.3.4",
"@types/ws": "8.5.3",
"@typescript-eslint/eslint-plugin": "5.43.0",
"@typescript-eslint/parser": "5.43.0",
"csstype": "3.1.1",
@ -171,12 +173,5 @@
"ts-node": "10.9.1",
"typescript": "4.9.3"
},
"packageManager": "yarn@3.3.0",
"resolutions": {
"domhandler": "5.0.3",
"@codemirror/state": "6.1.4",
"@codemirror/view": "6.6.0",
"@codemirror/language": "6.3.1",
"yjs": "13.5.43"
}
"packageManager": "yarn@3.3.0"
}

View file

@ -3,15 +3,15 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import {
encodeAwarenessUpdateMessage,
encodeCompleteAwarenessStateRequestMessage,
encodeDocumentUpdateMessage,
WebsocketTransporter
} from '@hedgedoc/realtime'
import type { Doc } from 'yjs'
import WebSocket from 'isomorphic-ws'
import type { Awareness } from 'y-protocols/awareness'
import type { Doc } from 'yjs'
/**
* Handles the communication with the realtime endpoint of the backend and synchronizes the given y-doc and awareness with other clients.

View file

@ -17,5 +17,5 @@
"types": ["node", "@testing-library/jest-dom", "@types/jest"]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", "cypress", "cypress.config.ts"]
"exclude": ["node_modules", "cypress", "cypress.config.ts", ".eslintrc.js"]
}

File diff suppressed because it is too large Load diff

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC0-1.0