-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from FlowSahl/feat/refactor-code-1-1-0
Refactor code
- Loading branch information
Showing
8 changed files
with
225 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
// src/types.ts | ||
export interface Inputs { | ||
target: string; | ||
sha: string; | ||
deploy_branch: string; | ||
envFile?: string; | ||
commandScriptBeforeCheckFolders?: string; | ||
commandScriptAfterCheckFolders?: string; | ||
commandScriptBeforeDownload?: string; | ||
commandScriptAfterDownload?: string; | ||
commandScriptBeforeActivate?: string; | ||
commandScriptAfterActivate?: string; | ||
githubRepoOwner: string; | ||
githubRepo: string; | ||
target: string; // The target directory on the server where the deployment will occur | ||
sha: string; // The specific commit SHA to be deployed | ||
deploy_branch: string; // The branch of the repository to deploy | ||
envFile?: string; // Optional content of the environment file to be used in the deployment | ||
commandScriptBeforeCheckFolders?: string; // Custom script to run before checking folders | ||
commandScriptAfterCheckFolders?: string; // Custom script to run after checking folders | ||
commandScriptBeforeDownload?: string; // Custom script to run before downloading the release | ||
commandScriptAfterDownload?: string; // Custom script to run after downloading the release | ||
commandScriptBeforeActivate?: string; // Custom script to run before activating the release | ||
commandScriptAfterActivate?: string; // Custom script to run after activating the release | ||
githubRepoOwner: string; // The owner of the GitHub repository | ||
githubRepo: string; // The name of the GitHub repository | ||
} | ||
|
||
/** Represents the paths used during the deployment process */ | ||
export interface Paths { | ||
target: string; | ||
sha: string; | ||
releasePath: string; | ||
activeReleasePath: string; | ||
target: string; // The base target directory | ||
sha: string; // The SHA of the commit being deployed | ||
releasePath: string; // The path to the specific release | ||
activeReleasePath: string; // The path to the active release | ||
} | ||
|
||
/** Represents the SSH connection options */ | ||
export interface ConnectionOptions { | ||
host: string; | ||
username: string; | ||
port?: number | 22; | ||
password?: string; | ||
privateKey?: string; | ||
passphrase?: string; | ||
host: string; // The host of the server to connect to | ||
username: string; // The username to use for the SSH connection | ||
port?: number | 22; // The port to use for the SSH connection (defaults to 22) | ||
password?: string; // The password for the SSH connection | ||
privateKey?: string; // The private key for the SSH connection | ||
passphrase?: string; // The passphrase for the private key, if applicable | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
import { ConnectionOptions, Inputs } from '../types'; | ||
|
||
/** Logs a message with a timestamp */ | ||
export function log(message: string): void { | ||
const timestamp = new Date().toISOString(); | ||
console.log(`[${timestamp}] ${message}`); | ||
console.log(`[DEPLOYMENT][${timestamp}] ${message}`); | ||
} | ||
|
||
export function logInputs(inputs: Inputs, connectionOptions: ConnectionOptions) { | ||
/** Logs input configurations */ | ||
export function logInputs(inputs: Inputs, connectionOptions: ConnectionOptions): void { | ||
log(`Host: ${connectionOptions.host}`); | ||
log(`Target: ${inputs.target}`); | ||
log(`SHA: ${inputs.sha}`); | ||
log(`GitHub Repo Owner: ${inputs.githubRepoOwner}`); | ||
log(`Target Directory: ${inputs.target}`); | ||
log(`Commit SHA: ${inputs.sha}`); | ||
log(`GitHub Repository: ${inputs.githubRepoOwner}/${inputs.githubRepo}`); | ||
log(`Branch: ${inputs.deploy_branch}`); | ||
} | ||
|
||
/** Logs an error message with a timestamp */ | ||
export function logError(message: string): void { | ||
const timestamp = new Date().toISOString(); | ||
console.error(`[DEPLOYMENT ERROR][${timestamp}] ${message}`); | ||
} |
Oops, something went wrong.