Skip to content

Commit 6ed2bab

Browse files
committed
Revert "fix: fallback to the package-lock.json, if there is no pnpm-lock.yaml in the project folder"
This reverts commit e92b296.
1 parent e92b296 commit 6ed2bab

1 file changed

Lines changed: 2 additions & 27 deletions

File tree

adminforth/modules/codeInjector.ts

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -223,33 +223,8 @@ class CodeInjector implements ICodeInjector {
223223
try {
224224
lock = yaml.parse(await fs.promises.readFile(lockPath, 'utf-8'));
225225
} catch (e) {
226-
const npmLockPath = path.join(dir, 'package-lock.json');
227-
let npmLock: any = null;
228-
try {
229-
npmLock = JSON.parse(await fs.promises.readFile(npmLockPath, 'utf-8'));
230-
} catch (npmLockError) {
231-
throw new Error(`Custom pnpm-lock.yaml does not exist in ${dir}, but package.json does.
232-
We can't determine version of packages without pnpm-lock.yaml or package-lock.json. Please run pnpm install or npm install in ${dir}`);
233-
}
234-
235-
lockHash = hashify(npmLock);
236-
237-
packages = [
238-
...Object.keys(packageContent.dependencies || {}),
239-
...Object.keys(packageContent.devDependencies || {})
240-
].reduce(
241-
(acc, packageName) => {
242-
const pack = npmLock?.packages?.[`node_modules/${packageName}`];
243-
if (!pack?.version) {
244-
throw new Error(`Package ${packageName} is not in package-lock.json but is in package.json. Please run 'npm install' in ${dir}`);
245-
}
246-
247-
acc.push(`${packageName}@${pack.version}`);
248-
return acc;
249-
}, []
250-
);
251-
252-
return [lockHash, packages];
226+
throw new Error(`Custom pnpm-lock.yaml does not exist in ${dir}, but package.json does.
227+
We can't determine version of packages without pnpm-lock.yaml. Please run pnpm install in ${dir}`);
253228
}
254229
lockHash = hashify(lock);
255230
const importer = lock?.importers?.['.'];

0 commit comments

Comments
 (0)