Skip to content

Commit ae29be1

Browse files
committed
fix: implemented CR suggestions
1 parent 2b5eabf commit ae29be1

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

scopes/dependencies/dependency-resolver/dependency-resolver.main.runtime.ts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,36 +1558,35 @@ as an alternative, you can use "+" to keep the same version installed in the wor
15581558
}
15591559

15601560
getEnvJsoncPolicyPkgs(components: Component[]): CurrentPkg[] {
1561+
const policies = [
1562+
{ field: 'peers', targetField: 'peerDependencies' as const },
1563+
{ field: 'dev', targetField: 'devDependencies' as const },
1564+
{ field: 'runtime', targetField: 'dependencies' as const },
1565+
];
15611566
const pkgs: CurrentPkg[] = [];
1562-
components.forEach((component) => {
1567+
for (const component of components) {
15631568
const isEnv = this.envs.isEnv(component);
1564-
if (!isEnv) return;
1569+
if (!isEnv) continue;
15651570

15661571
const envJsoncFile = component.filesystem.files.find((file) => file.relative === 'env.jsonc');
1567-
if (!envJsoncFile) return;
1572+
if (!envJsoncFile) continue;
15681573

15691574
const envJsonc = parse(envJsoncFile.contents.toString()) as EnvJsonc;
1570-
if (!envJsonc.policy) return;
1571-
1572-
const policies = [
1573-
{ field: 'peers', targetField: 'peerDependencies' as const },
1574-
{ field: 'dev', targetField: 'devDependencies' as const },
1575-
{ field: 'runtime', targetField: 'dependencies' as const },
1576-
];
1575+
if (!envJsonc.policy) continue;
15771576

1578-
policies.forEach(({ field, targetField }) => {
1577+
for (const { field, targetField } of policies) {
15791578
const deps: EnvJsoncPolicyEntry[] = envJsonc.policy?.[field] || [];
1580-
deps.forEach((dep) => {
1579+
for (const dep of deps) {
15811580
pkgs.push({
15821581
name: dep.name,
15831582
currentRange: dep.version,
15841583
source: 'env-jsonc',
15851584
componentId: component.id,
15861585
targetField,
15871586
});
1588-
});
1589-
});
1590-
});
1587+
}
1588+
}
1589+
}
15911590
return pkgs;
15921591
}
15931592

0 commit comments

Comments
 (0)