mirror of
https://github.com/actions/configure-pages.git
synced 2025-12-08 08:06:09 +00:00
Update distributables
This commit is contained in:
48
dist/index.js
vendored
48
dist/index.js
vendored
@@ -36719,6 +36719,7 @@ module.exports = function removeTrailingSlash(str) {
|
||||
/***/ 6310:
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
const fs = __nccwpck_require__(7147)
|
||||
const core = __nccwpck_require__(2186)
|
||||
const { ConfigParser } = __nccwpck_require__(8395)
|
||||
const removeTrailingSlash = __nccwpck_require__(9255)
|
||||
@@ -36726,6 +36727,17 @@ const { convertErrorToAnnotationProperties } = __nccwpck_require__(1507)
|
||||
|
||||
const SUPPORTED_FILE_EXTENSIONS = ['.js', '.cjs', '.mjs']
|
||||
|
||||
function detectOrDefaultConfigFile(fileBaseName, defaultExt = '.js') {
|
||||
for (const ext of SUPPORTED_FILE_EXTENSIONS) {
|
||||
const potentialConfigFile = `./${fileBaseName}${ext}`
|
||||
if (fs.existsSync(potentialConfigFile)) {
|
||||
return potentialConfigFile
|
||||
}
|
||||
}
|
||||
// If none of them exist yet, default to returning the filename with the defaultExt extension
|
||||
return `./${fileBaseName}${defaultExt}`
|
||||
}
|
||||
|
||||
// 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 }) {
|
||||
@@ -36734,7 +36746,7 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit
|
||||
switch (staticSiteGenerator) {
|
||||
case 'nuxt':
|
||||
return {
|
||||
configurationFile: generatorConfigFile || './nuxt.config.js',
|
||||
configurationFile: generatorConfigFile || detectOrDefaultConfigFile('nuxt.config'),
|
||||
blankConfigurationFile: __nccwpck_require__.ab + "nuxt.js",
|
||||
properties: {
|
||||
// Configure a base path on the router
|
||||
@@ -36750,7 +36762,7 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit
|
||||
path = removeTrailingSlash(path)
|
||||
|
||||
return {
|
||||
configurationFile: generatorConfigFile || './next.config.js',
|
||||
configurationFile: generatorConfigFile || detectOrDefaultConfigFile('next.config'),
|
||||
blankConfigurationFile: __nccwpck_require__.ab + "next.js",
|
||||
properties: {
|
||||
// Static export
|
||||
@@ -36768,7 +36780,7 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit
|
||||
}
|
||||
case 'gatsby':
|
||||
return {
|
||||
configurationFile: generatorConfigFile || './gatsby-config.js',
|
||||
configurationFile: generatorConfigFile || detectOrDefaultConfigFile('gatsby-config'),
|
||||
blankConfigurationFile: __nccwpck_require__.ab + "gatsby.js",
|
||||
properties: {
|
||||
// Configure a path prefix
|
||||
@@ -36782,7 +36794,7 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit
|
||||
path = removeTrailingSlash(path)
|
||||
|
||||
return {
|
||||
configurationFile: generatorConfigFile || './svelte.config.js',
|
||||
configurationFile: generatorConfigFile || detectOrDefaultConfigFile('svelte.config'),
|
||||
blankConfigurationFile: __nccwpck_require__.ab + "sveltekit.js",
|
||||
properties: {
|
||||
// Configure a base path
|
||||
@@ -36798,27 +36810,23 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit
|
||||
|
||||
// Inject Pages configuration in a given static site generator's configuration file
|
||||
function setPagesConfig({ staticSiteGenerator, generatorConfigFile, siteUrl }) {
|
||||
const isSupportedFileExtension = SUPPORTED_FILE_EXTENSIONS.some(ext => generatorConfigFile.endsWith(ext))
|
||||
if (generatorConfigFile && !isSupportedFileExtension) {
|
||||
const supportedExtensionList = SUPPORTED_FILE_EXTENSIONS.map(ext => JSON.stringify(ext)).join(', ')
|
||||
core.warning(
|
||||
`Unsupported extension in configuration file: ${generatorConfigFile}. Currently supported extensions: ${supportedExtensionList}. We will still attempt to inject the site metadata into the configuration file, but it may not work as expected.`
|
||||
)
|
||||
}
|
||||
|
||||
try {
|
||||
// Parse the configuration file and try to inject the Pages configuration in it
|
||||
const settings = getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl })
|
||||
new ConfigParser(settings).injectAll()
|
||||
} catch (error) {
|
||||
const isSupportedFileExtension = SUPPORTED_FILE_EXTENSIONS.some(ext => generatorConfigFile.endsWith(ext))
|
||||
|
||||
// Logging
|
||||
if (!isSupportedFileExtension) {
|
||||
core.warning(
|
||||
`Unsupported configuration file extension. Currently supported extensions: ${SUPPORTED_FILE_EXTENSIONS.map(
|
||||
ext => JSON.stringify(ext)
|
||||
).join(', ')}. Error: ${error.message}`,
|
||||
convertErrorToAnnotationProperties(error)
|
||||
)
|
||||
} else {
|
||||
core.warning(
|
||||
`We were unable to determine how to inject the site metadata into your config. Generated URLs may be incorrect. The base URL for this site should be ${siteUrl}. Please ensure your framework is configured to generate relative links appropriately. Error: ${error.message}`,
|
||||
convertErrorToAnnotationProperties(error)
|
||||
)
|
||||
}
|
||||
core.warning(
|
||||
`We were unable to determine how to inject the site metadata into your config. Generated URLs may be incorrect. The base URL for this site should be ${siteUrl}. Please ensure your framework is configured to generate relative links appropriately. Error: ${error.message}`,
|
||||
convertErrorToAnnotationProperties(error)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user