diff --git a/Dockerfile b/Dockerfile index 77ed4a1088b..3247dab587a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,7 @@ COPY src /schulcloud-server/src COPY apps /schulcloud-server/apps COPY --from=git /app/serverversion /schulcloud-server/apps/server/static-assets COPY scripts/ldapSync.sh /schulcloud-server/scripts/ +COPY add-ts-nocheck.js /schulcloud-server/ RUN npm run build ENV NODE_ENV=production diff --git a/add-ts-nocheck.js b/add-ts-nocheck.js new file mode 100644 index 00000000000..37ab4eedbad --- /dev/null +++ b/add-ts-nocheck.js @@ -0,0 +1,39 @@ +/* +ignore the typescript error in the feathersjs ts declarations +using "skipLibCheck": true in tsconfig.json is not wanted for a single declaration error +references: + https://github.com/feathersjs/feathers/discussions/3351 + https://github.com/microsoft/TypeScript/issues/38538 + +usage: node add-ts-nocheck.js in package.json scripts +*/ +const fs = require('fs'); + +const ADDED_STR = '// @ts-nocheck\n\n'; +const FILES = ['node_modules/@feathersjs/express/lib/declarations.d.ts']; + +Promise.allSettled(FILES.map(addTsNoCheck)).then((results) => { + let hasErrors = false; + + for (const result of results) { + if (result.status === 'rejected') { + hasErrors = true; + console.error(result.reason); + } + } + + if (hasErrors) { + process.exit(1); + } +}); + +async function addTsNoCheck(file) { + const content = fs.readFileSync(file).toString(); + + if (content.includes(ADDED_STR)) { + console.log(JSON.stringify(ADDED_STR), 'is already in', file); + } else { + fs.writeFileSync(file, ADDED_STR + content); + console.log(JSON.stringify(ADDED_STR), 'added into', file); + } +} diff --git a/package-lock.json b/package-lock.json index 203be62c342..6cfb08403e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -135,6 +135,7 @@ "urlsafe-base64": "^1.0.0", "uuid": "^8.3.0", "winston": "^3.8.2", + "ws": "^7.5.9", "y-mongodb-provider": "^0.1.7", "y-protocols": "^1.0.5", "yjs": "^13.6.7" @@ -25326,11 +25327,9 @@ } }, "node_modules/ws": { - "version": "7.5.7", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.7.tgz", - "integrity": "sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A==", - "optional": true, - "peer": true, + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", "engines": { "node": ">=8.3.0" }, @@ -44736,11 +44735,9 @@ } }, "ws": { - "version": "7.5.7", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.7.tgz", - "integrity": "sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A==", - "optional": true, - "peer": true, + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", "requires": {} }, "xml2js": { diff --git a/package.json b/package.json index 78ad4c8c0e6..c9115a9ee40 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "npm": "9" }, "scripts": { + "ignore-feathers-error": "node add-ts-nocheck", "lint-fix": "eslint . --fix --ignore-path .gitignore", "lint": "eslint . --ignore-path .gitignore", "test": "npm run nest:test && npm run feathers:test", @@ -48,43 +49,43 @@ "migration-prune": "migrate prune --autosync --config ./config/migrate.js", "migration-persist": "npm run nest:start:console -- database export --collection migrations --override", "migrate-etherpads": "node ./migrate-etherpads.js", - "nest:prebuild": "rimraf dist", - "nest:build": "nest build", + "nest:prebuild": "rimraf dist & npm run ignore-feathers-error", + "nest:build": "npm run nest:prebuild & nest build", "nest:build:all": "npm run nest:build", "nest:docs:serve": "npx --yes @compodoc/compodoc -p tsconfig.json -s -w -a apps/assets --includes apps/server/doc -d docs", "nest:docs:build": "npx --yes @compodoc/compodoc -p tsconfig.json -w -a apps/assets --includes apps/server/doc -d docs", - "nest:start": "nest start server", - "nest:start:dev": "nest start server --watch", - "nest:start:debug": "nest start server --debug --watch", + "nest:start": "npm run ignore-feathers-error & nest start server", + "nest:start:dev": "npm run ignore-feathers-error & nest start server --watch", + "nest:start:debug": "npm run ignore-feathers-error & nest start server --debug --watch", "nest:start:prod": "node dist/apps/server/apps/server.app", - "nest:start:management": "nest start management", - "nest:start:management:dev": "nest start management --watch", - "nest:start:management:debug": "nest start management --debug --watch", + "nest:start:management": "npm run ignore-feathers-error & nest start management", + "nest:start:management:dev": "npm run ignore-feathers-error & nest start management --watch", + "nest:start:management:debug": "npm run ignore-feathers-error & nest start management --debug --watch", "nest:start:management:prod": "node dist/apps/server/apps/management.app", - "nest:start:files-storage": "nest start files-storage & nest start files-storage-amqp & nest start preview-generator-amqp", - "nest:start:files-storage:dev": "nest start files-storage --watch & nest start files-storage-amqp --watch & nest start preview-generator-amqp --watch", - "nest:start:files-storage:debug": "nest start files-storage --debug --watch & nest start files-storage-amqp --debug --watch & nest start preview-generator-amqp --debug --watch", + "nest:start:files-storage": "npm run ignore-feathers-error & nest start files-storage & nest start files-storage-amqp & nest start preview-generator-amqp", + "nest:start:files-storage:dev": "npm run ignore-feathers-error & nest start files-storage --watch & nest start files-storage-amqp --watch & nest start preview-generator-amqp --watch", + "nest:start:files-storage:debug": "npm run ignore-feathers-error & nest start files-storage --debug --watch & nest start files-storage-amqp --debug --watch & nest start preview-generator-amqp --debug --watch", "nest:start:files-storage:prod": "node dist/apps/server/apps/files-storage.app", "nest:start:files-storage-amqp:prod": "node dist/apps/server/apps/files-storage-consumer.app", "nest:start:preview-generator-amqp:prod": "node dist/apps/server/apps/preview-generator-consumer.app", - "nest:start:fwu-learning-contents": "nest start fwu-learning-contents", - "nest:start:fwu-learning-contents:debug": "nest start fwu-learning-contents --debug --watch", + "nest:start:fwu-learning-contents": "npm run ignore-feathers-error & nest start fwu-learning-contents", + "nest:start:fwu-learning-contents:debug": "npm run ignore-feathers-error & nest start fwu-learning-contents --debug --watch", "nest:start:fwu-learning-contents:prod": "node dist/apps/server/apps/fwu-learning-contents.app", - "nest:start:h5p": "nest start h5p-editor", - "nest:start:h5p:dev": "nest start h5p-editor --debug --watch", + "nest:start:h5p": "npm run ignore-feathers-error & nest start h5p-editor", + "nest:start:h5p:dev": "npm run ignore-feathers-error & nest start h5p-editor --debug --watch", "nest:start:h5p:prod": "node dist/apps/server/apps/h5p-editor.app", - "nest:start:h5p:library-management": "nest start h5p-library-management", - "nest:start:h5p:library-management:dev": "nest start h5p-library-management --debug --watch", + "nest:start:h5p:library-management": "npm run ignore-feathers-error & nest start h5p-library-management", + "nest:start:h5p:library-management:dev": "npm run ignore-feathers-error & nest start h5p-library-management --debug --watch", "nest:start:h5p:library-management:prod": "node dist/apps/server/apps/h5p-library-management.app", - "nest:start:tldraw": "nest start tldraw", - "nest:start:tldraw:dev": "nest start tldraw --debug --watch", + "nest:start:tldraw": "npm run ignore-feathers-error & nest start tldraw", + "nest:start:tldraw:dev": "npm run ignore-feathers-error & nest start tldraw --debug --watch", "nest:start:tldraw:prod": "node dist/apps/server/apps/tldraw.app", - "nest:start:console": "nest start console --", - "nest:start:console:dev": "nest start console --watch --", - "nest:start:console:debug": "nest start console --debug --watch --", - "nest:start:deletion-console": "nest start deletion-console --", - "nest:start:deletion-console:dev": "nest start deletion-console --watch --", - "nest:start:deletion-console:debug": "nest start deletion-console --debug --watch --", + "nest:start:console": "npm run ignore-feathers-error & nest start console --", + "nest:start:console:dev": "npm run ignore-feathers-error & nest start console --watch --", + "nest:start:console:debug": "npm run ignore-feathers-error & nest start console --debug --watch --", + "nest:start:deletion-console": "npm run ignore-feathers-error & nest start deletion-console --", + "nest:start:deletion-console:dev": "npm run ignore-feathers-error & nest start deletion-console --watch --", + "nest:start:deletion-console:debug": "npm run ignore-feathers-error & nest start deletion-console --debug --watch --", "nest:test": "npm run nest:test:cov && npm run nest:lint", "nest:test:all": "jest", "nest:test:unit": "jest \"^((?!\\.api\\.spec\\.ts).)*\\.spec\\.ts$\"", @@ -227,6 +228,7 @@ "urlsafe-base64": "^1.0.0", "uuid": "^8.3.0", "winston": "^3.8.2", + "ws": "^7.5.9", "y-mongodb-provider": "^0.1.7", "y-protocols": "^1.0.5", "yjs": "^13.6.7"