mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
chore: add lefthook
This commit is contained in:
45
lefthook.yml
Normal file
45
lefthook.yml
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# EXAMPLE USAGE:
|
||||||
|
#
|
||||||
|
# Refer for explanation to following link:
|
||||||
|
# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
|
||||||
|
#
|
||||||
|
# pre-push:
|
||||||
|
# commands:
|
||||||
|
# packages-audit:
|
||||||
|
# tags: frontend security
|
||||||
|
# run: yarn audit
|
||||||
|
# gems-audit:
|
||||||
|
# tags: backend security
|
||||||
|
# run: bundle audit
|
||||||
|
#
|
||||||
|
# pre-commit:
|
||||||
|
# parallel: true
|
||||||
|
# commands:
|
||||||
|
# eslint:
|
||||||
|
# glob: "*.{js,ts,jsx,tsx}"
|
||||||
|
# run: yarn eslint {staged_files}
|
||||||
|
# rubocop:
|
||||||
|
# tags: backend style
|
||||||
|
# glob: "*.rb"
|
||||||
|
# exclude: '(^|/)(application|routes)\.rb$'
|
||||||
|
# run: bundle exec rubocop --force-exclusion {all_files}
|
||||||
|
# govet:
|
||||||
|
# tags: backend style
|
||||||
|
# files: git ls-files -m
|
||||||
|
# glob: "*.go"
|
||||||
|
# run: go vet {files}
|
||||||
|
# scripts:
|
||||||
|
# "hello.js":
|
||||||
|
# runner: node
|
||||||
|
# "any.go":
|
||||||
|
# runner: go run
|
||||||
|
|
||||||
|
commit-msg:
|
||||||
|
commands:
|
||||||
|
commitlint:
|
||||||
|
run: "npx commitlint --edit $1"
|
||||||
|
|
||||||
|
pre-commit:
|
||||||
|
commands:
|
||||||
|
lint-staged:
|
||||||
|
run: "npx lint-staged"
|
||||||
@@ -17,8 +17,7 @@
|
|||||||
"build": "pnpm -r run build",
|
"build": "pnpm -r run build",
|
||||||
"format-and-lint": "biome check .",
|
"format-and-lint": "biome check .",
|
||||||
"check": "biome check --write --no-errors-on-unmatched --files-ignore-unknown=true",
|
"check": "biome check --write --no-errors-on-unmatched --files-ignore-unknown=true",
|
||||||
"format-and-lint:fix": "biome check . --write",
|
"format-and-lint:fix": "biome check . --write"
|
||||||
"prepare": "node .husky/install.mjs"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"dotenv": "16.4.5",
|
"dotenv": "16.4.5",
|
||||||
@@ -26,7 +25,7 @@
|
|||||||
"tsx": "4.16.2",
|
"tsx": "4.16.2",
|
||||||
"lint-staged": "^15.2.7",
|
"lint-staged": "^15.2.7",
|
||||||
"@biomejs/biome": "1.8.3",
|
"@biomejs/biome": "1.8.3",
|
||||||
"husky": "^9.1.6",
|
"lefthook": "1.8.4",
|
||||||
"@commitlint/cli": "^19.3.0",
|
"@commitlint/cli": "^19.3.0",
|
||||||
"@commitlint/config-conventional": "^19.2.2",
|
"@commitlint/config-conventional": "^19.2.2",
|
||||||
"@types/node": "^18.17.0"
|
"@types/node": "^18.17.0"
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export const authGithub = (githubProvider: Github): Octokit => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getGithubToken = async (
|
export const getGithubToken = async (
|
||||||
octokit: ReturnType<typeof authGithub>
|
octokit: ReturnType<typeof authGithub>,
|
||||||
) => {
|
) => {
|
||||||
const installation = (await octokit.auth({
|
const installation = (await octokit.auth({
|
||||||
type: "installation",
|
type: "installation",
|
||||||
@@ -77,7 +77,7 @@ export type ComposeWithGithub = InferResultType<"compose", { github: true }>;
|
|||||||
export const cloneGithubRepository = async (
|
export const cloneGithubRepository = async (
|
||||||
entity: ApplicationWithGithub | ComposeWithGithub,
|
entity: ApplicationWithGithub | ComposeWithGithub,
|
||||||
logPath: string,
|
logPath: string,
|
||||||
isCompose = false
|
isCompose = false,
|
||||||
) => {
|
) => {
|
||||||
const { APPLICATIONS_PATH, COMPOSE_PATH } = paths();
|
const { APPLICATIONS_PATH, COMPOSE_PATH } = paths();
|
||||||
const writeStream = createWriteStream(logPath, { flags: "a" });
|
const writeStream = createWriteStream(logPath, { flags: "a" });
|
||||||
@@ -95,7 +95,7 @@ export const cloneGithubRepository = async (
|
|||||||
// Check if requirements are met
|
// Check if requirements are met
|
||||||
if (requirements.length > 0) {
|
if (requirements.length > 0) {
|
||||||
writeStream.write(
|
writeStream.write(
|
||||||
`\nGitHub Repository configuration failed for application: ${appName}\n`
|
`\nGitHub Repository configuration failed for application: ${appName}\n`,
|
||||||
);
|
);
|
||||||
writeStream.write("Reasons:\n");
|
writeStream.write("Reasons:\n");
|
||||||
writeStream.write(requirements.join("\n"));
|
writeStream.write(requirements.join("\n"));
|
||||||
@@ -134,7 +134,7 @@ export const cloneGithubRepository = async (
|
|||||||
if (writeStream.writable) {
|
if (writeStream.writable) {
|
||||||
writeStream.write(data);
|
writeStream.write(data);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
writeStream.write(`\nCloned ${repoclone}: ✅\n`);
|
writeStream.write(`\nCloned ${repoclone}: ✅\n`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -148,7 +148,7 @@ export const cloneGithubRepository = async (
|
|||||||
export const getGithubCloneCommand = async (
|
export const getGithubCloneCommand = async (
|
||||||
entity: ApplicationWithGithub | ComposeWithGithub,
|
entity: ApplicationWithGithub | ComposeWithGithub,
|
||||||
logPath: string,
|
logPath: string,
|
||||||
isCompose = false
|
isCompose = false,
|
||||||
) => {
|
) => {
|
||||||
const { appName, repository, owner, branch, githubId, serverId } = entity;
|
const { appName, repository, owner, branch, githubId, serverId } = entity;
|
||||||
|
|
||||||
@@ -302,7 +302,7 @@ export const getGithubRepositories = async (githubId?: string) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const repositories = (await octokit.paginate(
|
const repositories = (await octokit.paginate(
|
||||||
octokit.rest.apps.listReposAccessibleToInstallation
|
octokit.rest.apps.listReposAccessibleToInstallation,
|
||||||
)) as unknown as Awaited<
|
)) as unknown as Awaited<
|
||||||
ReturnType<typeof octokit.rest.apps.listReposAccessibleToInstallation>
|
ReturnType<typeof octokit.rest.apps.listReposAccessibleToInstallation>
|
||||||
>["data"]["repositories"];
|
>["data"]["repositories"];
|
||||||
@@ -311,7 +311,7 @@ export const getGithubRepositories = async (githubId?: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getGithubBranches = async (
|
export const getGithubBranches = async (
|
||||||
input: typeof apiFindGithubBranches._type
|
input: typeof apiFindGithubBranches._type,
|
||||||
) => {
|
) => {
|
||||||
if (!input.githubId) {
|
if (!input.githubId) {
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
110
pnpm-lock.yaml
generated
110
pnpm-lock.yaml
generated
@@ -30,9 +30,9 @@ importers:
|
|||||||
esbuild:
|
esbuild:
|
||||||
specifier: 0.20.2
|
specifier: 0.20.2
|
||||||
version: 0.20.2
|
version: 0.20.2
|
||||||
husky:
|
lefthook:
|
||||||
specifier: ^9.1.6
|
specifier: 1.8.4
|
||||||
version: 9.1.6
|
version: 1.8.4
|
||||||
lint-staged:
|
lint-staged:
|
||||||
specifier: ^15.2.7
|
specifier: ^15.2.7
|
||||||
version: 15.2.7
|
version: 15.2.7
|
||||||
@@ -4722,11 +4722,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==}
|
resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==}
|
||||||
engines: {node: '>=16.17.0'}
|
engines: {node: '>=16.17.0'}
|
||||||
|
|
||||||
husky@9.1.6:
|
|
||||||
resolution: {integrity: sha512-sqbjZKK7kf44hfdE94EoX8MZNk0n7HeW37O4YrVGCF4wzgQjp+akPAkfUK5LZ6KuR/6sqeAVuXHji+RzQgOn5A==}
|
|
||||||
engines: {node: '>=18'}
|
|
||||||
hasBin: true
|
|
||||||
|
|
||||||
hyperdyperid@1.2.0:
|
hyperdyperid@1.2.0:
|
||||||
resolution: {integrity: sha512-Y93lCzHYgGWdrJ66yIktxiaGULYc6oGiABxhcO5AufBeOyoIdZF7bIfLaOrbM0iGIOXQQgxxRrFEnb+Y6w1n4A==}
|
resolution: {integrity: sha512-Y93lCzHYgGWdrJ66yIktxiaGULYc6oGiABxhcO5AufBeOyoIdZF7bIfLaOrbM0iGIOXQQgxxRrFEnb+Y6w1n4A==}
|
||||||
engines: {node: '>=10.18'}
|
engines: {node: '>=10.18'}
|
||||||
@@ -4958,6 +4953,60 @@ packages:
|
|||||||
leac@0.6.0:
|
leac@0.6.0:
|
||||||
resolution: {integrity: sha512-y+SqErxb8h7nE/fiEX07jsbuhrpO9lL8eca7/Y1nuWV2moNlXhyd59iDGcRf6moVyDMbmTNzL40SUyrFU/yDpg==}
|
resolution: {integrity: sha512-y+SqErxb8h7nE/fiEX07jsbuhrpO9lL8eca7/Y1nuWV2moNlXhyd59iDGcRf6moVyDMbmTNzL40SUyrFU/yDpg==}
|
||||||
|
|
||||||
|
lefthook-darwin-arm64@1.8.4:
|
||||||
|
resolution: {integrity: sha512-OS5MsU0gvd8LYSpuQCHtmDUqwNrJ/LjCO0LGC1wNepY4OkuVl9DfX+rQ506CVUQYZiGVcwy2/qPOOBjNzA5+wQ==}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [darwin]
|
||||||
|
|
||||||
|
lefthook-darwin-x64@1.8.4:
|
||||||
|
resolution: {integrity: sha512-QLRsqK9aTMRcVW8qz4pzI2OWnGCEcaEPJlIiFjwstYsS+wfkooxOS0UkfVMjy+QoGgEcki+cxF/FoY7lE7DDtw==}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [darwin]
|
||||||
|
|
||||||
|
lefthook-freebsd-arm64@1.8.4:
|
||||||
|
resolution: {integrity: sha512-chnQ1m/Cmn9c0sLdk5HL2SToE5LBJv5uQMdH1IGRRcw+nEqWqrMnDXvM75caiJAyjmUGvPH3czKTJDzTFV1E+A==}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [freebsd]
|
||||||
|
|
||||||
|
lefthook-freebsd-x64@1.8.4:
|
||||||
|
resolution: {integrity: sha512-KQi+WBUdnGLnK0rHOR58kbMH5TDVN1ZjZLu66Pv9FCG7Y7shR1qtaTXu+wmxdRhMvaLeQIXRsUEPjNRC66yMmA==}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [freebsd]
|
||||||
|
|
||||||
|
lefthook-linux-arm64@1.8.4:
|
||||||
|
resolution: {integrity: sha512-CXNcqIskLwTwQARidGdFqmNxpvOU3jsWPK4KA7pq2+QmlWJ64w98ebMvNBoUmRUCXqzmUm7Udf/jpfz2fobewQ==}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
lefthook-linux-x64@1.8.4:
|
||||||
|
resolution: {integrity: sha512-pVNITkFBxUCEtamWSM/res2Gd48+m9YKbNyIBndAuZVC5pKV5aGKZy2DNq6PWUPYiUDPx+7hoAtCJg/tlAiqhw==}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
lefthook-openbsd-arm64@1.8.4:
|
||||||
|
resolution: {integrity: sha512-l+i/Dg5X36kYzhpMGSPE3rMbWy1KSytbLB9lY1PmxYb6LRH6iQTYIoxvLabVUwSBPSq8HtIFa50+bvC5+scfVA==}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [openbsd]
|
||||||
|
|
||||||
|
lefthook-openbsd-x64@1.8.4:
|
||||||
|
resolution: {integrity: sha512-CqhDDPPX8oHzMLgNi/Reba823DRzj+eMNWQ8axvSiIG+zmG1w20xZH5QSs/mD3tjrND90yfDd90mWMt181qPyA==}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [openbsd]
|
||||||
|
|
||||||
|
lefthook-windows-arm64@1.8.4:
|
||||||
|
resolution: {integrity: sha512-dvpvorICmVjmw29Aiczg7DcaSzkd86bEBomiGq4UsAEk3+7ExLrlWJDLFsI6xLjMKmTxy+F7eXb2uDtuFC1N4g==}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
|
lefthook-windows-x64@1.8.4:
|
||||||
|
resolution: {integrity: sha512-e+y8Jt4/7PnoplhOuK48twjGVJEsU4T3J5kxD4mWfl6Cbit0YSn4bme9nW41eqCqTUqOm+ky29XlfnPHFX5ZNA==}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
|
lefthook@1.8.4:
|
||||||
|
resolution: {integrity: sha512-XNyMaTWNRuADOaocYiHidgNkNDz8SCekpdNJ7lqceFcBT2zjumnb28/o7IMaNROpLBZdQkLkJXSeaQWGqn3kog==}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
lilconfig@2.1.0:
|
lilconfig@2.1.0:
|
||||||
resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==}
|
resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
@@ -10940,8 +10989,6 @@ snapshots:
|
|||||||
|
|
||||||
human-signals@5.0.0: {}
|
human-signals@5.0.0: {}
|
||||||
|
|
||||||
husky@9.1.6: {}
|
|
||||||
|
|
||||||
hyperdyperid@1.2.0: {}
|
hyperdyperid@1.2.0: {}
|
||||||
|
|
||||||
i18next-fs-backend@2.3.2: {}
|
i18next-fs-backend@2.3.2: {}
|
||||||
@@ -11153,6 +11200,49 @@ snapshots:
|
|||||||
|
|
||||||
leac@0.6.0: {}
|
leac@0.6.0: {}
|
||||||
|
|
||||||
|
lefthook-darwin-arm64@1.8.4:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
lefthook-darwin-x64@1.8.4:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
lefthook-freebsd-arm64@1.8.4:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
lefthook-freebsd-x64@1.8.4:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
lefthook-linux-arm64@1.8.4:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
lefthook-linux-x64@1.8.4:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
lefthook-openbsd-arm64@1.8.4:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
lefthook-openbsd-x64@1.8.4:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
lefthook-windows-arm64@1.8.4:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
lefthook-windows-x64@1.8.4:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
lefthook@1.8.4:
|
||||||
|
optionalDependencies:
|
||||||
|
lefthook-darwin-arm64: 1.8.4
|
||||||
|
lefthook-darwin-x64: 1.8.4
|
||||||
|
lefthook-freebsd-arm64: 1.8.4
|
||||||
|
lefthook-freebsd-x64: 1.8.4
|
||||||
|
lefthook-linux-arm64: 1.8.4
|
||||||
|
lefthook-linux-x64: 1.8.4
|
||||||
|
lefthook-openbsd-arm64: 1.8.4
|
||||||
|
lefthook-openbsd-x64: 1.8.4
|
||||||
|
lefthook-windows-arm64: 1.8.4
|
||||||
|
lefthook-windows-x64: 1.8.4
|
||||||
|
|
||||||
lilconfig@2.1.0: {}
|
lilconfig@2.1.0: {}
|
||||||
|
|
||||||
lilconfig@3.1.2: {}
|
lilconfig@3.1.2: {}
|
||||||
|
|||||||
Reference in New Issue
Block a user