[ci] format

This commit is contained in:
matthewp 2022-06-07 15:43:33 +00:00 committed by github-actions[bot]
parent f3ab822e32
commit 0a978e22fd
3 changed files with 11 additions and 10 deletions

View file

@ -1,9 +1,9 @@
import type { AstroAdapter, AstroIntegration, AstroConfig, RouteData, BuildConfig } from 'astro'; import type { AstroAdapter, AstroConfig, AstroIntegration, BuildConfig, RouteData } from 'astro';
import { createRedirects } from './shared.js';
import esbuild from 'esbuild'; import esbuild from 'esbuild';
import * as fs from 'fs'; import * as fs from 'fs';
import { fileURLToPath } from 'url';
import * as npath from 'path'; import * as npath from 'path';
import { fileURLToPath } from 'url';
import { createRedirects } from './shared.js';
export function getAdapter(): AstroAdapter { export function getAdapter(): AstroAdapter {
return { return {
@ -76,12 +76,13 @@ async function bundleServerEntry(buildConfig: BuildConfig, vite: any) {
allowOverwrite: true, allowOverwrite: true,
format: 'esm', format: 'esm',
bundle: true, bundle: true,
external: [ "@astrojs/markdown-remark"] external: ['@astrojs/markdown-remark'],
}); });
// Remove chunks, if they exist. Since we have bundled via esbuild these chunks are trash. // Remove chunks, if they exist. Since we have bundled via esbuild these chunks are trash.
try { try {
const chunkFileNames = vite?.build?.rollupOptions?.output?.chunkFileNames ?? 'chunks/chunk.[hash].mjs'; const chunkFileNames =
vite?.build?.rollupOptions?.output?.chunkFileNames ?? 'chunks/chunk.[hash].mjs';
const chunkPath = npath.dirname(chunkFileNames); const chunkPath = npath.dirname(chunkFileNames);
const chunksDirUrl = new URL(chunkPath + '/', buildConfig.server); const chunksDirUrl = new URL(chunkPath + '/', buildConfig.server);
await fs.promises.rm(chunksDirUrl, { recursive: true, force: true }); await fs.promises.rm(chunksDirUrl, { recursive: true, force: true });

View file

@ -18,7 +18,7 @@ Deno.test({
assert(html, 'got some html'); assert(html, 'got some html');
const doc = new DOMParser().parseFromString(html, `text/html`); const doc = new DOMParser().parseFromString(html, `text/html`);
const div = doc.querySelector('#thing'); const div = doc.querySelector('#thing');
assert(div, 'div exists') assert(div, 'div exists');
} finally { } finally {
await close(); await close();
await stop(); await stop();

View file

@ -13,17 +13,17 @@ export async function runBuild(fixturePath: string) {
} }
export async function runApp(entryPath: string) { export async function runApp(entryPath: string) {
const entryUrl = new URL(entryPath, dir) const entryUrl = new URL(entryPath, dir);
let proc = Deno.run({ let proc = Deno.run({
cmd: ['deno', 'run', '--allow-env', '--allow-net', fromFileUrl(entryUrl)], cmd: ['deno', 'run', '--allow-env', '--allow-net', fromFileUrl(entryUrl)],
//cwd: fromFileUrl(entryUrl), //cwd: fromFileUrl(entryUrl),
stderr: 'piped' stderr: 'piped',
}); });
const stderr = readableStreamFromReader(proc.stderr); const stderr = readableStreamFromReader(proc.stderr);
const dec = new TextDecoder(); const dec = new TextDecoder();
for await(let bytes of stderr) { for await (let bytes of stderr) {
let msg = dec.decode(bytes); let msg = dec.decode(bytes);
if(msg.includes(`Server running`)) { if (msg.includes(`Server running`)) {
break; break;
} }
} }