[ci] format

This commit is contained in:
Princesseuh 2023-04-13 09:01:47 +00:00 committed by fredkbot
parent a6bec9c1b7
commit 44d935d5d6
2 changed files with 4 additions and 5 deletions

View file

@ -385,15 +385,14 @@ async function ssrMoveAssets(opts: StaticBuildOptions) {
}); });
if (files.length > 0) { if (files.length > 0) {
await Promise.all( await Promise.all(
files.map(async (filename) => { files.map(async (filename) => {
const currentUrl = new URL(filename, appendForwardSlash(serverAssets.toString())); const currentUrl = new URL(filename, appendForwardSlash(serverAssets.toString()));
const clientUrl = new URL(filename, appendForwardSlash(clientAssets.toString())); const clientUrl = new URL(filename, appendForwardSlash(clientAssets.toString()));
const dir = new URL(path.parse(clientUrl.href).dir) const dir = new URL(path.parse(clientUrl.href).dir);
// It can't find this file because the user defines a custom path // It can't find this file because the user defines a custom path
// that includes the folder paths in `assetFileNames // that includes the folder paths in `assetFileNames
if(!fs.existsSync(dir)) await fs.promises.mkdir(dir, { recursive: true }); if (!fs.existsSync(dir)) await fs.promises.mkdir(dir, { recursive: true });
return fs.promises.rename(currentUrl, clientUrl); return fs.promises.rename(currentUrl, clientUrl);
}) })
); );

View file

@ -14,7 +14,7 @@ describe('custom the assets name function', () => {
}); });
it('It cant find this file cause the node throws an error if the users custom a path that includes the folder path', async () => { it('It cant find this file cause the node throws an error if the users custom a path that includes the folder path', async () => {
const csslength = await fixture.readFile('client/assets/css/a.css') const csslength = await fixture.readFile('client/assets/css/a.css');
/** @type {Set<string>} */ /** @type {Set<string>} */
expect(!!csslength).to.equal(true); expect(!!csslength).to.equal(true);
}); });