当我npx lint-staged在终端中使用时,一切看起来都正常。
例如:
\nPS E:\\Projects\\sample-project> git status\nOn branch main\nYour branch is up to date with \'origin/main\'.\n\nChanges to be committed:\n (use "git restore --staged <file>..." to unstage)\n new file: .husky/commit-msg\n new file: .husky/pre-commit\n new file: .lintstagedrc.json\n modified: .prettierrc\n new file: commitlint.config.js\n modified: nx.json\n modified: package-lock.json\n modified: package.json\n\nPS E:\\Projects\\sample-project> npx lint-staged\n\xe2\x88\x9a Preparing lint-staged...\n\xe2\x88\x9a Running tasks for staged files...\n\xe2\x88\x9a Applying modifications from tasks...\n\xe2\x88\x9a Cleaning up temporary files...\nPS E:\\Projects\\sample-project> \nRun Code Online (Sandbox Code Playgroud)\n但是当我的哈士奇pre-commit钩子运行相同的命令时:
#!/usr/bin/env sh\n. "$(dirname "$0")/_/husky.sh"\n\nnpx lint-staged\n …Run Code Online (Sandbox Code Playgroud) 由于@nestjs/terminus不为 Prisma 提供健康检查,我尝试根据他们的Mongoose 健康检查创建它。
当我尝试时:
import * as Prisma from 'prisma';
...
...
private getContextConnection(): any | null {
const {
getConnectionToken,
// eslint-disable-next-line @typescript-eslint/no-var-requires
} = require('prisma') as typeof Prisma;
try {
return this.moduleRef.get(getConnectionToken('DatabaseConnection') as string, {
strict: false,
});
} catch (err) {
return null;
}
}
...
...
const connection = options.connection || this.getContextConnection();
if (!connection) {
throw new ConnectionNotFoundError(
this.getStatus(key, isHealthy, {
message: 'Connection provider not found in application context',
}),
); …Run Code Online (Sandbox Code Playgroud)