Skip to content

Commit

Permalink
Dereference as 'path'
Browse files Browse the repository at this point in the history
This minimizes the changes to the codebase, as well as slightly clarifying that its value may not remain the same as the 'pathname'
  • Loading branch information
James M. Greene authored and James M. Greene committed Sep 11, 2022
1 parent 2745795 commit 35c001d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/set-pages-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const removeTrailingSlash = require('./remove-trailing-slash')
// Return the settings to be passed to a {ConfigParser} for a given static site generator,
// optional configuration file path, and a Pages siteUrl value to inject
function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl }) {
let { pathname, origin } = siteUrl
let { pathname: path, origin } = siteUrl

switch (staticSiteGenerator) {
case 'nuxt':
Expand All @@ -14,7 +14,7 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit
blankConfigurationFile: `${__dirname}/blank-configurations/nuxt.js`,
properties: {
// Configure a base path on the router
'router.base': pathname,
'router.base': path,

// Set the target to static too
// https://nuxtjs.org/docs/configuration-glossary/configuration-target/
Expand All @@ -23,14 +23,14 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit
}
case 'next':
// Next does not want a trailing slash
pathname = removeTrailingSlash(pathname)
path = removeTrailingSlash(path)

return {
configurationFile: generatorConfigFile || './next.config.js',
blankConfigurationFile: `${__dirname}/blank-configurations/next.js`,
properties: {
// Configure a base path
basePath: pathname,
basePath: path,

// Disable server side image optimization too
// https://nextjs.org/docs/api-reference/next/image#unoptimized
Expand All @@ -43,21 +43,21 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit
blankConfigurationFile: `${__dirname}/blank-configurations/gatsby.js`,
properties: {
// Configure a path prefix
pathPrefix: pathname,
pathPrefix: path,
// Configure a site url
'siteMetadata.siteUrl': origin
}
}
case 'sveltekit':
// SvelteKit does not want a trailing slash
pathname = removeTrailingSlash(pathname)
path = removeTrailingSlash(path)

return {
configurationFile: generatorConfigFile || './svelte.config.js',
blankConfigurationFile: `${__dirname}/blank-configurations/sveltekit.js`,
properties: {
// Configure a base path
'kit.paths.base': pathname,
'kit.paths.base': path,
// Configure a prerender origin
'kit.prerender.origin': origin
}
Expand Down

0 comments on commit 35c001d

Please sign in to comment.