@travetto/manifest 3.1.0-rc.3 → 3.1.1
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/package.json +1 -1
- package/src/path.ts +1 -1
- package/src/util.ts +8 -5
package/package.json
CHANGED
package/src/path.ts
CHANGED
|
@@ -8,7 +8,7 @@ export const path = {
|
|
|
8
8
|
cwd,
|
|
9
9
|
toPosix: posix,
|
|
10
10
|
delimiter,
|
|
11
|
-
basename: (file: string): string => posix(basename(file)),
|
|
11
|
+
basename: (file: string, suffix?: string): string => posix(basename(file, suffix)),
|
|
12
12
|
extname: (file: string): string => posix(extname(file)),
|
|
13
13
|
dirname: (file: string): string => posix(dirname(file)),
|
|
14
14
|
resolve: (...args: string[]): string => posix(resolve(cwd(), ...args.map(f => posix(f)))),
|
package/src/util.ts
CHANGED
|
@@ -15,12 +15,12 @@ export class ManifestUtil {
|
|
|
15
15
|
/**
|
|
16
16
|
* Write file and copy over when ready
|
|
17
17
|
*/
|
|
18
|
-
static async
|
|
19
|
-
const
|
|
20
|
-
const
|
|
18
|
+
static async writeFileWithBuffer(file: string, content: string): Promise<string> {
|
|
19
|
+
const ext = path.extname(file);
|
|
20
|
+
const tempName = `${path.basename(file, ext)}.${process.ppid}.${process.pid}.${Date.now()}.${Math.random()}.${ext}`;
|
|
21
21
|
await fs.mkdir(path.dirname(file), { recursive: true });
|
|
22
22
|
const temp = path.resolve(os.tmpdir(), tempName);
|
|
23
|
-
await fs.writeFile(temp,
|
|
23
|
+
await fs.writeFile(temp, content, 'utf8');
|
|
24
24
|
await fs.copyFile(temp, file);
|
|
25
25
|
fs.unlink(temp);
|
|
26
26
|
return file;
|
|
@@ -88,7 +88,10 @@ export class ManifestUtil {
|
|
|
88
88
|
* Write manifest for a given context, return location
|
|
89
89
|
*/
|
|
90
90
|
static writeManifest(ctx: ManifestContext, manifest: ManifestRoot): Promise<string> {
|
|
91
|
-
return this
|
|
91
|
+
return this.writeFileWithBuffer(
|
|
92
|
+
path.resolve(ctx.workspacePath, ctx.outputFolder, 'node_modules', ctx.mainModule, MANIFEST_FILE),
|
|
93
|
+
JSON.stringify(manifest)
|
|
94
|
+
);
|
|
92
95
|
}
|
|
93
96
|
|
|
94
97
|
/**
|