Skip to content

Commit 166a17d

Browse files
committed
switch to full ts first (description)
1 parent 3d94a1a commit 166a17d

File tree

122 files changed

+331
-328
lines changed

Some content is hidden

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

122 files changed

+331
-328
lines changed

apps/svelte.dev/scripts/sync-packages/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ pnpm sync-packages
1010

1111
## Notes
1212

13-
- All packages `names` are in `FEATURED` and `SV_ADD` of [packages-meta.ts](apps/svelte.dev/src/lib/packages-meta.ts) file.
13+
- All packages `names` are in `FEATURED` of [packages-meta.ts](apps/svelte.dev/src/lib/packages-meta.ts) file.
1414

15-
If you want to add or remove a package, you need to update these 2 objects and run the script again (it will update the json files in the `src/lib/server/generated/registry` directory).
15+
If you want to add or remove a package, you need to update `FEATURED` objects and run the script again (it will update the json files in the `src/lib/server/generated/registry` directory).
1616

1717
- [sync-packages.yml](/.github/workflows/sync-packages.yml) is responsible for running the script regularly and update all metadata (it can also be triggered manually).
1818

apps/svelte.dev/scripts/sync-packages/index.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ let logsAtTheEnd: {
2323
extra: string;
2424
}[] = [];
2525

26-
const packages = [
27-
...PACKAGES_META.FEATURED.flatMap((pkg) => pkg.packages),
28-
...PACKAGES_META.SV_ADD.packages
29-
];
26+
const packages = PACKAGES_META.FEATURED.flatMap((pkg) => pkg.packages).map((pkg) => pkg.name);
3027

3128
const registryFolder = 'src/lib/server/generated/registry';
3229

@@ -115,7 +112,7 @@ async function getNpmAndGitHubData(pkg: string): Promise<PackageKey & PackageNpm
115112
// delete npmInfo.versions;
116113
// console.log(`npmInfo`, npmInfo);
117114

118-
const description = npmInfo.description;
115+
const npm_description = npmInfo.description;
119116
const raw_repo_url = npmInfo.repository?.url ?? '';
120117
const repo_url = raw_repo_url?.replace(/^git\+/, '').replace(/\.git$/, '');
121118
if (!repo_url) {
@@ -158,7 +155,7 @@ async function getNpmAndGitHubData(pkg: string): Promise<PackageKey & PackageNpm
158155

159156
return {
160157
name: pkg,
161-
description,
158+
npm_description,
162159
repo_url,
163160
authors,
164161
homepage,
@@ -168,6 +165,7 @@ async function getNpmAndGitHubData(pkg: string): Promise<PackageKey & PackageNpm
168165
updated,
169166
svelte_range,
170167
kit_range,
168+
171169
// GitHub
172170
github_stars
173171
};
@@ -186,11 +184,6 @@ async function refreshJsonFile(fullPath: string) {
186184
}
187185
}
188186

189-
// don't overwrite the description if it exists
190-
if (currentJson.description) {
191-
delete newData.description;
192-
}
193-
194187
// Let's not filter npm downloads changes
195188
// // filter changes of downloads
196189
// if (newData.downloads && currentJson.downloads) {
@@ -229,7 +222,7 @@ async function refreshJsonFile(fullPath: string) {
229222
function writeJsonData(path: string, data: any) {
230223
const keysOrder: (keyof PackageKey | keyof PackageNpm | keyof PackageGithub)[] = [
231224
'name',
232-
'description',
225+
'npm_description',
233226
'repo_url',
234227
'authors',
235228
'homepage',

0 commit comments

Comments
 (0)