Skip to content

Commit 3ac7dea

Browse files
chore(PackageManager): allow legacy peer deps for DV components
1 parent 1d6e9cb commit 3ac7dea

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

packages/core/packages/PackageManager.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ export class PackageManager {
9595
case "npm":
9696
/* passes through */
9797
default:
98-
command = `${managerCommand} install --quiet`;
98+
// TODO: remove --legacy-peer-deps flag igniteui-cli#1338 once new DV package is available
99+
command = `${managerCommand} install --quiet --legacy-peer-deps`;
99100
break;
100101
}
101102
await this.flushQueue(false);
@@ -165,7 +166,8 @@ export class PackageManager {
165166
}
166167

167168
public static async queuePackage(packageName: string, verbose = false) {
168-
const command = this.getInstallCommand(this.getManager(), packageName).replace("--save", "--no-save");
169+
// TODO: remove --legacy-peer-deps flag igniteui-cli#1338 once new DV package is available
170+
const command = this.getInstallCommand(this.getManager(), packageName).replace("--save", "--no-save").concat(" --legacy-peer-deps");
169171
const [packName, version] = packageName.split(/@(?=[^\/]+$)/);
170172
const packageJSON = this.getPackageJSON();
171173
if (!packageJSON.dependencies) {

spec/unit/packageManager-spec.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ describe("Unit - Package Manager", () => {
296296
expect(Util.log).toHaveBeenCalledWith(`Installing npm packages`);
297297
expect(Util.log).toHaveBeenCalledWith(`Error installing npm packages.`);
298298
expect(Util.log).toHaveBeenCalledWith(`Example`);
299-
expect(Util.execSync).toHaveBeenCalledWith(`npm install --quiet`,
299+
// TODO: remove --legacy-peer-deps flag igniteui-cli#1338 once new DV package is available
300+
expect(Util.execSync).toHaveBeenCalledWith(`npm install --quiet --legacy-peer-deps`,
300301
{ stdio: ["inherit"], killSignal: "SIGINT" });
301302
mockProjectConfig.packagesInstalled = true;
302303
expect(ProjectConfig.setConfig).toHaveBeenCalledWith(mockProjectConfig);
@@ -312,7 +313,8 @@ describe("Unit - Package Manager", () => {
312313
expect(Util.log).toHaveBeenCalledTimes(2);
313314
expect(Util.log).toHaveBeenCalledWith(`Installing npm packages`);
314315
expect(Util.log).toHaveBeenCalledWith(`Packages installed successfully`);
315-
expect(Util.execSync).toHaveBeenCalledWith(`npm install --quiet`,
316+
// TODO: remove --legacy-peer-deps flag igniteui-cli#1338 once new DV package is available
317+
expect(Util.execSync).toHaveBeenCalledWith(`npm install --quiet --legacy-peer-deps`,
316318
{ stdio: ["inherit"], killSignal: "SIGINT" });
317319
mockProjectConfig.packagesInstalled = true;
318320
expect(ProjectConfig.setConfig).toHaveBeenCalledWith(mockProjectConfig);
@@ -331,7 +333,8 @@ describe("Unit - Package Manager", () => {
331333
await PackageManager.installPackages(true);
332334
expect(Util.log).toHaveBeenCalledTimes(1);
333335
expect(Util.log).toHaveBeenCalledWith(`Installing npm packages`);
334-
expect(Util.execSync).toHaveBeenCalledWith(`npm install --quiet`,
336+
// TODO: remove --legacy-peer-deps flag igniteui-cli#1338 once new DV package is available
337+
expect(Util.execSync).toHaveBeenCalledWith(`npm install --quiet --legacy-peer-deps`,
335338
{ stdio: ["inherit"], killSignal: "SIGINT" });
336339
expect(process.exit).toHaveBeenCalled();
337340
expect(ProjectConfig.setConfig).toHaveBeenCalledTimes(0);
@@ -417,7 +420,7 @@ describe("Unit - Package Manager", () => {
417420
expect(Util.log).toHaveBeenCalledTimes(0);
418421
expect(child_process.exec).toHaveBeenCalledTimes(1);
419422
expect(child_process.exec).toHaveBeenCalledWith(
420-
`npm install test-pack --quiet --no-save`, {}, jasmine.any(Function));
423+
`npm install test-pack --quiet --no-save --legacy-peer-deps`, {}, jasmine.any(Function));
421424
});
422425

423426
it("queuePackage should ignore existing package installs", async () => {

0 commit comments

Comments
 (0)