mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
feat: Add n8n-node CLI with commands to scaffold and develop nodes (#18090)
This commit is contained in:
34
packages/@n8n/node-cli/src/utils/git.ts
Normal file
34
packages/@n8n/node-cli/src/utils/git.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { execSync } from 'child_process';
|
||||
|
||||
type GitUser = {
|
||||
name?: string;
|
||||
email?: string;
|
||||
};
|
||||
|
||||
export function tryReadGitUser(): GitUser {
|
||||
const user: GitUser = { name: '', email: '' };
|
||||
|
||||
try {
|
||||
const name = execSync('git config --get user.name', {
|
||||
stdio: ['pipe', 'pipe', 'ignore'],
|
||||
})
|
||||
.toString()
|
||||
.trim();
|
||||
if (name) user.name = name;
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
|
||||
try {
|
||||
const email = execSync('git config --get user.email', {
|
||||
stdio: ['pipe', 'pipe', 'ignore'],
|
||||
})
|
||||
.toString()
|
||||
.trim();
|
||||
if (email) user.email = email;
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
Reference in New Issue
Block a user