mirror of
https://github.com/actions/configure-pages.git
synced 2026-04-03 16:22:24 +00:00
Merge pull request #43 from actions/warn-unsupported-exts
Warn about unsupported file extensions after erring
This commit is contained in:
13
dist/index.js
vendored
13
dist/index.js
vendored
@@ -15772,6 +15772,8 @@ const core = __nccwpck_require__(2186)
|
|||||||
const { ConfigParser } = __nccwpck_require__(8395)
|
const { ConfigParser } = __nccwpck_require__(8395)
|
||||||
const removeTrailingSlash = __nccwpck_require__(9255)
|
const removeTrailingSlash = __nccwpck_require__(9255)
|
||||||
|
|
||||||
|
const SUPPORTED_FILE_EXTENSIONS = ['.js', '.cjs', '.mjs']
|
||||||
|
|
||||||
// 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 }) {
|
||||||
@@ -15846,13 +15848,24 @@ function setPagesConfig({ staticSiteGenerator, generatorConfigFile, siteUrl }) {
|
|||||||
const settings = getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl })
|
const settings = getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl })
|
||||||
new ConfigParser(settings).injectAll()
|
new ConfigParser(settings).injectAll()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
const isSupportedFileExtension = SUPPORTED_FILE_EXTENSIONS.some(ext => generatorConfigFile.endsWith(ext))
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
|
if (!isSupportedFileExtension) {
|
||||||
|
core.warning(
|
||||||
|
`Unsupported configuration file extension. Currently supported extensions: ${SUPPORTED_FILE_EXTENSIONS.map(
|
||||||
|
ext => JSON.stringify(ext)
|
||||||
|
).join(', ')}`,
|
||||||
|
error
|
||||||
|
)
|
||||||
|
} else {
|
||||||
core.warning(
|
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.`,
|
`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
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = { getConfigParserSettings, setPagesConfig }
|
module.exports = { getConfigParserSettings, setPagesConfig }
|
||||||
|
|
||||||
|
|||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -2,6 +2,8 @@ const core = require('@actions/core')
|
|||||||
const { ConfigParser } = require('./config-parser')
|
const { ConfigParser } = require('./config-parser')
|
||||||
const removeTrailingSlash = require('./remove-trailing-slash')
|
const removeTrailingSlash = require('./remove-trailing-slash')
|
||||||
|
|
||||||
|
const SUPPORTED_FILE_EXTENSIONS = ['.js', '.cjs', '.mjs']
|
||||||
|
|
||||||
// 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 }) {
|
||||||
@@ -76,12 +78,23 @@ function setPagesConfig({ staticSiteGenerator, generatorConfigFile, siteUrl }) {
|
|||||||
const settings = getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl })
|
const settings = getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl })
|
||||||
new ConfigParser(settings).injectAll()
|
new ConfigParser(settings).injectAll()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
const isSupportedFileExtension = SUPPORTED_FILE_EXTENSIONS.some(ext => generatorConfigFile.endsWith(ext))
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
|
if (!isSupportedFileExtension) {
|
||||||
|
core.warning(
|
||||||
|
`Unsupported configuration file extension. Currently supported extensions: ${SUPPORTED_FILE_EXTENSIONS.map(
|
||||||
|
ext => JSON.stringify(ext)
|
||||||
|
).join(', ')}`,
|
||||||
|
error
|
||||||
|
)
|
||||||
|
} else {
|
||||||
core.warning(
|
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.`,
|
`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
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = { getConfigParserSettings, setPagesConfig }
|
module.exports = { getConfigParserSettings, setPagesConfig }
|
||||||
|
|||||||
Reference in New Issue
Block a user