Skip to content

Commit 7a7c4f0

Browse files
authored
feat(React): Update react html files with licensed packages when upgrading packages (#1395)
1 parent 91d93b9 commit 7a7c4f0

File tree

2 files changed

+53
-4
lines changed

2 files changed

+53
-4
lines changed

packages/core/update/Update.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export async function updateWorkspace(rootPath: string): Promise<boolean> {
2828
guideLink = "https://www.infragistics.com/products/ignite-ui-react/react/components/general-licensing";
2929
logicFilesExtension = "tsx";
3030
styleExtensions = ["css"];
31+
shouldUpgradeHTML = true;
3132
break;
3233
case "webcomponents":
3334
guideLink = "https://www.infragistics.com/products/ignite-ui-web-components/web-components/components/general-licensing";

spec/unit/update-spec.ts

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ title = 'igniteui-angular example';
504504
(fsSpy.fileExists as jasmine.Spy).and.returnValue(true);
505505
(fsSpy.glob as jasmine.Spy).and.returnValues // per workspace
506506
([ "package.json" ], // root package.json
507+
[], // html files
507508
[], // logic files
508509
[], // for each style extension
509510
[]); // inner package.json files
@@ -525,7 +526,7 @@ title = 'igniteui-angular example';
525526
}
526527
}));
527528
expect(fsSpy.writeFile).toHaveBeenCalledTimes(1);
528-
expect(fsSpy.glob).toHaveBeenCalledTimes(4);
529+
expect(fsSpy.glob).toHaveBeenCalledTimes(5);
529530
});
530531

531532
it("Should update import paths in files correctly", async () => {
@@ -609,9 +610,55 @@ export default function Home() {
609610
- run: echo "//packages.infragistics.com/npm/js-licensed/:always-auth=true" >> ~/.npmrc
610611
- run: npm i # replace with 'npm ci' after committing lock file from first install
611612
# end content
612-
`}];
613+
`},
614+
{
615+
path: "index.html",
616+
content:
617+
`<!DOCTYPE html>
618+
<html lang="en">
619+
<head>
620+
<meta charset="utf-8" />
621+
<link rel="shortcut icon" href="/favicon.ico" />
622+
<meta
623+
name="viewport"
624+
content="width=device-width, initial-scale=1, shrink-to-fit=no"
625+
/>
626+
<meta name="theme-color" content="#000000" />
627+
<title>IgniteUI for React</title>
628+
<link rel="stylesheet" href="./styles.css" />
629+
<link rel="stylesheet"
630+
href="node_modules/igniteui-react-grids/grids/themes/light/bootstrap.css"
631+
</head>
632+
<body>
633+
<div id="root"></div>
634+
</body>
635+
<script type="module" src="/src/main.tsx"></script>
636+
</html>`,
637+
expected:
638+
`<!DOCTYPE html>
639+
<html lang="en">
640+
<head>
641+
<meta charset="utf-8" />
642+
<link rel="shortcut icon" href="/favicon.ico" />
643+
<meta
644+
name="viewport"
645+
content="width=device-width, initial-scale=1, shrink-to-fit=no"
646+
/>
647+
<meta name="theme-color" content="#000000" />
648+
<title>IgniteUI for React</title>
649+
<link rel="stylesheet" href="./styles.css" />
650+
<link rel="stylesheet"
651+
href="node_modules/@infragistics/igniteui-react-grids/grids/themes/light/bootstrap.css"
652+
</head>
653+
<body>
654+
<div id="root"></div>
655+
</body>
656+
<script type="module" src="/src/main.tsx"></script>
657+
</html>`
658+
},];
613659
(fsSpy.glob as jasmine.Spy).and.returnValues // per workspace
614660
([ "package.json" ], // root package.json
661+
["index.html"], // html file
615662
[ "src/home.tsx" ], // logic files
616663
[], // for each style extension
617664
[]); // inner package.json files
@@ -628,7 +675,7 @@ export default function Home() {
628675
for (const fileEntry of mockFileArray) {
629676
expect((fsSpy.writeFile as jasmine.Spy)).toHaveBeenCalledWith(fileEntry.path, fileEntry.expected);
630677
}
631-
expect(fsSpy.glob).toHaveBeenCalledTimes(4);
678+
expect(fsSpy.glob).toHaveBeenCalledTimes(5);
632679
});
633680

634681
it("Should update package.json files from workspaces", async () => {
@@ -719,6 +766,7 @@ export default function Home() {
719766
(fsSpy.fileExists as jasmine.Spy).and.returnValue(true);
720767
(fsSpy.glob as jasmine.Spy).and.returnValues // per workspace
721768
([ "package.json" ], // root package.json
769+
[], // index.html
722770
[], // projectA logic files
723771
[], // projectA for each style extension
724772
[ "./projectA/package.json" ], // projectA package.json
@@ -740,7 +788,7 @@ export default function Home() {
740788
for (const fileEntry of mockFileArray) {
741789
expect((fsSpy.writeFile as jasmine.Spy)).toHaveBeenCalledWith(fileEntry.path, fileEntry.expected);
742790
}
743-
expect(fsSpy.glob).toHaveBeenCalledTimes(7);
791+
expect(fsSpy.glob).toHaveBeenCalledTimes(8);
744792
});
745793
});
746794

0 commit comments

Comments
 (0)