Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Resolved conflicts by taking GitHub versions for: - .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml Kept deploy.sh updated to: - Pull from GitHub (primary source) - Push to Gitea (push-mirror) - Build from site/ directory (GitHub structure) Co-Authored-By: Paperclip <noreply@paperclip.ing>
39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
import { existsSync, realpathSync } from 'fs';
|
|
import { resolveFrom } from './resolve-from';
|
|
import { dirname, join, relative } from 'path';
|
|
export function hasNecessaryDependencies(baseDir, requiredPackages) {
|
|
let resolutions = new Map();
|
|
const missingPackages = [];
|
|
for (const p of requiredPackages){
|
|
try {
|
|
const pkgPath = realpathSync(resolveFrom(baseDir, `${p.pkg}/package.json`));
|
|
const pkgDir = dirname(pkgPath);
|
|
resolutions.set(join(p.pkg, 'package.json'), pkgPath);
|
|
if (p.exportsRestrict) {
|
|
const fileNameToVerify = relative(p.pkg, p.file);
|
|
if (fileNameToVerify) {
|
|
const fileToVerify = join(pkgDir, fileNameToVerify);
|
|
if (existsSync(fileToVerify)) {
|
|
resolutions.set(p.pkg, fileToVerify);
|
|
} else {
|
|
missingPackages.push(p);
|
|
continue;
|
|
}
|
|
} else {
|
|
resolutions.set(p.pkg, pkgPath);
|
|
}
|
|
} else {
|
|
resolutions.set(p.pkg, resolveFrom(baseDir, p.file));
|
|
}
|
|
} catch (_) {
|
|
missingPackages.push(p);
|
|
continue;
|
|
}
|
|
}
|
|
return {
|
|
resolved: resolutions,
|
|
missing: missingPackages
|
|
};
|
|
}
|
|
|
|
//# sourceMappingURL=has-necessary-dependencies.js.map
|