mirror of
https://github.com/actions/configure-pages.git
synced 2025-12-08 16:16:09 +00:00
Dereference as 'path'
This minimizes the changes to the codebase, as well as slightly clarifying that its value may not remain the same as the 'pathname'
This commit is contained in:
@@ -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,
|
// 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
|
// optional configuration file path, and a Pages siteUrl value to inject
|
||||||
function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl }) {
|
function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl }) {
|
||||||
let { pathname, origin } = siteUrl
|
let { pathname: path, origin } = siteUrl
|
||||||
|
|
||||||
switch (staticSiteGenerator) {
|
switch (staticSiteGenerator) {
|
||||||
case 'nuxt':
|
case 'nuxt':
|
||||||
@@ -14,7 +14,7 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit
|
|||||||
blankConfigurationFile: `${__dirname}/blank-configurations/nuxt.js`,
|
blankConfigurationFile: `${__dirname}/blank-configurations/nuxt.js`,
|
||||||
properties: {
|
properties: {
|
||||||
// Configure a base path on the router
|
// Configure a base path on the router
|
||||||
'router.base': pathname,
|
'router.base': path,
|
||||||
|
|
||||||
// Set the target to static too
|
// Set the target to static too
|
||||||
// https://nuxtjs.org/docs/configuration-glossary/configuration-target/
|
// https://nuxtjs.org/docs/configuration-glossary/configuration-target/
|
||||||
@@ -23,14 +23,14 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit
|
|||||||
}
|
}
|
||||||
case 'next':
|
case 'next':
|
||||||
// Next does not want a trailing slash
|
// Next does not want a trailing slash
|
||||||
pathname = removeTrailingSlash(pathname)
|
path = removeTrailingSlash(path)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
configurationFile: generatorConfigFile || './next.config.js',
|
configurationFile: generatorConfigFile || './next.config.js',
|
||||||
blankConfigurationFile: `${__dirname}/blank-configurations/next.js`,
|
blankConfigurationFile: `${__dirname}/blank-configurations/next.js`,
|
||||||
properties: {
|
properties: {
|
||||||
// Configure a base path
|
// Configure a base path
|
||||||
basePath: pathname,
|
basePath: path,
|
||||||
|
|
||||||
// Disable server side image optimization too
|
// Disable server side image optimization too
|
||||||
// https://nextjs.org/docs/api-reference/next/image#unoptimized
|
// https://nextjs.org/docs/api-reference/next/image#unoptimized
|
||||||
@@ -43,21 +43,21 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit
|
|||||||
blankConfigurationFile: `${__dirname}/blank-configurations/gatsby.js`,
|
blankConfigurationFile: `${__dirname}/blank-configurations/gatsby.js`,
|
||||||
properties: {
|
properties: {
|
||||||
// Configure a path prefix
|
// Configure a path prefix
|
||||||
pathPrefix: pathname,
|
pathPrefix: path,
|
||||||
// Configure a site url
|
// Configure a site url
|
||||||
'siteMetadata.siteUrl': origin
|
'siteMetadata.siteUrl': origin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case 'sveltekit':
|
case 'sveltekit':
|
||||||
// SvelteKit does not want a trailing slash
|
// SvelteKit does not want a trailing slash
|
||||||
pathname = removeTrailingSlash(pathname)
|
path = removeTrailingSlash(path)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
configurationFile: generatorConfigFile || './svelte.config.js',
|
configurationFile: generatorConfigFile || './svelte.config.js',
|
||||||
blankConfigurationFile: `${__dirname}/blank-configurations/sveltekit.js`,
|
blankConfigurationFile: `${__dirname}/blank-configurations/sveltekit.js`,
|
||||||
properties: {
|
properties: {
|
||||||
// Configure a base path
|
// Configure a base path
|
||||||
'kit.paths.base': pathname,
|
'kit.paths.base': path,
|
||||||
// Configure a prerender origin
|
// Configure a prerender origin
|
||||||
'kit.prerender.origin': origin
|
'kit.prerender.origin': origin
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user