@pnpm/read-project-manifest
Advanced tools
Comparing version 4.0.2 to 4.1.0
import { ProjectManifest } from '@pnpm/types'; | ||
declare type WriteProjectManifest = (manifest: ProjectManifest, force?: boolean) => Promise<void>; | ||
type WriteProjectManifest = (manifest: ProjectManifest, force?: boolean) => Promise<void>; | ||
export declare function safeReadProjectManifestOnly(projectDir: string): Promise<ProjectManifest | null>; | ||
@@ -4,0 +4,0 @@ export declare function readProjectManifest(projectDir: string): Promise<{ |
@@ -10,5 +10,6 @@ "use strict"; | ||
const error_1 = require("@pnpm/error"); | ||
const text_comments_parser_1 = require("@pnpm/text.comments-parser"); | ||
const write_project_manifest_1 = require("@pnpm/write-project-manifest"); | ||
const read_yaml_file_1 = __importDefault(require("read-yaml-file")); | ||
const detect_indent_1 = __importDefault(require("detect-indent")); | ||
const detect_indent_1 = __importDefault(require("@gwhitney/detect-indent")); | ||
const fast_deep_equal_1 = __importDefault(require("fast-deep-equal")); | ||
@@ -68,3 +69,3 @@ const is_windows_1 = __importDefault(require("is-windows")); | ||
writeProjectManifest: createManifestWriter({ | ||
...detectFileFormatting(text), | ||
...detectFileFormattingAndComments(text), | ||
initialManifest: data, | ||
@@ -115,2 +116,10 @@ manifestPath, | ||
exports.tryReadProjectManifest = tryReadProjectManifest; | ||
function detectFileFormattingAndComments(text) { | ||
const { comments, text: newText, hasFinalNewline } = (0, text_comments_parser_1.extractComments)(text); | ||
return { | ||
comments, | ||
indent: (0, detect_indent_1.default)(newText).indent, | ||
insertFinalNewline: hasFinalNewline, | ||
}; | ||
} | ||
function detectFileFormatting(text) { | ||
@@ -141,3 +150,3 @@ return { | ||
writeProjectManifest: createManifestWriter({ | ||
...detectFileFormatting(text), | ||
...detectFileFormattingAndComments(text), | ||
initialManifest: data, | ||
@@ -177,2 +186,3 @@ manifestPath, | ||
await (0, write_project_manifest_1.writeProjectManifest)(opts.manifestPath, updatedManifest, { | ||
comments: opts.comments, | ||
indent: opts.indent, | ||
@@ -179,0 +189,0 @@ insertFinalNewline: opts.insertFinalNewline, |
{ | ||
"name": "@pnpm/read-project-manifest", | ||
"version": "4.0.2", | ||
"version": "4.1.0", | ||
"description": "Read a project manifest (called package.json in most cases)", | ||
@@ -14,3 +14,3 @@ "main": "lib/index.js", | ||
], | ||
"repository": "https://github.com/pnpm/pnpm/blob/main/packages/read-project-manifest", | ||
"repository": "https://github.com/pnpm/pnpm/blob/main/pkg-manifest/read-project-manifest", | ||
"keywords": [ | ||
@@ -24,9 +24,5 @@ "pnpm7", | ||
}, | ||
"homepage": "https://github.com/pnpm/pnpm/blob/main/packages/read-project-manifest#readme", | ||
"homepage": "https://github.com/pnpm/pnpm/blob/main/pkg-manifest/read-project-manifest#readme", | ||
"dependencies": { | ||
"@pnpm/error": "4.0.0", | ||
"@pnpm/graceful-fs": "2.0.0", | ||
"@pnpm/types": "8.9.0", | ||
"@pnpm/write-project-manifest": "4.0.2", | ||
"detect-indent": "^6.1.0", | ||
"@gwhitney/detect-indent": "7.0.1", | ||
"fast-deep-equal": "^3.1.3", | ||
@@ -38,9 +34,14 @@ "is-windows": "^1.0.2", | ||
"sort-keys": "^4.2.0", | ||
"strip-bom": "^4.0.0" | ||
"strip-bom": "^4.0.0", | ||
"@pnpm/error": "4.0.0", | ||
"@pnpm/graceful-fs": "2.0.0", | ||
"@pnpm/text.comments-parser": "1.0.0", | ||
"@pnpm/types": "8.9.0", | ||
"@pnpm/write-project-manifest": "4.1.0" | ||
}, | ||
"devDependencies": { | ||
"@pnpm/read-project-manifest": "4.0.2", | ||
"@types/is-windows": "^1.0.0", | ||
"@types/parse-json": "^4.0.0", | ||
"tempy": "^1.0.1" | ||
"tempy": "^1.0.1", | ||
"@pnpm/read-project-manifest": "4.1.0" | ||
}, | ||
@@ -47,0 +48,0 @@ "funding": "https://opencollective.com/pnpm", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
20165
280
0
13
+ Added@gwhitney/detect-indent@7.0.1(transitive)
+ Added@pnpm/text.comments-parser@1.0.0(transitive)
+ Added@pnpm/write-project-manifest@4.1.0(transitive)
+ Addedstrip-comments-strings@1.2.0(transitive)
- Removeddetect-indent@^6.1.0
- Removed@pnpm/write-project-manifest@4.0.2(transitive)
- Removeddetect-indent@6.1.0(transitive)