Skip to content

Commit

Permalink
exclude feathers error declaration and explicitly add ws package
Browse files Browse the repository at this point in the history
fix ignore defitnition

fix docker
  • Loading branch information
virgilchiriac committed Nov 29, 2023
1 parent 4f46ca6 commit b5c18df
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 35 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 39 additions & 0 deletions add-ts-nocheck.js
Original file line number Diff line number Diff line change
@@ -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);
}
}
17 changes: 7 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 27 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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$\"",
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit b5c18df

Please sign in to comment.