From c6694e717d4ecaffea6f833bfd546af3489031f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Tesa=C5=99?= Date: Mon, 25 Sep 2023 10:19:40 +0200 Subject: [PATCH 1/3] Enable server reload on change --- packages/api/package.json | 7 +- packages/data-pusher/package.json | 7 +- pnpm-lock.yaml | 103 ++++++++++++++++++++++++++++-- 3 files changed, 109 insertions(+), 8 deletions(-) diff --git a/packages/api/package.json b/packages/api/package.json index 7008f307..54d2fa25 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -9,7 +9,7 @@ "scripts": { "build": "tsc --project .", "clean": "rm -rf coverage dist", - "dev": "pnpm ts-node src/index.ts", + "dev": "nodemon --ext ts,js,json,env --exec \"pnpm run start\"", "docker:build": "docker compose --file docker/docker-compose.yml build", "docker:start:detach": "docker compose --file docker/docker-compose.yml up --detach", "docker:start": "docker compose --file docker/docker-compose.yml up", @@ -18,13 +18,16 @@ "eslint:fix": "eslint . --ext .js,.ts --fix", "prettier:check": "prettier --check \"./**/*.{js,ts,md,json}\"", "prettier:fix": "prettier --write \"./**/*.{js,ts,md,json}\"", + "start": "pnpm ts-node src/index.ts", + "start:prod": "pnpm node dist/src/index.js", "test": "jest" }, "license": "MIT", "devDependencies": { "@types/express": "^4.17.17", "@types/lodash": "^4.14.198", - "@types/source-map-support": "^0.5.7" + "@types/source-map-support": "^0.5.7", + "nodemon": "^3.0.1" }, "dependencies": { "@api3/promise-utils": "0.4.0", diff --git a/packages/data-pusher/package.json b/packages/data-pusher/package.json index a4deb987..b7342d4b 100644 --- a/packages/data-pusher/package.json +++ b/packages/data-pusher/package.json @@ -8,7 +8,7 @@ "scripts": { "build": "tsc --project .", "clean": "rm -rf coverage dist", - "dev": "ts-node src/index.ts", + "dev": "nodemon --ext ts,js,json,env --exec \"pnpm run start\"", "docker:build": "docker compose --file docker/docker-compose.yml build", "docker:start:detach": "docker compose --file docker/docker-compose.yml up --detach", "docker:start": "docker compose --file docker/docker-compose.yml up", @@ -17,6 +17,8 @@ "eslint:fix": "eslint . --ext .js,.ts --fix", "prettier:check": "prettier --check \"./**/*.{js,ts,md,yml,json}\"", "prettier:fix": "prettier --write \"./**/*.{js,ts,md,yml,json}\"", + "start": "pnpm ts-node src/index.ts", + "start:prod": "pnpm node dist/src/index.js", "test": "jest" }, "license": "MIT", @@ -40,6 +42,7 @@ "devDependencies": { "@types/express": "^4.17.17", "@types/lodash": "^4.14.198", - "@types/source-map-support": "^0.5.7" + "@types/source-map-support": "^0.5.7", + "nodemon": "^3.0.1" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 418fb20f..e5f23481 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -84,6 +84,9 @@ importers: '@types/source-map-support': specifier: ^0.5.7 version: 0.5.7 + nodemon: + specifier: ^3.0.1 + version: 3.0.1 packages/common: dependencies: @@ -154,6 +157,9 @@ importers: '@types/source-map-support': specifier: ^0.5.7 version: 0.5.7 + nodemon: + specifier: ^3.0.1 + version: 3.0.1 packages: @@ -2545,6 +2551,10 @@ packages: eslint-visitor-keys: 3.4.3 dev: true + /abbrev@1.1.1: + resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} + dev: true + /accepts@1.3.8: resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} engines: {node: '>= 0.6'} @@ -2842,6 +2852,11 @@ packages: resolution: {integrity: sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==} dev: false + /binary-extensions@2.2.0: + resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} + engines: {node: '>=8'} + dev: true + /bl@4.1.0: resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} dependencies: @@ -2999,6 +3014,21 @@ packages: engines: {node: '>=10'} dev: true + /chokidar@3.5.3: + resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} + engines: {node: '>= 8.10.0'} + dependencies: + anymatch: 3.1.3 + braces: 3.0.2 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 + dev: true + /ci-info@3.8.0: resolution: {integrity: sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==} engines: {node: '>=8'} @@ -3175,7 +3205,7 @@ packages: ms: 2.0.0 dev: false - /debug@3.2.7: + /debug@3.2.7(supports-color@5.5.0): resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} peerDependencies: supports-color: '*' @@ -3184,6 +3214,7 @@ packages: optional: true dependencies: ms: 2.1.3 + supports-color: 5.5.0 dev: true /debug@4.3.4: @@ -3447,7 +3478,7 @@ packages: /eslint-import-resolver-node@0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} dependencies: - debug: 3.2.7 + debug: 3.2.7(supports-color@5.5.0) is-core-module: 2.13.0 resolve: 1.22.6 transitivePeerDependencies: @@ -3476,7 +3507,7 @@ packages: optional: true dependencies: '@typescript-eslint/parser': 6.7.2(eslint@8.49.0)(typescript@5.2.2) - debug: 3.2.7 + debug: 3.2.7(supports-color@5.5.0) eslint: 8.49.0 eslint-import-resolver-node: 0.3.9 transitivePeerDependencies: @@ -3498,7 +3529,7 @@ packages: array.prototype.findlastindex: 1.2.3 array.prototype.flat: 1.3.2 array.prototype.flatmap: 1.3.2 - debug: 3.2.7 + debug: 3.2.7(supports-color@5.5.0) doctrine: 2.1.0 eslint: 8.49.0 eslint-import-resolver-node: 0.3.9 @@ -4233,6 +4264,10 @@ packages: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} dev: false + /ignore-by-default@1.0.1: + resolution: {integrity: sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==} + dev: true + /ignore@5.2.4: resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} engines: {node: '>= 4'} @@ -4306,6 +4341,13 @@ packages: has-bigints: 1.0.2 dev: true + /is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + dependencies: + binary-extensions: 2.2.0 + dev: true + /is-boolean-object@1.1.2: resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} engines: {node: '>= 0.4'} @@ -5234,6 +5276,30 @@ packages: resolution: {integrity: sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==} dev: true + /nodemon@3.0.1: + resolution: {integrity: sha512-g9AZ7HmkhQkqXkRc20w+ZfQ73cHLbE8hnPbtaFbFtCumZsjyMhKk9LajQ07U5Ux28lvFjZ5X7HvWR1xzU8jHVw==} + engines: {node: '>=10'} + hasBin: true + dependencies: + chokidar: 3.5.3 + debug: 3.2.7(supports-color@5.5.0) + ignore-by-default: 1.0.1 + minimatch: 3.1.2 + pstree.remy: 1.1.8 + semver: 7.5.4 + simple-update-notifier: 2.0.0 + supports-color: 5.5.0 + touch: 3.1.0 + undefsafe: 2.0.5 + dev: true + + /nopt@1.0.10: + resolution: {integrity: sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==} + hasBin: true + dependencies: + abbrev: 1.1.1 + dev: true + /normalize-path@3.0.0: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} @@ -5495,6 +5561,10 @@ packages: resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} dev: false + /pstree.remy@1.1.8: + resolution: {integrity: sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==} + dev: true + /punycode@2.3.0: resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==} engines: {node: '>=6'} @@ -5543,6 +5613,13 @@ packages: util-deprecate: 1.0.2 dev: false + /readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + dependencies: + picomatch: 2.3.1 + dev: true + /regenerator-runtime@0.14.0: resolution: {integrity: sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==} dev: false @@ -5752,6 +5829,13 @@ packages: is-arrayish: 0.3.2 dev: false + /simple-update-notifier@2.0.0: + resolution: {integrity: sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==} + engines: {node: '>=10'} + dependencies: + semver: 7.5.4 + dev: true + /sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} dev: true @@ -5955,6 +6039,13 @@ packages: engines: {node: '>=0.6'} dev: false + /touch@3.1.0: + resolution: {integrity: sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==} + hasBin: true + dependencies: + nopt: 1.0.10 + dev: true + /tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} dev: false @@ -6147,6 +6238,10 @@ packages: which-boxed-primitive: 1.0.2 dev: true + /undefsafe@2.0.5: + resolution: {integrity: sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==} + dev: true + /unpipe@1.0.0: resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} engines: {node: '>= 0.8'} From 95da37fe88f14bbcf524f738083bd5980f1e5710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Tesa=C5=99?= Date: Mon, 25 Sep 2023 10:58:44 +0200 Subject: [PATCH 2/3] Review fixes --- packages/api/package.json | 5 ++--- packages/data-pusher/package.json | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/api/package.json b/packages/api/package.json index 54d2fa25..9ea3e6fd 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -9,7 +9,7 @@ "scripts": { "build": "tsc --project .", "clean": "rm -rf coverage dist", - "dev": "nodemon --ext ts,js,json,env --exec \"pnpm run start\"", + "dev": "nodemon --ext ts,js,json,env --exec \"pnpm ts-node src/index.ts\"", "docker:build": "docker compose --file docker/docker-compose.yml build", "docker:start:detach": "docker compose --file docker/docker-compose.yml up --detach", "docker:start": "docker compose --file docker/docker-compose.yml up", @@ -18,8 +18,7 @@ "eslint:fix": "eslint . --ext .js,.ts --fix", "prettier:check": "prettier --check \"./**/*.{js,ts,md,json}\"", "prettier:fix": "prettier --write \"./**/*.{js,ts,md,json}\"", - "start": "pnpm ts-node src/index.ts", - "start:prod": "pnpm node dist/src/index.js", + "start-prod": "node dist/src/index.js", "test": "jest" }, "license": "MIT", diff --git a/packages/data-pusher/package.json b/packages/data-pusher/package.json index b7342d4b..be7c73f3 100644 --- a/packages/data-pusher/package.json +++ b/packages/data-pusher/package.json @@ -8,7 +8,7 @@ "scripts": { "build": "tsc --project .", "clean": "rm -rf coverage dist", - "dev": "nodemon --ext ts,js,json,env --exec \"pnpm run start\"", + "dev": "nodemon --ext ts,js,json,env --exec \"pnpm ts-node src/index.ts\"", "docker:build": "docker compose --file docker/docker-compose.yml build", "docker:start:detach": "docker compose --file docker/docker-compose.yml up --detach", "docker:start": "docker compose --file docker/docker-compose.yml up", @@ -17,8 +17,7 @@ "eslint:fix": "eslint . --ext .js,.ts --fix", "prettier:check": "prettier --check \"./**/*.{js,ts,md,yml,json}\"", "prettier:fix": "prettier --write \"./**/*.{js,ts,md,yml,json}\"", - "start": "pnpm ts-node src/index.ts", - "start:prod": "pnpm node dist/src/index.js", + "start-prod": "node dist/src/index.js", "test": "jest" }, "license": "MIT", From 8423e8f18c571821894056370bf1ca573da0803d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Tesa=C5=99?= Date: Mon, 25 Sep 2023 12:00:15 +0200 Subject: [PATCH 3/3] Remove forgotten process.exit --- packages/data-pusher/src/api-requests/data-provider.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/data-pusher/src/api-requests/data-provider.ts b/packages/data-pusher/src/api-requests/data-provider.ts index df3e1897..6927f945 100644 --- a/packages/data-pusher/src/api-requests/data-provider.ts +++ b/packages/data-pusher/src/api-requests/data-provider.ts @@ -78,7 +78,6 @@ export const makeTemplateRequests = async (signedApiUpdate: SignedApiUpdate): Pr if (!response.success) { const message = `Failed to post process successful API call`; getLogger().warn(message, { templateId, operationTemplateId, errorMessage: response.errorMessage }); - process.exit(1); return null; } return [templateId, response];