From 46e0a6d439b8cb7be4b1c1edde83298bafc2c0b2 Mon Sep 17 00:00:00 2001 From: praveenkumarct Date: Wed, 31 Jan 2024 11:02:14 +0100 Subject: [PATCH] Update package.json according to connect and add skeleton for post deploy scripts --- processor/package.json | 12 +++++++----- processor/src/connectors/post-deploy.ts | 17 +++++++++++++++++ processor/src/connectors/pre-undeploy.ts | 14 ++++++++++++++ 3 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 processor/src/connectors/post-deploy.ts create mode 100644 processor/src/connectors/pre-undeploy.ts diff --git a/processor/package.json b/processor/package.json index ffa94e3..d239ac5 100644 --- a/processor/package.json +++ b/processor/package.json @@ -4,15 +4,17 @@ "description": "Payment provider integration template", "main": "dist/server/server.js", "scripts": { + "start": "node dist/server/main.js", + "start:dev": "node_modules/.bin/nodemon -q dist/server/main.js", + "lint": "prettier --check \"src/**/*.{ts,js,json}\" && eslint --ext .ts src", + "lint:fix": "prettier --write \"src/**/*.{ts,js,json}\" && eslint --fix --ext .ts src", "build:server": "tsc -p tsconfig.server.json", "build": "npm run build:server && npm run build:client", "build:dev": "npm run build:server && npm run build:client:dev", "dev": "ts-node --project tsconfig.server.json src/server/main.ts | pino-pretty", - "start": "SERVER_PORT=8080 node dist/server/main.js", - "watch": "nodemon --watch \"src/**\" --ext \"ts,json,js,html,css\" --ignore \"src/**/*.spec.ts\" --exec \"npm run dev\"", - "lint": "prettier --check \"src/**/*.{ts,js,json}\" && eslint --ext .ts src", - "lint:fix": "prettier --write \"src/**/*.{ts,js,json}\" && eslint --fix --ext .ts src", - "test": "jest --detectOpenHandles" + "test": "jest --detectOpenHandles", + "connector:post-deploy": "node src/connectors/post-deploy.ts", + "connector:pre-undeploy": "node src/connectors/pre-undeploy.ts" }, "keywords": [], "author": "", diff --git a/processor/src/connectors/post-deploy.ts b/processor/src/connectors/post-deploy.ts new file mode 100644 index 0000000..851b8c1 --- /dev/null +++ b/processor/src/connectors/post-deploy.ts @@ -0,0 +1,17 @@ + +async function postDeploy(properties) { + + // TODO: Implement postDeploy scripts if any +} + +async function run() { + try { + const properties = new Map(Object.entries(process.env)); + await postDeploy(properties); + } catch (error) { + process.stderr.write(`Post-deploy failed: ${error.message}\n`); + process.exitCode = 1; + } +} + +run(); diff --git a/processor/src/connectors/pre-undeploy.ts b/processor/src/connectors/pre-undeploy.ts new file mode 100644 index 0000000..e2b0239 --- /dev/null +++ b/processor/src/connectors/pre-undeploy.ts @@ -0,0 +1,14 @@ +async function preUndeploy() { + // TODO: Implement pre undeploy scripts if any +} + +async function run() { + try { + await preUndeploy(); + } catch (error) { + process.stderr.write(`Post-undeploy failed: ${error.message}\n`); + process.exitCode = 1; + } +} + +run();