[ci] yarn format

This commit is contained in:
matthewp 2022-01-13 14:24:25 +00:00 committed by GitHub Actions
parent 2aa5ba5c52
commit 365972582e
3 changed files with 25 additions and 27 deletions

View file

@ -5,19 +5,19 @@ import npath from 'path';
import { fileURLToPath } from 'url';
export function emptyDir(dir: string, skip?: Set<string>): void {
for (const file of fs.readdirSync(dir)) {
if (skip?.has(file)) {
continue
}
const abs = npath.resolve(dir, file)
// baseline is Node 12 so can't use rmSync :(
if (fs.lstatSync(abs).isDirectory()) {
emptyDir(abs)
fs.rmdirSync(abs)
} else {
fs.unlinkSync(abs)
}
}
for (const file of fs.readdirSync(dir)) {
if (skip?.has(file)) {
continue;
}
const abs = npath.resolve(dir, file);
// baseline is Node 12 so can't use rmSync :(
if (fs.lstatSync(abs).isDirectory()) {
emptyDir(abs);
fs.rmdirSync(abs);
} else {
fs.unlinkSync(abs);
}
}
}
export function prepareOutDir(astroConfig: AstroConfig) {

View file

@ -36,8 +36,6 @@ function addPageName(pathname: string, opts: StaticBuildOptions): void {
opts.pageNames.push(pathname.replace(/\/?$/, pathrepl).replace(/^\//, ''));
}
// Determines of a Rollup chunk is an entrypoint page.
function chunkIsPage(output: OutputAsset | OutputChunk, internals: BuildInternals) {
if (output.type !== 'chunk') {
@ -178,14 +176,16 @@ async function collectRenderers(opts: StaticBuildOptions): Promise<Renderer[]> {
// we need the ESM loaded version. This creates that.
const viteLoadedRenderers = pageData.preload[0];
const renderers = await Promise.all(viteLoadedRenderers.map(async r => {
const mod = await import(r.serverEntry);
return Object.create(r, {
ssr: {
value: mod.default
}
}) as Renderer;
}));
const renderers = await Promise.all(
viteLoadedRenderers.map(async (r) => {
const mod = await import(r.serverEntry);
return Object.create(r, {
ssr: {
value: mod.default,
},
}) as Renderer;
})
);
return renderers;
}
@ -253,7 +253,7 @@ async function generatePath(pathname: string, opts: StaticBuildOptions, gopts: G
// This adds the page name to the array so it can be shown as part of stats.
addPageName(pathname, opts);
const [,mod] = pageData.preload;
const [, mod] = pageData.preload;
try {
const [params, pageProps] = await getParamsAndProps({

View file

@ -12,9 +12,7 @@ describe('Static build - frameworks', () => {
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/static-build-frameworks/',
renderers: [
'@astrojs/renderer-preact'
],
renderers: ['@astrojs/renderer-preact'],
buildOptions: {
experimentalStaticBuild: true,
},