Skip to content

Commit

Permalink
fix fs
Browse files Browse the repository at this point in the history
  • Loading branch information
Zyie committed Apr 29, 2024
1 parent 964fa3a commit 6d30d28
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions packages/spine/src/spineAtlasCacheBuster.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { removeSync, writeFileSync } from 'fs-extra';
import fs from 'fs-extra';
import { AtlasView } from './AtlasView';
import { type AssetPipe, checkExt, findAssets } from '@play-co/assetpack-core';

Expand Down Expand Up @@ -72,10 +72,10 @@ export function spineAtlasCacheBuster(): AssetPipe

atlasAsset.path = atlasAsset.path.replace(originalHash, atlasAsset.hash);

removeSync(originalPath);
fs.removeSync(originalPath);

// rewrite..
writeFileSync(atlasAsset.path, atlasAsset.buffer);
fs.writeFileSync(atlasAsset.path, atlasAsset.buffer);
});

atlasFileToFix.length = 0;
Expand Down
6 changes: 3 additions & 3 deletions packages/spine/src/spineAtlasManifestMod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readJsonSync, writeJSONSync } from 'fs-extra';
import fs from 'fs-extra';
import { AtlasView } from './AtlasView';
import { type AssetPipe, findAssets, path } from '@play-co/assetpack-core';

Expand Down Expand Up @@ -50,7 +50,7 @@ export function spineAtlasManifestMod(_options: SpineManifestOptions = {}): Asse
const newFileName = path.dirname(manifestLocation) === '.'
? path.joinSafe(pipeSystem.outputPath, manifestLocation) : manifestLocation;

const manifest = readJsonSync(newFileName);
const manifest = fs.readJsonSync(newFileName);

atlasAssets.forEach((atlasAsset) =>
{
Expand All @@ -65,7 +65,7 @@ export function spineAtlasManifestMod(_options: SpineManifestOptions = {}): Asse
});
});

writeJSONSync(newFileName, manifest, { spaces: 2 });
fs.writeJSONSync(newFileName, manifest, { spaces: 2 });
}
};
}
Expand Down
6 changes: 3 additions & 3 deletions packages/texture-packer/src/texturePackerCacheBuster.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { removeSync, writeFileSync } from 'fs-extra';
import fs from 'fs-extra';
import { type AssetPipe, checkExt, findAssets } from '@play-co/assetpack-core';

import type { Asset } from '@play-co/assetpack-core';
Expand Down Expand Up @@ -70,10 +70,10 @@ export function texturePackerCacheBuster(): AssetPipe

jsonAsset.path = jsonAsset.path.replace(originalHash, jsonAsset.hash);

removeSync(originalPath);
fs.removeSync(originalPath);

// rewrite..
writeFileSync(jsonAsset.path, jsonAsset.buffer);
fs.writeFileSync(jsonAsset.path, jsonAsset.buffer);
});

textureJsonFilesToFix.length = 0;
Expand Down
8 changes: 4 additions & 4 deletions packages/texture-packer/src/texturePackerManifestMod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { existsSync, readJsonSync, writeJSONSync } from 'fs-extra';
import fs from 'fs-extra';
import { type AssetPipe, findAssets, path } from '@play-co/assetpack-core';

import type { Asset } from '@play-co/assetpack-core';
Expand Down Expand Up @@ -49,15 +49,15 @@ export function texturePackerManifestMod(
const newFileName = path.dirname(manifestLocation) === '.'
? path.joinSafe(pipeSystem.outputPath, manifestLocation) : manifestLocation;

if (!existsSync(newFileName))
if (!fs.existsSync(newFileName))
{
// eslint-disable-next-line max-len
console.warn(`[Assetpack] Texture Packer Manifest could not find the manifest: ${newFileName}. Please ensure that the 'pixiManifest' output and the 'texturePackerManifest' output are the same.`);

return;
}

const manifest = readJsonSync(newFileName);
const manifest = fs.readJsonSync(newFileName);

// used to make sure we don't process the same asset twice.
const duplicateHash: Record<string, boolean> = {};
Expand Down Expand Up @@ -102,7 +102,7 @@ export function texturePackerManifestMod(
});

// write the new manifest.
writeJSONSync(newFileName, manifest, { spaces: 2 });
fs.writeJSONSync(newFileName, manifest, { spaces: 2 });

return;
}
Expand Down

0 comments on commit 6d30d28

Please sign in to comment.