-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpkg.mjs
38 lines (35 loc) · 1 KB
/
pkg.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import fs from 'fs/promises';
import { dirname, resolve } from 'path';
import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const pkgs = [
'kleur',
'clsx',
'@astrojs/internal-helpers',
'dayjs',
'@astrojs/markdown-remark',
'rehype-slug',
'remark-directive',
'mrmime',
'@astrojs/rss',
'astro',
'p-limit',
'send',
'server-destroy',
'cookie',
'path-to-regexp',
'html-escaper',
'cssesc',
'sitemap'
];
(async () => {
const pkg = await fs.readFile(resolve(__dirname, 'package.json'), 'utf-8');
const pkgJson = JSON.parse(pkg);
pkgJson.dependencies = {};
for (const pkg of pkgs) {
const content = await fs.readFile(resolve(__dirname, 'node_modules', pkg, 'package.json'), 'utf-8');
const json = JSON.parse(content.toString());
pkgJson.dependencies[pkg] = json.version;
}
await fs.writeFile(resolve(__dirname, 'package.json'), JSON.stringify(pkgJson, null, 2));
})()