@travetto/manifest
Advanced tools
Comparing version 3.1.0 to 3.1.1
{ | ||
"name": "@travetto/manifest", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "Support for project indexing, manifesting, along with file watching", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -11,3 +11,3 @@ import { extname, dirname, resolve, basename, delimiter, join, sep } from 'path'; | ||
delimiter, | ||
basename: (file: string): string => posix(basename(file)), | ||
basename: (file: string, suffix?: string): string => posix(basename(file, suffix)), | ||
extname: (file: string): string => posix(extname(file)), | ||
@@ -14,0 +14,0 @@ dirname: (file: string): string => posix(dirname(file)), |
@@ -18,8 +18,8 @@ import { readFileSync } from 'fs'; | ||
*/ | ||
static async #writeJsonWithBuffer(ctx: ManifestContext, filename: string, obj: object): Promise<string> { | ||
const tempName = `manifest.${process.ppid}.${process.pid}.json.${Date.now()}`; | ||
const file = path.resolve(ctx.workspacePath, ctx.outputFolder, 'node_modules', ctx.mainModule, filename); | ||
static async writeFileWithBuffer(file: string, content: string): Promise<string> { | ||
const ext = path.extname(file); | ||
const tempName = `${path.basename(file, ext)}.${process.ppid}.${process.pid}.${Date.now()}.${Math.random()}.${ext}`; | ||
await fs.mkdir(path.dirname(file), { recursive: true }); | ||
const temp = path.resolve(os.tmpdir(), tempName); | ||
await fs.writeFile(temp, JSON.stringify(obj), 'utf8'); | ||
await fs.writeFile(temp, content, 'utf8'); | ||
await fs.copyFile(temp, file); | ||
@@ -92,3 +92,6 @@ fs.unlink(temp); | ||
static writeManifest(ctx: ManifestContext, manifest: ManifestRoot): Promise<string> { | ||
return this.#writeJsonWithBuffer(ctx, MANIFEST_FILE, manifest); | ||
return this.writeFileWithBuffer( | ||
path.resolve(ctx.workspacePath, ctx.outputFolder, 'node_modules', ctx.mainModule, MANIFEST_FILE), | ||
JSON.stringify(manifest) | ||
); | ||
} | ||
@@ -95,0 +98,0 @@ |
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
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
72098
1617