MCPcopy Index your code
hub / github.com/ether/etherpad / detectInstallMethod

Function detectInstallMethod

src/node/updater/InstallMethodDetector.ts:31–46  ·  view source on GitHub ↗
(
  opts: DetectOptions,
)

Source from the content-addressed store, hash-verified

29 * - 'managed' is the catch-all for installs we can't safely modify.
30 */
31export const detectInstallMethod = async (
32 opts: DetectOptions,
33): Promise<Exclude<InstallMethod, 'auto'>> => {
34 if (opts.override !== 'auto') return opts.override;
35
36 const dockerEnv = opts.dockerEnvPath ?? '/.dockerenv';
37 if (await exists(dockerEnv)) return 'docker';
38
39 const gitDir = path.join(opts.rootDir, '.git');
40 if (await exists(gitDir) && await writable(opts.rootDir)) return 'git';
41
42 const lockfile = path.join(opts.rootDir, 'package-lock.json');
43 if (await exists(lockfile) && await writable(lockfile)) return 'npm';
44
45 return 'managed';
46};

Callers 2

expressCreateServerFunction · 0.90

Calls 2

existsFunction · 0.85
writableFunction · 0.85

Tested by

no test coverage detected