Skip to content

Commit

Permalink
add husky pre-commit action
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthammond96 committed Dec 30, 2024
1 parent af84f83 commit 7fa0a0d
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 25 deletions.
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run prettier
17 changes: 17 additions & 0 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"publish:next": "npm run build && npm publish --tag=next --access public",
"publish:public": "npm run build && npm publish --access public",
"prepare": "npm run generate && ts-patch install && typia patch",
"prettier": "prettier --check .",
"prettier:fix": "prettier --write .",
"eslint": "eslint .",
"eslint:fix": "eslint --fix .",
"prettier": "prettier --check ./src",
"prettier:fix": "prettier --write ./src",
"eslint": "eslint ./src",
"eslint:fix": "eslint --fix ./src",
"lint": "npm run prettier && npm run eslint",
"lint:fix": "npm run prettier:fix && npm run eslint:fix"
},
Expand Down Expand Up @@ -53,6 +53,7 @@
"eslint-plugin-n": "^15.0.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.0.0",
"husky": "^9.1.7",
"jest": "^29.7.0",
"prettier": "^2.8.8",
"ts-jest": "^29.1.5",
Expand Down
4 changes: 2 additions & 2 deletions src/services/NodeManager/node/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export class BasicNode {
* so we force close the current job and it causes the container.wait()
* to unblock and move to the next stage
*/
await this.jobHandler.stopCurrentJob()
await this.jobHandler.stopCurrentJob();
} catch (error) {
reject(error);
}
Expand Down Expand Up @@ -298,7 +298,7 @@ export class BasicNode {
* so we force close the current job and it causes the container.wait()
* to unblock and move to the next stage
*/
await this.jobHandler.stopCurrentJob()
await this.jobHandler.stopCurrentJob();
} catch (error) {
reject(error);
}
Expand Down
2 changes: 1 addition & 1 deletion src/services/NodeManager/node/expiry/expiryHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class ExpiryHandler {
public async waitUntilExpired(): Promise<void> {
return new Promise<void>((resolve) => {
this.stop();
resolve()
resolve();
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/services/NodeManager/node/flow/flowHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ export class FlowHandler {
return this.repository.getflow(id);
}

public async stopCurrentFlow(){
await this.provider.finishCurrentRunningContainer()
public async stopCurrentFlow() {
await this.provider.finishCurrentRunningContainer();
}

public async stop(id: string): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion src/services/NodeManager/node/job/jobHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class JobHandler {
}

async stopCurrentJob(): Promise<void> {
await this.flowHandler.stopCurrentFlow()
await this.flowHandler.stopCurrentFlow();
}

async quit(run: Run): Promise<void> {
Expand Down
6 changes: 3 additions & 3 deletions src/services/NodeManager/provider/Provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,10 @@ export class Provider {
return true;
}

async finishCurrentRunningContainer(){
async finishCurrentRunningContainer() {
const container = this.currentContainer;
if(container){
await this.containerOrchestration.stopContainer(container.id)
if (container) {
await this.containerOrchestration.stopContainer(container.id);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,6 @@ export class DockerContainerOrchestration
}
}

async deleteContainer(id: string): Promise<ReturnedStatus> {
try {
if (this.docker.getContainer(id)) {
this.docker.getContainer(id).remove({ force: true });
}
return { status: true };
} catch (error) {
return { status: false, error };
}
}

async stopAndDeleteContainer(containerId: string): Promise<ReturnedStatus> {
try {
const container = this.docker.getContainer(containerId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export interface ContainerOrchestrationInterface {
args: RunContainerArgs,
): Promise<ReturnedStatus<Container>>;
stopContainer(id: string): Promise<ReturnedStatus>;
deleteContainer(id: string): Promise<ReturnedStatus>;
stopAndDeleteContainer(id: string): Promise<ReturnedStatus>;
isContainerExited(id: string): Promise<ReturnedStatus<boolean>>;
doesContainerExist(id: string): Promise<ReturnedStatus<boolean>>;
Expand Down

0 comments on commit 7fa0a0d

Please sign in to comment.