init project
This commit is contained in:
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
export function readComposerJson(root) {
|
||||
const file = path.join(root, 'composer.json');
|
||||
if (!fs.existsSync(file))
|
||||
return null;
|
||||
try {
|
||||
return JSON.parse(fs.readFileSync(file, 'utf8'));
|
||||
}
|
||||
catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
export function hasComposerDependency(pkg, name) {
|
||||
if (!pkg)
|
||||
return false;
|
||||
return Boolean(pkg.require?.[name] || pkg['require-dev']?.[name]);
|
||||
}
|
||||
export function vendorBinExists(root, bin) {
|
||||
const suffix = process.platform === 'win32' ? '.bat' : '';
|
||||
return fs.existsSync(path.join(root, 'vendor', 'bin', `${bin}${suffix}`)) || fs.existsSync(path.join(root, 'vendor', 'bin', bin));
|
||||
}
|
||||
//# sourceMappingURL=composer.js.map
|
||||
Reference in New Issue
Block a user