Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp authored and github-actions[bot] committed Apr 21, 2022
1 parent 637919c commit c4203ce
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
7 changes: 4 additions & 3 deletions packages/astro/src/core/build/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,10 @@ async function generatePath(

// If a base path was provided, append it to the site URL. This ensures that
// all injected scripts and links are referenced relative to the site and subpath.
const site = astroConfig.base && astroConfig.base !== './'
? joinPaths(astroConfig.site?.toString() || 'http://localhost/', astroConfig.base)
: astroConfig.site;
const site =
astroConfig.base && astroConfig.base !== './'
? joinPaths(astroConfig.site?.toString() || 'http://localhost/', astroConfig.base)
: astroConfig.site;
const links = createLinkStylesheetElementSet(linkIds.reverse(), site);
const scripts = createModuleScriptElementWithSrcSet(hoistedId ? [hoistedId] : [], site);

Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ function isString(path: unknown): path is string {

export function joinPaths(...paths: (string | undefined)[]) {
return paths.filter(isString).map(trimSlashes).join('/');
}
}
11 changes: 6 additions & 5 deletions packages/astro/src/vite-plugin-astro-server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,12 @@ async function handle404Response(
html = subpathNotUsedTemplate(devRoot, pathname);
} else {
// HACK: redirect without the base path for assets in publicDir
const redirectTo =
req.method === 'GET'
&& config.base && config.base !== './'
&& pathname.startsWith(config.base)
&& pathname.replace(config.base, '/');
const redirectTo =
req.method === 'GET' &&
config.base &&
config.base !== './' &&
pathname.startsWith(config.base) &&
pathname.replace(config.base, '/');

if (redirectTo && redirectTo !== '/') {
const response = new Response(null, {
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/test/static-build.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function addLeadingSlash(path) {

function removeBasePath(path) {
// `/subpath` is defined in the test fixture's Astro config
return path.replace('/subpath', '')
return path.replace('/subpath', '');
}

/**
Expand Down

0 comments on commit c4203ce

Please sign in to comment.