MCPcopy
hub / github.com/MagicMirrorOrg/MagicMirror / add

Method add

defaultmodules/updatenotification/git_helper.js:53–76  ·  view source on GitHub ↗
(moduleName)

Source from the content-addressed store, hash-verified

51 }
52
53 async add (moduleName) {
54 let moduleFolder = `${global.root_path}`;
55
56 if (moduleName !== "MagicMirror") {
57 moduleFolder = `${moduleFolder}/modules/${moduleName}`;
58 }
59
60 try {
61 Log.info(`Checking git for module: ${moduleName}`);
62 // Throws error if file doesn't exist
63 fs.statSync(path.join(moduleFolder, ".git"));
64
65 // Fetch the git or throw error if no remotes
66 const isGitRepo = await this.isGitRepo(moduleFolder);
67
68 if (isGitRepo) {
69 // Folder has .git and has at least one git remote, watch this folder
70 this.gitRepos.push({ module: moduleName, folder: moduleFolder });
71 }
72 } catch {
73 // Error when directory .git doesn't exist or doesn't have any remotes
74 // This module is not managed with git, skip
75 }
76 }
77
78 async getStatusInfo (repo) {
79 let gitInfo = {

Callers 15

getAllowedSecretsFunction · 0.80
addAnimateCSSFunction · 0.80
_hideModuleFunction · 0.80
ServerFunction · 0.80
notificationFx.jsFile · 0.80
createEventListFunction · 0.80
calculateFilterWindowFunction · 0.80
filterEventsFunction · 0.80
getDomFunction · 0.80
configureModulesFunction · 0.80

Calls 1

isGitRepoMethod · 0.95

Tested by

no test coverage detected