Skip to content

Commit

Permalink
Update package.json according to connect and add skeleton for post de…
Browse files Browse the repository at this point in the history
…ploy scripts
  • Loading branch information
praveenkumarct committed Jan 31, 2024
1 parent c7050b5 commit 46e0a6d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
12 changes: 7 additions & 5 deletions processor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down
17 changes: 17 additions & 0 deletions processor/src/connectors/post-deploy.ts
Original file line number Diff line number Diff line change
@@ -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();
14 changes: 14 additions & 0 deletions processor/src/connectors/pre-undeploy.ts
Original file line number Diff line number Diff line change
@@ -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();

0 comments on commit 46e0a6d

Please sign in to comment.