diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f8a2d46..7fce967 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,6 +23,12 @@ jobs: run: npm install working-directory: electron-app + - name: lint/format + env: + CI: false + run: npm run ci:format + working-directory: electron-app + - name: test env: CI: false diff --git a/electron-app/.eslintignore b/electron-app/.eslintignore new file mode 100644 index 0000000..a17f116 --- /dev/null +++ b/electron-app/.eslintignore @@ -0,0 +1,5 @@ +build +node_modules +out +forge.config.js +vitest.config.ts \ No newline at end of file diff --git a/electron-app/.eslintrc.js b/electron-app/.eslintrc.js new file mode 100644 index 0000000..5581aa9 --- /dev/null +++ b/electron-app/.eslintrc.js @@ -0,0 +1,30 @@ +module.exports = { + env: { + browser: true, + es2021: true, + }, + extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], + overrides: [ + { + env: { + node: true, + }, + files: ['.eslintrc.{js,cjs}'], + parserOptions: { + sourceType: 'script', + }, + }, + ], + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + }, + plugins: ['@typescript-eslint'], + rules: { + indent: ['error', 2], + 'linebreak-style': ['error', 'unix'], + quotes: ['error', 'single'], + '@typescript-eslint/ban-types': 'off', + }, +}; diff --git a/electron-app/.prettierignore b/electron-app/.prettierignore new file mode 100644 index 0000000..78dc242 --- /dev/null +++ b/electron-app/.prettierignore @@ -0,0 +1,3 @@ +build +node_modules +out \ No newline at end of file diff --git a/electron-app/.prettierrc.js b/electron-app/.prettierrc.js new file mode 100644 index 0000000..29898f6 --- /dev/null +++ b/electron-app/.prettierrc.js @@ -0,0 +1,12 @@ +// .prettierrc.js +module.exports = { + printWidth: 120, + singleQuote: true, + useTabs: false, + tabWidth: 2, + bracketSpacing: true, + trailingComma: 'all', + bracketSameLine: true, + singleAttributePerLine: true, + htmlWhitespaceSensitivity: 'ignore', +}; diff --git a/electron-app/forge.config.js b/electron-app/forge.config.js index 5b8911c..62ae5e0 100644 --- a/electron-app/forge.config.js +++ b/electron-app/forge.config.js @@ -1,39 +1,39 @@ module.exports = { packagerConfig: { asar: true, - icon: "public/logo.png", - name: "Nuclia sync", - executableName: "nuclia-sync-agent", + icon: 'public/logo.png', + name: 'Nuclia sync', + executableName: 'nuclia-sync-agent', }, rebuildConfig: {}, makers: [ { - name: "@electron-forge/maker-squirrel", + name: '@electron-forge/maker-squirrel', }, { - name: "@electron-forge/maker-zip", - platforms: ["darwin"], + name: '@electron-forge/maker-zip', + platforms: ['darwin'], }, { - name: "@electron-forge/maker-deb", + name: '@electron-forge/maker-deb', config: {}, }, { - name: "@electron-forge/maker-dmg", + name: '@electron-forge/maker-dmg', config: {}, }, { - name: "@electron-forge/maker-rpm", + name: '@electron-forge/maker-rpm', config: {}, }, ], publishers: [ { - name: "@electron-forge/publisher-github", + name: '@electron-forge/publisher-github', config: { repository: { - owner: "nuclia", - name: "sync-agent", + owner: 'nuclia', + name: 'sync-agent', }, draft: true, }, diff --git a/electron-app/package-lock.json b/electron-app/package-lock.json index f54acff..dd1c033 100644 --- a/electron-app/package-lock.json +++ b/electron-app/package-lock.json @@ -27,7 +27,12 @@ "@types/compression": "^1.7.5", "@types/express": "^4.17.21", "@types/uuid": "^9.0.7", + "@typescript-eslint/eslint-plugin": "^6.12.0", + "@typescript-eslint/parser": "^6.12.0", "electron": "^27.0.4", + "eslint": "^8.54.0", + "eslint-config-prettier": "9.0.0", + "prettier": "3.1.0", "supertest": "^6.3.3", "vite-tsconfig-paths": "^4.2.1", "vitest": "^0.34.6" @@ -36,6 +41,15 @@ "node": ">=20.0.0" } }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@electron-forge/cli": { "version": "6.4.2", "resolved": "https://registry.npmjs.org/@electron-forge/cli/-/cli-6.4.2.tgz", @@ -957,12 +971,101 @@ "node": ">=12" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.3.tgz", + "integrity": "sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/js": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.54.0.tgz", + "integrity": "sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, "node_modules/@gar/promisify": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", "dev": true }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.13", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", + "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", + "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", + "dev": true + }, "node_modules/@jest/schemas": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", @@ -1514,6 +1617,12 @@ "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==", "dev": true }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, "node_modules/@types/keyv": { "version": "3.1.4", "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", @@ -1566,6 +1675,12 @@ "@types/node": "*" } }, + "node_modules/@types/semver": { + "version": "7.5.6", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", + "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", + "dev": true + }, "node_modules/@types/send": { "version": "0.17.4", "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", @@ -1603,6 +1718,201 @@ "@types/node": "*" } }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.12.0.tgz", + "integrity": "sha512-XOpZ3IyJUIV1b15M7HVOpgQxPPF7lGXgsfcEIu3yDxFPaf/xZKt7s9QO/pbk7vpWQyVulpJbu4E5LwpZiQo4kA==", + "dev": true, + "dependencies": { + "@eslint-community/regexpp": "^4.5.1", + "@typescript-eslint/scope-manager": "6.12.0", + "@typescript-eslint/type-utils": "6.12.0", + "@typescript-eslint/utils": "6.12.0", + "@typescript-eslint/visitor-keys": "6.12.0", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.12.0.tgz", + "integrity": "sha512-s8/jNFPKPNRmXEnNXfuo1gemBdVmpQsK1pcu+QIvuNJuhFzGrpD7WjOcvDc/+uEdfzSYpNu7U/+MmbScjoQ6vg==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "6.12.0", + "@typescript-eslint/types": "6.12.0", + "@typescript-eslint/typescript-estree": "6.12.0", + "@typescript-eslint/visitor-keys": "6.12.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.12.0.tgz", + "integrity": "sha512-5gUvjg+XdSj8pcetdL9eXJzQNTl3RD7LgUiYTl8Aabdi8hFkaGSYnaS6BLc0BGNaDH+tVzVwmKtWvu0jLgWVbw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.12.0", + "@typescript-eslint/visitor-keys": "6.12.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.12.0.tgz", + "integrity": "sha512-WWmRXxhm1X8Wlquj+MhsAG4dU/Blvf1xDgGaYCzfvStP2NwPQh6KBvCDbiOEvaE0filhranjIlK/2fSTVwtBng==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "6.12.0", + "@typescript-eslint/utils": "6.12.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.12.0.tgz", + "integrity": "sha512-MA16p/+WxM5JG/F3RTpRIcuOghWO30//VEOvzubM8zuOOBYXsP+IfjoCXXiIfy2Ta8FRh9+IO9QLlaFQUU+10Q==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.12.0.tgz", + "integrity": "sha512-vw9E2P9+3UUWzhgjyyVczLWxZ3GuQNT7QpnIY3o5OMeLO/c8oHljGc8ZpryBMIyympiAAaKgw9e5Hl9dCWFOYw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.12.0", + "@typescript-eslint/visitor-keys": "6.12.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.12.0.tgz", + "integrity": "sha512-LywPm8h3tGEbgfyjYnu3dauZ0U7R60m+miXgKcZS8c7QALO9uWJdvNoP+duKTk2XMWc7/Q3d/QiCuLN9X6SWyQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.12.0", + "@typescript-eslint/types": "6.12.0", + "@typescript-eslint/typescript-estree": "6.12.0", + "semver": "^7.5.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.12.0.tgz", + "integrity": "sha512-rg3BizTZHF1k3ipn8gfrzDXXSFKyOEB5zxYXInQ6z0hUvmQlhaZQzK+YmHmNViMA9HzW5Q9+bPPt90bU6GQwyw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.12.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, "node_modules/@vitest/expect": { "version": "0.34.6", "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.34.6.tgz", @@ -1737,6 +2047,15 @@ "node": ">=0.4.0" } }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/acorn-walk": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.0.tgz", @@ -1783,6 +2102,22 @@ "node": ">=8" } }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -1870,11 +2205,26 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/asap": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", @@ -2291,6 +2641,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/chai": { "version": "4.3.10", "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", @@ -2752,6 +3111,12 @@ "node": ">=6" } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, "node_modules/defaults": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", @@ -2887,6 +3252,39 @@ "minimatch": "^3.0.4" } }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dir-glob/node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/ds-store": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/ds-store/-/ds-store-0.1.6.tgz", @@ -3472,7 +3870,6 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, - "optional": true, "engines": { "node": ">=10" }, @@ -3480,6 +3877,172 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/eslint": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.54.0.tgz", + "integrity": "sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.3", + "@eslint/js": "8.54.0", + "@humanwhocodes/config-array": "^0.11.13", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-config-prettier": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.0.0.tgz", + "integrity": "sha512-IcJsTkJae2S35pRsRAwoCE+925rJJStOdkKnLVgtE+tEpqU0EVVM7OqrwxqgptKdX29NUwC82I5pXsGFIgSevw==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -3677,6 +4240,12 @@ "@types/yauzl": "^2.9.1" } }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, "node_modules/fast-glob": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", @@ -3693,6 +4262,18 @@ "node": ">=8.6.0" } }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, "node_modules/fast-safe-stringify": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", @@ -3717,6 +4298,18 @@ "pend": "~1.2.0" } }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, "node_modules/filename-reserved-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", @@ -3801,6 +4394,26 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/flat-cache": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dev": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.9", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", + "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", + "dev": true + }, "node_modules/flora-colossus": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/flora-colossus/-/flora-colossus-2.0.0.tgz", @@ -4199,6 +4812,33 @@ "which": "bin/which" } }, + "node_modules/globals": { + "version": "13.23.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", + "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globals/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/globalthis": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", @@ -4215,6 +4855,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/globrex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", @@ -4263,6 +4923,12 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -4452,6 +5118,15 @@ } ] }, + "node_modules/ignore": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", + "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, "node_modules/image-size": { "version": "0.7.5", "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.7.5.tgz", @@ -4465,6 +5140,22 @@ "node": ">=6.9.0" } }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/imul": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/imul/-/imul-1.0.1.tgz", @@ -4651,6 +5342,15 @@ "node": ">=0.12.0" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-plain-object": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", @@ -4727,12 +5427,36 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", "dev": true }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -4786,6 +5510,19 @@ "json-buffer": "3.0.1" } }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/listr2": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.8.tgz", @@ -4874,6 +5611,12 @@ "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", "dev": true }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "node_modules/lodash.template": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz", @@ -5348,6 +6091,12 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -5573,6 +6322,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/optionator": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "dev": true, + "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/ora": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", @@ -5686,6 +6452,18 @@ "node": ">=6" } }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/parse-author": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/parse-author/-/parse-author-2.0.0.tgz", @@ -5959,6 +6737,30 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz", + "integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-format": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", @@ -6035,6 +6837,15 @@ "once": "^1.3.1" } }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/qs": { "version": "6.11.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", @@ -6318,6 +7129,15 @@ "node": ">=0.10.0" } }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/resolve-package": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/resolve-package/-/resolve-package-1.0.1.tgz", @@ -6687,6 +7507,15 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/slice-ansi": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", @@ -6901,6 +7730,18 @@ "node": ">=0.10.0" } }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/strip-literal": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.3.0.tgz", @@ -7088,6 +7929,12 @@ "rimraf": "bin.js" } }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -7215,6 +8062,18 @@ "node": ">=0.8.0" } }, + "node_modules/ts-api-utils": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", + "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", + "dev": true, + "engines": { + "node": ">=16.13.0" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, "node_modules/tsconfck": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-2.1.2.tgz", @@ -7241,6 +8100,18 @@ "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", "dev": true }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -7355,6 +8226,15 @@ "node": ">= 0.8" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/username": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/username/-/username-5.1.0.tgz", diff --git a/electron-app/package.json b/electron-app/package.json index 2d61bd9..2f6f85f 100644 --- a/electron-app/package.json +++ b/electron-app/package.json @@ -10,9 +10,12 @@ "package": "electron-forge package", "make": "npm run compile && electron-forge make", "publish": "electron-forge publish", - "lint": "echo \"No linting configured\"", + "lint": "eslint .", "test": "vitest run", - "test:watch": "vitest" + "test:watch": "vitest", + "format:check": "prettier . --check", + "format": "prettier . --write", + "ci:format": "prettier . --check && eslint ." }, "keywords": [], "author": { @@ -39,7 +42,12 @@ "@types/compression": "^1.7.5", "@types/express": "^4.17.21", "@types/uuid": "^9.0.7", + "@typescript-eslint/eslint-plugin": "^6.12.0", + "@typescript-eslint/parser": "^6.12.0", "electron": "^27.0.4", + "eslint": "^8.54.0", + "eslint-config-prettier": "9.0.0", + "prettier": "3.1.0", "supertest": "^6.3.3", "vite-tsconfig-paths": "^4.2.1", "vitest": "^0.34.6" diff --git a/electron-app/src/events/events.ts b/electron-app/src/events/events.ts index 01dd32c..6ff23da 100644 --- a/electron-app/src/events/events.ts +++ b/electron-app/src/events/events.ts @@ -1,6 +1,6 @@ export enum EVENTS { - START_LISTENING = "start-listening", - STOP_LISTENING = "stop-listening", + START_LISTENING = 'start-listening', + STOP_LISTENING = 'stop-listening', } export type EVENTS_TYPE = (typeof EVENTS)[keyof typeof EVENTS]; @@ -20,13 +20,12 @@ export class EventEmitter { // Unsubscribe from an event public unSubscribe(eventName: EVENTS_TYPE, fn: Function): void { if (this.events[eventName]) { - this.events[eventName] = this.events[eventName].filter( - (eventFn) => fn !== eventFn - ); + this.events[eventName] = this.events[eventName].filter((eventFn) => fn !== eventFn); } } // Emit an event + // eslint-disable-next-line @typescript-eslint/no-explicit-any public emit(eventName: EVENTS_TYPE, data?: any): void { const event = this.events[eventName]; if (event) { diff --git a/electron-app/src/fileSystemFn.ts b/electron-app/src/fileSystemFn.ts index 6b5c620..003ccb1 100644 --- a/electron-app/src/fileSystemFn.ts +++ b/electron-app/src/fileSystemFn.ts @@ -1,16 +1,13 @@ -import { constants } from "fs"; -import fs from "fs/promises"; -import path from "path"; +import { constants } from 'fs'; +import fs from 'fs/promises'; +import path from 'path'; -export async function createFile( - path: string, - content: string | Uint8Array -): Promise { +export async function createFile(path: string, content: string | Uint8Array): Promise { try { await fs.writeFile(path, content); console.log(`File created at ${path}`); } catch (error) { - console.error("Error creating file:", error); + console.error('Error creating file:', error); } } @@ -19,7 +16,7 @@ export async function createDirectory(path: string): Promise { await fs.mkdir(path, { recursive: true }); console.log(`Directory deleted at ${path}`); } catch (error) { - console.error("Error delete directory:", error); + console.error('Error delete directory:', error); } } @@ -28,7 +25,7 @@ export async function deleteDirectory(path: string): Promise { await fs.rmdir(path, { recursive: true }); console.log(`Directory created at ${path}`); } catch (error) { - console.error("Error creating directory:", error); + console.error('Error creating directory:', error); } } @@ -41,11 +38,8 @@ export async function pathExists(path: string): Promise { } } -export async function findFilesInDirectory( - directory: string, - extensions: string[] -): Promise { - let result: string[] = []; +export async function findFilesInDirectory(directory: string, extensions: string[]): Promise { + const result: string[] = []; async function walk(currentPath: string) { const items = await fs.readdir(currentPath, { withFileTypes: true }); diff --git a/electron-app/src/fileSystemServerFn.ts b/electron-app/src/fileSystemServerFn.ts index 4d3a1ab..5873b46 100644 --- a/electron-app/src/fileSystemServerFn.ts +++ b/electron-app/src/fileSystemServerFn.ts @@ -1,4 +1,4 @@ -import { createDirectory, createFile, pathExists } from "./fileSystemFn"; +import { createDirectory, createFile, pathExists } from './fileSystemFn'; const defaultConfig = { syncPeriod: 3600, // In seconds diff --git a/electron-app/src/index.ts b/electron-app/src/index.ts index de0652e..9fd18f7 100644 --- a/electron-app/src/index.ts +++ b/electron-app/src/index.ts @@ -1,10 +1,10 @@ -import { Menu, Tray, app, nativeImage } from "electron"; -import os from "os"; -import path from "path"; -import { EVENTS } from "./events/events"; -import { beforeStartServer } from "./fileSystemServerFn"; -import { AppFileSystemRoutes } from "./presentation/routes"; -import { Server, eventEmitter } from "./server"; +import { Menu, Tray, app, nativeImage } from 'electron'; +import os from 'os'; +import path from 'path'; +import { EVENTS } from './events/events'; +import { beforeStartServer } from './fileSystemServerFn'; +import { AppFileSystemRoutes } from './presentation/routes'; +import { Server, eventEmitter } from './server'; let contextMenu: Electron.Menu; let tray = null; @@ -13,7 +13,7 @@ const appRoutes = new AppFileSystemRoutes(basePath); const server = new Server({ port: 8000, routes: appRoutes.getRoutes() }); // Handle creating/removing shortcuts on Windows when installing/uninstalling. -if (require("electron-squirrel-startup")) { +if (require('electron-squirrel-startup')) { app.quit(); } @@ -27,39 +27,33 @@ const updateTrayAfterStopServer = () => { }; const createWindow = async () => { - const icon = nativeImage.createFromPath( - path.join(__dirname, "../public/logo.png") - ); + const icon = nativeImage.createFromPath(path.join(__dirname, '../public/logo.png')); tray = new Tray(icon); contextMenu = Menu.buildFromTemplate([ { - label: "Start App", + label: 'Start App', click: () => { server.start(); }, - icon: nativeImage.createFromPath( - path.join(__dirname, "../public/play.png") - ), + icon: nativeImage.createFromPath(path.join(__dirname, '../public/play.png')), }, { - label: "Stop App", + label: 'Stop App', click: () => { server.close(); }, visible: false, - icon: nativeImage.createFromPath( - path.join(__dirname, "../public/square.png") - ), + icon: nativeImage.createFromPath(path.join(__dirname, '../public/square.png')), }, { - label: "Exit", + label: 'Exit', click: () => { app.quit(); }, }, ]); - tray.setToolTip("Nuclia sync"); + tray.setToolTip('Nuclia sync'); tray.setContextMenu(contextMenu); await beforeStartServer(basePath); server.start(); @@ -68,7 +62,7 @@ const createWindow = async () => { // This method will be called when Electron has finished // initialization and is ready to create browser windows. // Some APIs can only be used after this event occurs. -app.on("ready", createWindow); +app.on('ready', createWindow); eventEmitter.subscribe(EVENTS.START_LISTENING, updateTrayAfterStartServer); eventEmitter.subscribe(EVENTS.STOP_LISTENING, updateTrayAfterStopServer); diff --git a/electron-app/src/presentation/connectors/routes.ts b/electron-app/src/presentation/connectors/routes.ts index 264e147..b4e719d 100644 --- a/electron-app/src/presentation/connectors/routes.ts +++ b/electron-app/src/presentation/connectors/routes.ts @@ -1,4 +1,4 @@ -import { Router } from "express"; +import { Router } from 'express'; export class ConnectorsRoutes { constructor() {} @@ -6,7 +6,7 @@ export class ConnectorsRoutes { getRoutes(): Router { const router = Router(); - router.get("/", async (_req, res) => { + router.get('/', async (_req, res) => { res.status(200).send([]); }); diff --git a/electron-app/src/presentation/routes.ts b/electron-app/src/presentation/routes.ts index 3b798d1..eef7513 100644 --- a/electron-app/src/presentation/routes.ts +++ b/electron-app/src/presentation/routes.ts @@ -1,6 +1,6 @@ -import { Router } from "express"; +import { Router } from 'express'; -import { SourceFileSystemRoutes } from "./source/routes"; +import { SourceFileSystemRoutes } from './source/routes'; export class AppFileSystemRoutes { private readonly basePath: string; @@ -12,7 +12,7 @@ export class AppFileSystemRoutes { getRoutes(): Router { const router = Router(); const sourceFileSystemRoutes = new SourceFileSystemRoutes(this.basePath); - router.use("/sources", sourceFileSystemRoutes.getRoutes()); + router.use('/sources', sourceFileSystemRoutes.getRoutes()); return router; } } diff --git a/electron-app/src/presentation/source/routes.ts b/electron-app/src/presentation/source/routes.ts index 62ed1c5..5167aa8 100644 --- a/electron-app/src/presentation/source/routes.ts +++ b/electron-app/src/presentation/source/routes.ts @@ -1,7 +1,7 @@ -import { Router } from "express"; -import fs from "fs/promises"; -import { v4 as uuidv4 } from "uuid"; -import { pathExists } from "../../fileSystemFn"; +import { Router } from 'express'; +import fs from 'fs/promises'; +import { v4 as uuidv4 } from 'uuid'; +import { pathExists } from '../../fileSystemFn'; export class SourceFileSystemRoutes { private readonly basePath: string; @@ -13,26 +13,24 @@ export class SourceFileSystemRoutes { getRoutes(): Router { const router = Router(); - router.use("/", async (_req, res, next) => { + router.use('/', async (_req, res, next) => { if (!(await pathExists(`${this.basePath}/sources.json`))) { - res.status(404).send({ error: "Nuclia folder not found" }); + res.status(404).send({ error: 'Nuclia folder not found' }); return; } next(); }); - router.get("/", async (_req, res) => { - const data = await fs.readFile(`${this.basePath}/sources.json`, "utf8"); + router.get('/', async (_req, res) => { + const data = await fs.readFile(`${this.basePath}/sources.json`, 'utf8'); res.status(200).send(JSON.parse(data)); }); - router.post("/", async (req, res) => { + router.post('/', async (req, res) => { const dataNewSource = req.body; const uuid = uuidv4(); - const currentSources = JSON.parse( - await fs.readFile(`${this.basePath}/sources.json`, "utf8") - ); + const currentSources = JSON.parse(await fs.readFile(`${this.basePath}/sources.json`, 'utf8')); const sourceAlreadyExists = uuid in currentSources; if (sourceAlreadyExists) { res.status(409).send({ @@ -41,22 +39,17 @@ export class SourceFileSystemRoutes { return; } currentSources[uuid] = dataNewSource; - await fs.writeFile( - `${this.basePath}/sources.json`, - JSON.stringify(currentSources, null, 2) - ); + await fs.writeFile(`${this.basePath}/sources.json`, JSON.stringify(currentSources, null, 2)); res.status(201).send({ id: dataNewSource.id, }); }); - router.get("/:id", async (req, res) => { + router.get('/:id', async (req, res) => { const { id } = req.params; try { - const currentSources = JSON.parse( - await fs.readFile(`${this.basePath}/sources.json`, "utf8") - ); + const currentSources = JSON.parse(await fs.readFile(`${this.basePath}/sources.json`, 'utf8')); if (!(id in currentSources)) { res.status(404).send(null); } else { @@ -68,13 +61,11 @@ export class SourceFileSystemRoutes { } }); - router.patch("/:id", async (req, res) => { + router.patch('/:id', async (req, res) => { const { id } = req.params; const dataNewSource = req.body; try { - const currentSources = JSON.parse( - await fs.readFile(`${this.basePath}/sources.json`, "utf8") - ); + const currentSources = JSON.parse(await fs.readFile(`${this.basePath}/sources.json`, 'utf8')); if (!(id in currentSources)) { res.status(404).send(null); } else { @@ -83,10 +74,7 @@ export class SourceFileSystemRoutes { ...dataNewSource, }; - await fs.writeFile( - `${this.basePath}/sources.json`, - JSON.stringify(currentSources, null, 2) - ); + await fs.writeFile(`${this.basePath}/sources.json`, JSON.stringify(currentSources, null, 2)); res.status(204).send(null); } } catch (error) { @@ -95,20 +83,15 @@ export class SourceFileSystemRoutes { } }); - router.delete("/:id", async (req, res) => { + router.delete('/:id', async (req, res) => { const { id } = req.params; try { - const currentSources = JSON.parse( - await fs.readFile(`${this.basePath}/sources.json`, "utf8") - ); + const currentSources = JSON.parse(await fs.readFile(`${this.basePath}/sources.json`, 'utf8')); if (!(id in currentSources)) { res.status(404).send(null); } else { delete currentSources[id]; - await fs.writeFile( - `${this.basePath}/sources.json`, - JSON.stringify(currentSources, null, 2) - ); + await fs.writeFile(`${this.basePath}/sources.json`, JSON.stringify(currentSources, null, 2)); res.status(200).send(null); } } catch (error) { diff --git a/electron-app/src/server.ts b/electron-app/src/server.ts index 1879e4d..712be61 100644 --- a/electron-app/src/server.ts +++ b/electron-app/src/server.ts @@ -1,7 +1,7 @@ -import compression from "compression"; -import express, { Router } from "express"; -import http from "http"; -import { EVENTS, EventEmitter } from "./events/events"; +import compression from 'compression'; +import express, { Router } from 'express'; +import http from 'http'; +import { EVENTS, EventEmitter } from './events/events'; // appExpress.patch("/config/:paramKey", async (req, res) => { // try { @@ -54,15 +54,15 @@ export class Server { //* Routes this.app.use(this.routes); - this.app.get("/", async (_req, res) => { - res.status(200).send("Server is running"); + this.app.get('/', async (_req, res) => { + res.status(200).send('Server is running'); }); - this.app.get("/status", async (_req, res) => { - res.status(200).send("Server is running"); + this.app.get('/status', async (_req, res) => { + res.status(200).send('Server is running'); }); - this.app.post("/stop", async (_req, res) => { + this.app.post('/stop', async (_req, res) => { this.stopServer(); res.status(200).send(null); }); @@ -78,7 +78,7 @@ export class Server { } private stopServer() { - console.log("Stop server"); + console.log('Stop server'); this.serverListener?.close(); eventEmitter.emit(EVENTS.STOP_LISTENING); } diff --git a/electron-app/src/types/server.d.ts b/electron-app/src/types/server.d.ts index c642bd5..cfd2a2c 100644 --- a/electron-app/src/types/server.d.ts +++ b/electron-app/src/types/server.d.ts @@ -1,5 +1,6 @@ export type Connector = { type: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any parameters: { [key: string]: any }; }; diff --git a/electron-app/tests/sever.spec.js b/electron-app/tests/sever.spec.js index 9113970..baf3daf 100644 --- a/electron-app/tests/sever.spec.js +++ b/electron-app/tests/sever.spec.js @@ -1,14 +1,14 @@ -import request from "supertest"; -import { afterAll, beforeAll, describe, expect, test } from "vitest"; -import { deleteDirectory } from "../src/fileSystemFn"; -import { beforeStartServer } from "../src/fileSystemServerFn"; -import { AppFileSystemRoutes } from "../src/presentation/routes"; -import { Server } from "../src/server"; - -const appRoutes = new AppFileSystemRoutes(".nuclia"); +import request from 'supertest'; +import { afterAll, beforeAll, describe, expect, test } from 'vitest'; +import { deleteDirectory } from '../src/fileSystemFn'; +import { beforeStartServer } from '../src/fileSystemServerFn'; +import { AppFileSystemRoutes } from '../src/presentation/routes'; +import { Server } from '../src/server'; + +const appRoutes = new AppFileSystemRoutes('.nuclia'); const testServer = new Server({ port: 8000, routes: appRoutes.getRoutes() }); -describe("Server without folder", () => { +describe('Server without folder', () => { beforeAll(async () => { await testServer.start(); }); @@ -16,97 +16,93 @@ describe("Server without folder", () => { await testServer.close(); }); - test("Init server", async () => { - const response = await request(testServer.app).get("/"); + test('Init server', async () => { + const response = await request(testServer.app).get('/'); expect(response.status).toBe(200); }); - test("Get sources without folder server", async () => { - const response = await request(testServer.app).get("/sources"); + test('Get sources without folder server', async () => { + const response = await request(testServer.app).get('/sources'); expect(response.status).toBe(404); }); - test("Add new source", async () => { - const response = await request(testServer.app).post("/sources").send({}); + test('Add new source', async () => { + const response = await request(testServer.app).post('/sources').send({}); expect(response.status).toBe(404); }); }); -describe("Server width folder", () => { +describe('Server width folder', () => { beforeAll(async () => { - await beforeStartServer(".nuclia"); + await beforeStartServer('.nuclia'); await testServer.start(); }); afterAll(async () => { - await deleteDirectory(".nuclia"); + await deleteDirectory('.nuclia'); await testServer.close(); }); - test("Init server", async () => { - const response = await request(testServer.app).get("/"); + test('Init server', async () => { + const response = await request(testServer.app).get('/'); expect(response.status).toBe(200); }); - test("Get sources - empty folder", async () => { - const response = await request(testServer.app).get("/sources"); + test('Get sources - empty folder', async () => { + const response = await request(testServer.app).get('/sources'); expect(response.status).toBe(200); expect(Object.keys(response.body).length).toEqual(0); }); - test("Add new source", async () => { - const response = await request(testServer.app).post("/sources").send({}); + test('Add new source', async () => { + const response = await request(testServer.app).post('/sources').send({}); expect(response.status).toBe(201); }); - test("Get all sources", async () => { - const response = await request(testServer.app).get("/sources"); + test('Get all sources', async () => { + const response = await request(testServer.app).get('/sources'); expect(response.status).toBe(200); expect(Object.keys(response.body).length).toEqual(1); }); - test("Update a source", async () => { - const response = await request(testServer.app).get("/sources"); + test('Update a source', async () => { + const response = await request(testServer.app).get('/sources'); expect(response.status).toBe(200); expect(Object.keys(response.body).length).toEqual(1); const id = Object.keys(response.body)[0]; - const responsePatch = await request(testServer.app) - .patch(`/sources/${id}`) - .send({ - name: "Source1", - }); + const responsePatch = await request(testServer.app).patch(`/sources/${id}`).send({ + name: 'Source1', + }); expect(responsePatch.status).toBe(204); }); - test("Get a updated source", async () => { - const response = await request(testServer.app).get("/sources"); + test('Get a updated source', async () => { + const response = await request(testServer.app).get('/sources'); expect(response.status).toBe(200); expect(Object.keys(response.body).length).toEqual(1); const id = Object.keys(response.body)[0]; const responseGet = await request(testServer.app).get(`/sources/${id}`); expect(responseGet.status).toBe(200); - expect(responseGet.body["name"]).toBe("Source1"); + expect(responseGet.body['name']).toBe('Source1'); }); - test("Delete a source", async () => { - let response = await request(testServer.app).get("/sources"); + test('Delete a source', async () => { + let response = await request(testServer.app).get('/sources'); expect(response.status).toBe(200); expect(Object.keys(response.body).length).toEqual(1); const id = Object.keys(response.body)[0]; - const responseDelete = await request(testServer.app).delete( - `/sources/${id}` - ); + const responseDelete = await request(testServer.app).delete(`/sources/${id}`); expect(responseDelete.status).toBe(200); - response = await request(testServer.app).get("/sources"); + response = await request(testServer.app).get('/sources'); expect(response.status).toBe(200); expect(Object.keys(response.body).length).toEqual(0); }); - test("Get connectors", async () => { - const response = await request(testServer.app).get("/sources"); + test('Get connectors', async () => { + const response = await request(testServer.app).get('/sources'); expect(response.status).toBe(200); expect(Object.keys(response.body).length).toEqual(0); }); diff --git a/electron-app/tsconfig.json b/electron-app/tsconfig.json index e998f91..cf2628b 100644 --- a/electron-app/tsconfig.json +++ b/electron-app/tsconfig.json @@ -1,10 +1,10 @@ { "compilerOptions": { - "target": "es5", - "module": "commonjs", - "strict": true, - "esModuleInterop": true, - "outDir": "./build", + "target": "es5", + "module": "commonjs", + "strict": true, + "esModuleInterop": true, + "outDir": "./build" }, "include": ["src/**/*"] -} \ No newline at end of file +} diff --git a/electron-app/vitest.config.ts b/electron-app/vitest.config.ts index c3a4c7e..ca30db2 100644 --- a/electron-app/vitest.config.ts +++ b/electron-app/vitest.config.ts @@ -1,5 +1,5 @@ -import tsconfigPaths from "vite-tsconfig-paths"; // only if you are using custom tsconfig paths -import { defineConfig } from "vitest/config"; +import tsconfigPaths from 'vite-tsconfig-paths'; // only if you are using custom tsconfig paths +import { defineConfig } from 'vitest/config'; export default defineConfig({ test: {},