Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

887 upgrade dependencies of libms #943

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
3024943
resolves #942
nichlaes Sep 23, 2024
b1a2933
resolves #941
nichlaes Sep 23, 2024
50d2162
updated lock
nichlaes Sep 23, 2024
1796cb8
resolves #940
nichlaes Sep 23, 2024
2f9a5b3
resolves #939
nichlaes Sep 23, 2024
3d81b00
resolves #938
nichlaes Sep 23, 2024
5499e12
updated lock
nichlaes Sep 23, 2024
b19b0ad
resolves #937
nichlaes Sep 23, 2024
bc430ed
resolves #936
nichlaes Sep 23, 2024
4a1e55b
resolves #935
nichlaes Sep 23, 2024
03ee3fb
resolves #934
nichlaes Sep 23, 2024
b2c3fb1
resolves #933
nichlaes Sep 23, 2024
82766c3
updated lock
nichlaes Sep 23, 2024
ee172a7
resolves #932
nichlaes Sep 23, 2024
133fd70
resolves #931
nichlaes Sep 23, 2024
5629497
resolves #930
nichlaes Sep 23, 2024
96813ca
resolves #929
nichlaes Sep 23, 2024
699c285
resolves #928
nichlaes Sep 23, 2024
ea25350
updated lock
nichlaes Sep 23, 2024
2c6540c
updated packages
nichlaes Sep 25, 2024
40606df
migrates to flat config file
nichlaes Sep 26, 2024
88922ef
no longer supported
nichlaes Sep 26, 2024
7ddcadd
fixed eslint errors
nichlaes Sep 27, 2024
06b8d8c
Revert "resolves #942"
nichlaes Sep 27, 2024
cfa9cc8
Revert "resolves #941"
nichlaes Sep 27, 2024
b41a60f
Revert "updated lock"
nichlaes Sep 27, 2024
1f4e12e
Revert "resolves #940"
nichlaes Sep 27, 2024
40680fe
Revert "resolves #939"
nichlaes Sep 27, 2024
954f236
Revert "resolves #938"
nichlaes Sep 27, 2024
b66e0cc
Revert "updated lock"
nichlaes Sep 27, 2024
118b4ef
revert changes to runner
nichlaes Sep 27, 2024
c22d5e4
Revert "resolves #935"
nichlaes Sep 27, 2024
db582e7
Revert "resolves #934"
nichlaes Sep 27, 2024
3d8ab1c
Revert "resolves #933"
nichlaes Sep 27, 2024
bd935a8
revert changes to runner
nichlaes Sep 27, 2024
8680bcd
renamed eslint file
nichlaes Sep 30, 2024
3ad2a72
renamed
nichlaes Oct 1, 2024
344150c
changed to module
nichlaes Oct 1, 2024
ae93e55
updated config files
nichlaes Oct 2, 2024
bb58e4b
renamed config
nichlaes Oct 3, 2024
cd35cd3
updates configuration
nichlaes Oct 3, 2024
ab18ae7
remove deprecated version field
nichlaes Oct 3, 2024
65a6182
Revert updated lock This reverts commit 50d2162a4eb7d1e0343666514a993…
nichlaes Oct 4, 2024
99a2883
Revert updated lock
nichlaes Oct 4, 2024
906b06a
update packages
nichlaes Oct 4, 2024
9d12717
update package lock
nichlaes Oct 4, 2024
9dbb9b9
update config
nichlaes Oct 4, 2024
897f774
adds os matrix
nichlaes Oct 8, 2024
4f8bc11
adds seperate checks for windows and linux
nichlaes Oct 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions .github/workflows/lib-ms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ on:
jobs:
test-lib-ms:
name: Test library microservice
runs-on: ubuntu-latest
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: servers/lib
Expand Down Expand Up @@ -67,15 +70,26 @@ jobs:
yarn build
yarn start:pm2

- name: Check server is running
- name: Check server is running (Windows)
if: runner.os == 'Windows'
env:
PORT: 4003
uses: nick-fields/retry@v3
with:
timeout_seconds: 10
max_attempts: 4
command: "Invoke-WebRequest -Uri http://localhost:${{ env.PORT }}/lib/files -Method Head -UseBasicParsing"

- name: Check server is running (Linux)
if: runner.os != 'Windows'
env:
PORT: 4003
uses: nick-fields/retry@v3
with:
timeout_seconds: 10
max_attempts: 4
command: "curl -f -LI http://localhost:${{ env.PORT }}/lib/files"

- name: Run http test
env:
PORT: 4003
Expand Down
6 changes: 0 additions & 6 deletions servers/lib/.eslintignore

This file was deleted.

53 changes: 0 additions & 53 deletions servers/lib/.eslintrc

This file was deleted.

1 change: 0 additions & 1 deletion servers/lib/compose.lib.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3'
services:
libms:
image: intocps/libms:latest
Expand Down
60 changes: 60 additions & 0 deletions servers/lib/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { fixupConfigRules } from '@eslint/compat';
import { FlatCompat } from '@eslint/eslintrc';
import globals from 'globals';
import jest from 'eslint-plugin-jest';
import js from '@eslint/js';
import prettier from 'eslint-config-prettier';
import ts from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import imprt from 'eslint-plugin-import'; // 'import' is ambiguous & prettier has trouble

const flatCompat = new FlatCompat();

export default [
{
...js.configs.recommended,
files: ['src/**', 'test/**'],
},
{
...fixupConfigRules(flatCompat.extends('airbnb-base')),
files: ['src/**', 'test/**'],
},
prettier,
{
languageOptions: {
globals: {
...globals.jest,
...globals.node,
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parser: tsParser,
parserOptions: {
project: './tsconfig.json',
requireConfigFile: false,
ecmaVersion: 2022,
ecmaFeatures: { modules: true },
},
},
files: ['src/**', 'test/**'],
plugins: { jest, '@typescript-eslint': ts, import: imprt, ts },
rules: {
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'no-console': 'error',
'import/first': 'error',
'linebreak-style': 0, // disable linter linebreak rule, to allow for both unix and windows developement
'import/no-unresolved': 'off', // Whatever IDE will pass an error if if the module is not found, so no reason for this..
'import/extensions': 'off', // That includes the production build.. We use linter for code checking / clean code optimization..
'no-use-before-define': 'off',
},
ignores: [
'api/*',
'build/*',
'coverage/*',
'dist/*',
'node_modules/*',
'script/*',
'src/types.ts',
],
},
];
31 changes: 0 additions & 31 deletions servers/lib/jest.config.json

This file was deleted.

47 changes: 47 additions & 0 deletions servers/lib/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { createDefaultEsmPreset, type JestConfigWithTsJest } from 'ts-jest';

const jestConfig: JestConfigWithTsJest = {
testEnvironment: 'node',
transform: {
...createDefaultEsmPreset().transform,
'\\.[jt]sx?$": "ts-jest': [
'ts-jest',
{
useESM: true,
},
],
},
collectCoverage: true,
coverageReporters: ['text', 'cobertura', 'clover', 'lcov', 'json'],
collectCoverageFrom: ['src/**/*.{ts,js}'],
coveragePathIgnorePatterns: [
'node_modules',
'./dist',
'./src/app.module.ts',
'./src/main.ts',
'./src/bootstrap.ts',
],
extensionsToTreatAsEsm: ['.ts'],
moduleFileExtensions: ['js', 'json', 'ts'],
modulePathIgnorePatterns: [],
coverageDirectory: '<rootDir>/coverage/',
coverageThreshold: {
global: {
branches: 20,
functions: 30,
lines: 50,
statements: 50,
},
},
verbose: true,
testRegex: './test/.*\\.spec.tsx?$',
modulePaths: ['<rootDir>', '<rootDir>/src/', '<rootDir>/test/'],
moduleDirectories: ['node_modules', 'src', 'test'],
rootDir: './',
roots: ['<rootDir>', 'src/', 'test/'],
moduleNameMapper: {
'^(\\.\\.?\\/.+)\\.jsx?$': '$1',
},
};

export default jestConfig;
91 changes: 48 additions & 43 deletions servers/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,72 +10,77 @@
],
"private": false,
"license": "SEE LICENSE IN <LICENSE.md>",
"type": "module",
"main": "dist/src/main.js",
"scripts": {
"build": "tsc",
"clean": "npx rimraf build node_modules coverage dist src.svg test.svg",
"format": "prettier --ignore-path ../.gitignore --write \"**/*.{ts,tsx,css,scss}\"",
"graph": "npx madge --image src.svg src && npx madge --image test.svg test",
"start": "node dist/src/main.js",
"start:pm2": "pm2 start pm2.config.js",
"start": "tsc & node dist/src/main.js",
"start:pm2": "pm2 start pm2.config.cjs",
"stop:pm2": "pm2 delete libms",
"syntax": "eslint . --fix",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gives the following error (only on Windows):

$ yarn syntax
yarn run v1.22.19
$ eslint . --fix

Oops! Something went wrong! :(

ESLint: 9.11.1

ConfigError: Config (unnamed): Unexpected key "0" found.
    at rethrowConfigError (C:\Users\user\git\DTaaS\servers\lib\node_modules\@eslint\config-array\dist\cjs\index.cjs:303:8)
    at C:\Users\user\git\DTaaS\servers\lib\node_modules\@eslint\config-array\dist\cjs\index.cjs:1098:5
    at Array.reduce (<anonymous>)
    at FlatConfigArray.getConfigWithStatus (C:\Users\user\git\DTaaS\servers\lib\node_modules\@eslint\config-array\dist\cjs\index.cjs:1091:43)
    at FlatConfigArray.getConfig (C:\Users\user\git\DTaaS\servers\lib\node_modules\@eslint\config-array\dist\cjs\index.cjs:1120:15)
    at C:\Users\user\git\DTaaS\servers\lib\node_modules\eslint\lib\eslint\eslint-helpers.js:354:54
    at C:\Users\user\git\DTaaS\servers\lib\node_modules\eslint\lib\eslint\eslint-helpers.js:296:32
    at Object.isAppliedFilter (C:\Users\user\git\DTaaS\servers\lib\node_modules\@nodelib\fs.walk\out\readers\common.js:12:31)
    at AsyncReader._handleEntry (C:\Users\user\git\DTaaS\servers\lib\node_modules\@nodelib\fs.walk\out\readers\async.js:86:20)
    at C:\Users\user\git\DTaaS\servers\lib\node_modules\@nodelib\fs.walk\out\readers\async.js:65:22
error Command failed with exit code 2.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get that error

"pretest": "npx shx cp test/data/user2/tools/README.md ../../files/user2/tools/README.md",
"posttest": "npx rimraf ../../files/user2/tools/README.md",
"test:all": "npx cross-env LOCAL_PATH=test/data jest --testPathIgnorePatterns=cloudcmd --coverage",
"test:e2e": "npx cross-env LOCAL_PATH=test/data jest --config ./test/jest-e2e.json --coverage",
"test:all": "npx cross-env NODE_OPTIONS=--experimental-vm-modules LOCAL_PATH=test/data jest --testPathIgnorePatterns=cloudcmd --coverage",
"test:e2e": "npx cross-env NODE_OPTIONS=--experimental-vm-modules LOCAL_PATH=test/data jest --config ./test/jest-e2e.json --coverage",
"test:http": "yarn build && pm2 start -f --name libms-test dist/src/main.js -- -c .env -H ./config/http.json && jest test/cloudcmd --coverage --coverageThreshold=\"{}\" && pm2 delete libms-test",
"test:http-nocov": "yarn build && pm2 start -f --name libms-test dist/src/main.js -- -c .env -H ./config/http.json && jest test/cloudcmd --coverage=false && pm2 delete libms-test",
"test:http-github": "jest test/cloudcmd --coverage --coverageThreshold=\"{}\"",
"test:int": "npx cross-env LOCAL_PATH=test/data jest ../test/integration --coverage",
"test:int": "npx cross-env NODE_OPTIONS=--experimental-vm-modules LOCAL_PATH=test/data jest ../test/integration --coverage",
"test:nocov": "yarn test:http-nocov && npx cross-env LOCAL_PATH=test/data jest --testPathIgnorePatterns=cloudcmd --coverage=false",
"test:unit": "npx cross-env LOCAL_PATH=test/data jest ../test/unit --coverage"
"test:unit": "npx cross-env NODE_OPTIONS=--experimental-vm-modules LOCAL_PATH=test/data jest ../test/unit --coverage"
},
"bin": "./dist/src/main.js",
"dependencies": {
"@apollo/client": "^3.8.9",
"@apollo/server": "^4.10.0",
"@nestjs/apollo": "^12.0.11",
"@nestjs/common": "^10.3.7",
"@nestjs/config": "^3.2.0",
"@nestjs/core": "^10.3.3",
"@nestjs/graphql": "^12.0.11",
"@nestjs/platform-express": "^10.3.7",
"axios": "^1.5.1",
"cloudcmd": "^16.17.7",
"commander": "^11.1.0",
"dotenv": "^16.3.1",
"graphql": "^16.8.1",
"mock-fs": "^5.2.0",
"reflect-metadata": "^0.2.1",
"@apollo/client": "^3.11.8",
"@apollo/server": "^4.11.0",
"@nestjs/apollo": "^12.2.0",
"@nestjs/common": "^10.4.4",
"@nestjs/config": "^3.2.3",
"@nestjs/core": "^10.4.4",
"@nestjs/graphql": "^12.2.0",
"@nestjs/platform-express": "^10.4.4",
"axios": "^1.7.7",
"cloudcmd": "^18.1.0",
"commander": "^12.1.0",
"dotenv": "^16.4.5",
"globals": "^15.9.0",
"graphql": "^16.9.0",
"mock-fs": "^5.3.0",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.1",
"socket.io": "^4.7.2",
"type-graphql": "^2.0.0-beta.3"
"socket.io": "^4.8.0",
"type-graphql": "^2.0.0-rc.2"
},
"devDependencies": {
"@nestjs/cli": "^10.3.2",
"@nestjs/schematics": "^10.1.1",
"@nestjs/testing": "^10.3.3",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.12",
"@types/node": "20.12.5",
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@nestjs/cli": "^10.4.5",
"@nestjs/schematics": "^10.1.4",
"@nestjs/testing": "^10.4.4",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.13",
"@types/node": "22.7.0",
"@types/supertest": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^8.4.0",
"@typescript-eslint/parser": "^8.4.0",
"@typescript-eslint/eslint-plugin": "^8.8.0",
"@typescript-eslint/parser": "^8.8.0",
"cross-fetch": "^4.0.0",
"eslint": "^8.56.0",
"eslint": "^9.11.1",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^28.2.0",
"eslint-plugin-prettier": "^5.1.3",
"graphql-scalars": "^1.22.2",
"jest": "29.7.0",
"prettier": "^3.2.2",
"react": "^18.2.0",
"supertest": "^6.3.4",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^28.8.3",
"eslint-plugin-prettier": "^5.2.1",
"graphql-scalars": "^1.23.0",
"jest": "^29.7.0",
"prettier": "^3.3.3",
"react": "^18.3.1",
"supertest": "^7.0.0",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"tsconfig-paths": "4.2.0",
"typescript": "^5.2.2"
"typescript": "^5.6.2"
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion servers/lib/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { ApolloDriver } from '@nestjs/apollo';
import { join } from 'path';
import FilesModule from './files/files.module';
import FilesModule from './files/files.module.js';

@Module({
imports: [
Expand Down
4 changes: 2 additions & 2 deletions servers/lib/src/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { NestFactory } from '@nestjs/core';
import { ConfigService } from '@nestjs/config';
import * as dotenv from 'dotenv';
import AppModule from './app.module';
import cloudCMD from './cloudcmd/cloudcmd';
import AppModule from './app.module.js';
import cloudCMD from './cloudcmd/cloudcmd.js';

type BootstrapOptions = {
config?: string;
Expand Down
2 changes: 1 addition & 1 deletion servers/lib/src/cloudcmd/cloudcmd.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { INestApplication } from '@nestjs/common';
import { Server } from 'socket.io';
import * as cloudcmd from 'cloudcmd';
import cloudcmd from 'cloudcmd';
import { join, relative } from 'path';

const isWindowsAbsolutePath = (filesPath: string) => filesPath.includes(':');
Expand Down
Loading
Loading