Skip to content

Commit 61d95c1

Browse files
committed
feat(pplx:ext): add changelog release date
1 parent 0812ad5 commit 61d95c1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+163
-34
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"1.13.1": "April 25, 2025",
3+
"1.13.0": "April 24, 2025",
4+
"1.12.1": "April 18, 2025",
5+
"1.12.0": "April 18, 2025",
6+
"1.11.2": "April 17, 2025",
7+
"1.11.1": "April 17, 2025",
8+
"1.10.8": "",
9+
"1.10.7": "",
10+
"1.10.5": "",
11+
"1.10.4": "",
12+
"1.10.3": "",
13+
"1.10.2": "April 6, 2025",
14+
"1.10.1": "April 3, 2025",
15+
"1.10.0": "April 3, 2025",
16+
"1.9.9": "March 30, 2025",
17+
"1.9.8": "March 28, 2025",
18+
"1.9.7": "March 26, 2025",
19+
"1.9.6": "March 25, 2025",
20+
"1.9.5": "March 25, 2025",
21+
"1.9.3": "March 21, 2025",
22+
"1.9.1": "",
23+
"1.9.0": "March 12, 2025",
24+
"1.8.3": "March 8, 2025",
25+
"1.8.2": "March 7, 2025",
26+
"1.8.0": "March 6, 2025",
27+
"1.7.3": "March 2, 2025",
28+
"1.7.2": "March 1, 2025",
29+
"1.7.1": "",
30+
"1.7.0": "February 27, 2025",
31+
"1.6.11": "February 26, 2025",
32+
"1.6.10": "February 23, 2025",
33+
"1.6.8": "February 21, 2025",
34+
"1.6.6": "February 16, 2025",
35+
"1.6.5": "February 13, 2025",
36+
"1.6.4": "February 12, 2025",
37+
"1.6.3": "February 11, 2025",
38+
"1.6.1": "February 10, 2025",
39+
"1.6.0": "February 8, 2025",
40+
"1.5.2": "February 5, 2025",
41+
"1.5.0": "February 4, 2025",
42+
"1.4.10": "February 2, 2025",
43+
"1.4.9": "",
44+
"1.4.8": "",
45+
"1.4.7": "February 1, 2025",
46+
"1.4.6": "February 1, 2025",
47+
"1.4.5": "",
48+
"1.4.4": "",
49+
"1.4.3": "January 30, 2025",
50+
"1.4.2": "January 29, 2025",
51+
"1.4.1": "",
52+
"1.4.0": "January 28, 2025",
53+
"1.3.7": "January 25, 2025",
54+
"1.3.4": "",
55+
"1.3.3": "January 20, 2025",
56+
"1.3.2": "January 18, 2025",
57+
"1.3.1": "January 15, 2025",
58+
"1.3.0": "January 13, 2025",
59+
"1.2.7": "January 9, 2025",
60+
"1.2.6": "January 8, 2025",
61+
"1.2.5": "January 6, 2025",
62+
"1.2.4": "January 5, 2025",
63+
"1.2.3": "January 4, 2025",
64+
"1.2.2": "January 3, 2025",
65+
"1.2.0": "January 3, 2025",
66+
"1.1.2": "December 26, 2024",
67+
"1.1.0": "December 25, 2024",
68+
"1.0.6": "December 20, 2024",
69+
"1.0.5": "",
70+
"1.0.4": "",
71+
"1.0.3": "",
72+
"1.0.2": "December 13, 2024",
73+
"1.0.1": "December 12, 2024",
74+
"1.0.0": "December 12, 2025"
75+
}

perplexity/extension/cli/src/r2/changelogs-push.ts

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,38 +15,50 @@ if (require.main === module) {
1515
process.exit(1);
1616
}
1717

18-
await syncWithBucket({
19-
client: r2Client,
20-
bucketName: BUCKET_NAME,
21-
localDir: dir,
22-
logger,
23-
prefix: "changelogs/",
24-
}).catch((error: Error) => {
25-
logger.error(`Unhandled error: ${error.message}`);
26-
process.exit(1);
27-
});
18+
const listingFile = path.resolve(getRootPath(), "changelogs/listing.json");
2819

29-
const versionsFile = path.resolve(
30-
getRootPath(),
31-
"cdn/resources/versions.json",
32-
);
33-
34-
if (!fs.existsSync(versionsFile)) {
35-
logger.warn(`File ${versionsFile} does not exist, skipping listing update`);
20+
if (!fs.existsSync(listingFile)) {
21+
logger.warn(`File ${listingFile} does not exist, skipping listing update`);
3622
process.exit(0);
3723
}
3824

39-
const versions = JSON.parse(fs.readFileSync(versionsFile, "utf8"));
25+
const versions = JSON.parse(fs.readFileSync(listingFile, "utf8"));
4026

4127
const changelogFiles = fs.readdirSync(dir);
4228
const changelogEntries = changelogFiles
4329
.filter((file) => file.endsWith(".md"))
4430
.map((file) => file.replace(".md", ""))
4531
.sort((a, b) => semver.compare(semver.coerce(b)!, semver.coerce(a)!));
4632

47-
versions.changelogEntries = changelogEntries;
33+
changelogEntries.forEach((entry) => {
34+
versions[entry] =
35+
versions[entry] != null
36+
? versions[entry]
37+
: new Date().toLocaleDateString("en-US", {
38+
year: "numeric",
39+
month: "long",
40+
day: "numeric",
41+
});
42+
});
43+
44+
const sortedVersions = Object.fromEntries(
45+
Object.entries(versions).sort(([a], [b]) =>
46+
semver.compare(semver.coerce(b)!, semver.coerce(a)!),
47+
),
48+
);
49+
50+
fs.writeFileSync(listingFile, JSON.stringify(sortedVersions, null, 2));
4851

49-
fs.writeFileSync(versionsFile, JSON.stringify(versions, null, 2));
52+
logger.success(`Listing updated and sorted by semver`);
5053

51-
logger.success(`Listing updated`);
54+
await syncWithBucket({
55+
client: r2Client,
56+
bucketName: BUCKET_NAME,
57+
localDir: dir,
58+
logger,
59+
prefix: "changelogs/",
60+
}).catch((error: Error) => {
61+
logger.error(`Unhandled error: ${error.message}`);
62+
process.exit(1);
63+
});
5264
}

perplexity/extension/src/entrypoints/options-page/dashboard/pages/release-notes/ReleaseNotesPage.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1+
import { useQuery } from "@tanstack/react-query";
12
import { useEffect, useRef } from "react";
23
import { LuLoaderCircle } from "react-icons/lu";
34

45
import ChangelogRenderer from "@/components/changelog/ChangelogRenderer";
56
import { Skeleton } from "@/components/ui/skeleton";
67
import { useVersionPagination } from "@/entrypoints/options-page/dashboard/pages/release-notes/hooks/useVersionPagination";
8+
import { cplxApiQueries } from "@/services/cplx-api/query-keys";
79
import { cn } from "@/utils/cn";
810
import { PPLX_SCROLLBAR_CLASSES } from "@/utils/pplx-scrollbar-classes";
911

1012
export function ReleaseNotesPage() {
1113
const { loadedVersions, hasMore, loadNextVersions, changelogQueries } =
1214
useVersionPagination();
1315

16+
const { data: changelogListing } = useQuery(
17+
cplxApiQueries.changelog.listing.detail(),
18+
);
19+
1420
const observerRef = useRef<IntersectionObserver | null>(null);
1521
const loadMoreRef = useRef<HTMLDivElement>(null);
1622

@@ -33,7 +39,7 @@ export function ReleaseNotesPage() {
3339
}, [hasMore, loadNextVersions]);
3440

3541
return (
36-
<div className="x:flex x:flex-col x:gap-4">
42+
<div className="x:flex x:flex-col x:gap-8">
3743
<div className="x:flex x:flex-col x:gap-2">
3844
<h1 className="x:text-2xl x:font-bold">Release Notes</h1>
3945
<p className="x:text-sm x:text-muted-foreground">
@@ -51,14 +57,18 @@ export function ReleaseNotesPage() {
5157
const changelogQuery = changelogQueries[index];
5258
const isLoading = changelogQuery?.isLoading;
5359
const changelog = changelogQuery?.data;
60+
const releaseDate = changelogListing?.[version];
5461

5562
return (
5663
<div
5764
key={version}
58-
className="x:mb-8 x:grid x:grid-cols-1 x:gap-4 x:last:mb-0 x:md:grid-cols-[6rem_1fr] x:md:gap-x-6"
65+
className="x:relative x:mb-8 x:grid x:grid-cols-1 x:gap-4 x:last:mb-0 x:md:grid-cols-[8rem_1fr] x:md:gap-x-6"
5966
>
60-
<div className="x:relative x:flex x:items-start x:md:justify-end">
61-
<div className="x:sticky x:mb-2 x:w-max x:rounded-lg x:border x:border-border/50 x:bg-secondary x:px-2 x:py-1 x:text-left x:font-mono x:text-lg x:md:top-4">
67+
<div className="x:sticky x:top-4 x:flex x:h-fit x:flex-col-reverse x:items-start x:gap-2 x:self-start x:md:flex-col x:md:items-end">
68+
<div className="x:ml-2 x:text-right x:text-sm x:text-muted-foreground">
69+
{releaseDate}
70+
</div>
71+
<div className="x:mb-2 x:w-max x:rounded-lg x:border x:border-border/50 x:bg-secondary x:px-2 x:py-1 x:text-left x:font-mono x:text-lg">
6272
{version}
6373
</div>
6474
</div>

perplexity/extension/src/entrypoints/options-page/dashboard/pages/release-notes/hooks/useVersionPagination.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,21 @@ import semver from "semver";
33

44
import { APP_CONFIG } from "@/app.config";
55
import { cplxApiQueries } from "@/services/cplx-api/query-keys";
6-
import { CplxVersionsService } from "@/services/cplx-api/remote-resources/versions";
76

87
export function useVersionPagination() {
9-
const { data: versions } = useQuery({
10-
...CplxVersionsService.query,
11-
});
8+
const { data: changelogListing } = useQuery(
9+
cplxApiQueries.changelog.listing.detail(),
10+
);
1211

1312
const availableVersions = useMemo(() => {
14-
if (!versions?.changelogEntries) return [];
15-
return versions.changelogEntries.filter((version) =>
13+
if (!changelogListing) return [];
14+
return Object.keys(changelogListing).filter((version) =>
1615
semver.lte(version, APP_CONFIG.VERSION),
1716
);
18-
}, [versions?.changelogEntries]);
17+
}, [changelogListing]);
1918

2019
const { data, fetchNextPage, hasNextPage } = useInfiniteQuery({
21-
queryKey: ["versionPagination", versions?.changelogEntries],
20+
queryKey: ["versionPagination", changelogListing],
2221
queryFn: ({ pageParam = 0 }) => {
2322
const startIndex = pageParam as number;
2423
const count = 1;

perplexity/extension/src/services/cplx-api/offline-service.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import type { ZodSchema } from "zod";
22

3+
import type { ChangelogListing } from "@/services/cplx-api/types";
4+
35
export class CplxApiOfflineService {
46
static fetchChangelog({
57
version: _,
68
}: { version?: string } = {}): Promise<string> {
79
return Promise.resolve("");
810
}
911

12+
static fetchChangelogListing(): Promise<ChangelogListing> {
13+
return Promise.resolve({});
14+
}
15+
1016
static async fetchRemoteResource<T>(_params: {
1117
resourcePath: string;
1218
zodSchema: ZodSchema<T>;

perplexity/extension/src/services/cplx-api/online-service.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import type { ZodSchema } from "zod";
22

33
import { APP_CONFIG } from "@/app.config";
4+
import {
5+
ChangelogListingSchema,
6+
type ChangelogListing,
7+
} from "@/services/cplx-api/types";
48
import { fetchResourceWithSchema, getUrl } from "@/services/cplx-api/utils";
59
import { fetchTextResource } from "@/utils/utils";
6-
710
export class CplxApiService {
811
static async fetchChangelog({ version }: { version?: string } = {}) {
912
const targetVersion = version ?? APP_CONFIG.VERSION;
@@ -24,6 +27,18 @@ export class CplxApiService {
2427
return resp.text();
2528
}
2629

30+
static async fetchChangelogListing(): Promise<ChangelogListing> {
31+
return ChangelogListingSchema.parse(
32+
JSON.parse(
33+
await fetchTextResource(
34+
getUrl({
35+
path: "/changelogs/listing.json",
36+
}).toString(),
37+
),
38+
),
39+
);
40+
}
41+
2742
static async fetchRemoteResource<T>({
2843
resourcePath,
2944
zodSchema,

perplexity/extension/src/services/cplx-api/query-keys.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ export const cplxApiQueries = {
1313
queryKey: [...cplxApiQueries.changelog.all(), params] as const,
1414
queryFn: () => CplxApiService.fetchChangelog(params),
1515
}),
16+
listing: {
17+
all: () => [...cplxApiQueries.changelog.all(), "listing"] as const,
18+
detail: () =>
19+
queryOptions({
20+
queryKey: [...cplxApiQueries.changelog.listing.all()] as const,
21+
queryFn: () => CplxApiService.fetchChangelogListing(),
22+
}),
23+
},
1624
},
1725

1826
remoteResource: {

perplexity/extension/src/services/cplx-api/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ export const FeatureCompatibilitySchema = z.record(
4646
);
4747

4848
export type FeatureCompatibility = z.infer<typeof FeatureCompatibilitySchema>;
49+
50+
export const ChangelogListingSchema = z.record(SemverSchema, z.string());
51+
52+
export type ChangelogListing = z.infer<typeof ChangelogListingSchema>;

0 commit comments

Comments
 (0)