@pnpm/releasing.exportable-manifest 1100.1.6 → 1100.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -1
- package/lib/index.js +15 -2
- package/package.json +7 -7
package/lib/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface MakePublishManifestOptions {
|
|
|
8
8
|
hooks?: Hooks;
|
|
9
9
|
modulesDir?: string;
|
|
10
10
|
skipManifestObfuscation?: boolean;
|
|
11
|
-
|
|
11
|
+
embedReadme?: boolean;
|
|
12
12
|
}
|
|
13
13
|
export declare function createExportableManifest(dir: string, originalManifest: ProjectManifest, opts: MakePublishManifestOptions): Promise<ExportedManifest>;
|
|
14
14
|
export type PublishDependencyConverter = (depName: string, depSpec: string, dir: string, modulesDir?: string) => Promise<string> | string;
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
1
2
|
import path from 'node:path';
|
|
2
3
|
import { resolveFromCatalog } from '@pnpm/catalogs.resolver';
|
|
3
4
|
import { PnpmError } from '@pnpm/error';
|
|
@@ -16,6 +17,15 @@ const PREPUBLISH_SCRIPTS = [
|
|
|
16
17
|
'publish',
|
|
17
18
|
'postpublish',
|
|
18
19
|
];
|
|
20
|
+
async function readReadmeFile(projectDir) {
|
|
21
|
+
const entries = await fs.promises.readdir(projectDir, { withFileTypes: true });
|
|
22
|
+
// Only embed a regular README.md file. A symlink could point outside the
|
|
23
|
+
// project and leak its target's contents into the published manifest.
|
|
24
|
+
const readmeEntry = entries.find((entry) => entry.isFile() && /^readme\.md$/i.test(entry.name));
|
|
25
|
+
if (readmeEntry == null)
|
|
26
|
+
return undefined;
|
|
27
|
+
return fs.promises.readFile(path.join(projectDir, readmeEntry.name), 'utf8');
|
|
28
|
+
}
|
|
19
29
|
export async function createExportableManifest(dir, originalManifest, opts) {
|
|
20
30
|
let publishManifest;
|
|
21
31
|
if (opts.skipManifestObfuscation) {
|
|
@@ -48,8 +58,11 @@ export async function createExportableManifest(dir, originalManifest, opts) {
|
|
|
48
58
|
});
|
|
49
59
|
}
|
|
50
60
|
overridePublishConfig(publishManifest);
|
|
51
|
-
if (opts?.
|
|
52
|
-
|
|
61
|
+
if (publishManifest.readme == null && opts?.embedReadme) {
|
|
62
|
+
const readme = await readReadmeFile(dir);
|
|
63
|
+
if (readme != null) {
|
|
64
|
+
publishManifest.readme = readme;
|
|
65
|
+
}
|
|
53
66
|
}
|
|
54
67
|
for (const hook of opts?.hooks?.beforePacking ?? []) {
|
|
55
68
|
// eslint-disable-next-line no-await-in-loop
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/releasing.exportable-manifest",
|
|
3
|
-
"version": "1100.1.
|
|
3
|
+
"version": "1100.1.7",
|
|
4
4
|
"description": "Creates an exportable manifest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"@npm/types": "^2.1.0",
|
|
31
31
|
"p-map-values": "^0.1.0",
|
|
32
32
|
"ramda": "npm:@pnpm/ramda@0.28.1",
|
|
33
|
-
"@pnpm/catalogs.resolver": "1100.0.0",
|
|
34
33
|
"@pnpm/bins.resolver": "1100.0.8",
|
|
35
|
-
"@pnpm/workspace.project-manifest-reader": "1100.0.13",
|
|
36
34
|
"@pnpm/types": "1101.3.2",
|
|
35
|
+
"@pnpm/catalogs.resolver": "1100.0.0",
|
|
36
|
+
"@pnpm/error": "1100.0.0",
|
|
37
37
|
"@pnpm/resolving.jsr-specifier-parser": "1100.0.0",
|
|
38
|
-
"@pnpm/
|
|
38
|
+
"@pnpm/workspace.project-manifest-reader": "1100.0.13"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@jest/globals": "30.4.1",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"@types/ramda": "0.31.1",
|
|
44
44
|
"cross-spawn": "^7.0.6",
|
|
45
45
|
"write-yaml-file": "^6.0.0",
|
|
46
|
-
"@pnpm/catalogs.config": "1100.0.
|
|
46
|
+
"@pnpm/catalogs.config": "1100.0.1",
|
|
47
47
|
"@pnpm/catalogs.types": "1100.0.0",
|
|
48
|
-
"@pnpm/
|
|
48
|
+
"@pnpm/hooks.pnpmfile": "1100.0.15",
|
|
49
49
|
"@pnpm/prepare": "1100.0.16",
|
|
50
|
-
"@pnpm/
|
|
50
|
+
"@pnpm/releasing.exportable-manifest": "1100.1.7"
|
|
51
51
|
},
|
|
52
52
|
"engines": {
|
|
53
53
|
"node": ">=22.13"
|