mirror of
https://github.com/actions/configure-pages.git
synced 2026-03-30 01:54:51 +00:00
Update dist
This commit is contained in:
47
dist/index.js
vendored
47
dist/index.js
vendored
@@ -63059,7 +63059,8 @@ class ConfigParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parse() {
|
// Parse a configuration file and try to inject Pages settings in it.
|
||||||
|
inject() {
|
||||||
// Logging
|
// Logging
|
||||||
core.info(`Parsing configuration:\n${this.configuration}`)
|
core.info(`Parsing configuration:\n${this.configuration}`)
|
||||||
|
|
||||||
@@ -63155,23 +63156,8 @@ class ConfigParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format the updated configuration with prettier's default settings
|
|
||||||
this.configuration = prettier.format(this.configuration, {
|
|
||||||
parser: 'espree',
|
|
||||||
|
|
||||||
// Matching this repo's prettier configuration
|
|
||||||
printWidth: 80,
|
|
||||||
tabWidth: 2,
|
|
||||||
useTabs: false,
|
|
||||||
semi: false,
|
|
||||||
singleQuote: true,
|
|
||||||
trailingComma: 'none',
|
|
||||||
bracketSpacing: false,
|
|
||||||
arrowParens: 'avoid'
|
|
||||||
})
|
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
core.info(`Parsing configuration:\n${this.configuration}`)
|
core.info(`Writing new configuration:\n${this.configuration}`)
|
||||||
|
|
||||||
// Finally write the new configuration in the file
|
// Finally write the new configuration in the file
|
||||||
fs.writeFileSync(this.configurationFile, this.configuration, {
|
fs.writeFileSync(this.configurationFile, this.configuration, {
|
||||||
@@ -63199,7 +63185,8 @@ function getRequiredVars() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = function getContext() {
|
// Return the context object
|
||||||
|
function getContext() {
|
||||||
const requiredVars = getRequiredVars()
|
const requiredVars = getRequiredVars()
|
||||||
for (const variable in requiredVars) {
|
for (const variable in requiredVars) {
|
||||||
if (requiredVars[variable] === undefined) {
|
if (requiredVars[variable] === undefined) {
|
||||||
@@ -63210,6 +63197,8 @@ module.exports = function getContext() {
|
|||||||
return requiredVars
|
return requiredVars
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports = {getContext}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
@@ -63302,39 +63291,45 @@ module.exports = getPagesBaseUrl
|
|||||||
const core = __nccwpck_require__(2186)
|
const core = __nccwpck_require__(2186)
|
||||||
const {ConfigParser} = __nccwpck_require__(8395)
|
const {ConfigParser} = __nccwpck_require__(8395)
|
||||||
|
|
||||||
function getParserConfiguration(staticSiteGenerator, path) {
|
// Return the settings to be passed to a {ConfigParser} for a given
|
||||||
|
// static site generator and a Pages path value to inject
|
||||||
|
function getConfigParserSettings(staticSiteGenerator, path) {
|
||||||
switch (staticSiteGenerator) {
|
switch (staticSiteGenerator) {
|
||||||
case 'nuxt':
|
case 'nuxt':
|
||||||
return {
|
return {
|
||||||
configurationFile: './nuxt.config.js',
|
configurationFile: './nuxt.config.js',
|
||||||
propertyName: 'router.base',
|
propertyName: 'router.base',
|
||||||
propertyValue: path,
|
propertyValue: path,
|
||||||
blankConfigurationFile: `${process.cwd()}/blank-configurations/nuxt.js`
|
blankConfigurationFile: __nccwpck_require__.ab + "nuxt.js"
|
||||||
}
|
}
|
||||||
case 'next':
|
case 'next':
|
||||||
return {
|
return {
|
||||||
configurationFile: './next.config.js',
|
configurationFile: './next.config.js',
|
||||||
propertyName: 'basePath',
|
propertyName: 'basePath',
|
||||||
propertyValue: path,
|
propertyValue: path,
|
||||||
blankConfigurationFile: `${process.cwd()}/blank-configurations/next.js`
|
blankConfigurationFile: __nccwpck_require__.ab + "next.js"
|
||||||
}
|
}
|
||||||
case 'gatsby':
|
case 'gatsby':
|
||||||
return {
|
return {
|
||||||
configurationFile: './gatsby-config.js',
|
configurationFile: './gatsby-config.js',
|
||||||
propertyName: 'pathPrefix',
|
propertyName: 'pathPrefix',
|
||||||
propertyValue: path,
|
propertyValue: path,
|
||||||
blankConfigurationFile: `${process.cwd()}/blank-configurations/gatsby.js`
|
blankConfigurationFile: __nccwpck_require__.ab + "gatsby.js"
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
throw `Unsupported static site generator: ${staticSiteGenerator}`
|
throw `Unsupported static site generator: ${staticSiteGenerator}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setPagesPath({staticSiteGenerator, path}) {
|
// Inject Pages configuration in a given static site generator's configuration file
|
||||||
|
function setPagesPath({staticSiteGenerator, path}) {
|
||||||
try {
|
try {
|
||||||
// Parse/mutate the configuration file
|
// Parse the configuration file and try to inject the Pages configuration in it
|
||||||
new ConfigParser(getParserConfiguration(staticSiteGenerator, path)).parse()
|
new ConfigParser(
|
||||||
|
getConfigParserSettings(staticSiteGenerator, path)
|
||||||
|
).inject()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
// Logging
|
||||||
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 ${path}. 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 ${path}. Please ensure your framework is configured to generate relative links appropriately.`,
|
||||||
error
|
error
|
||||||
@@ -63342,7 +63337,7 @@ async function setPagesPath({staticSiteGenerator, path}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = setPagesPath
|
module.exports = {getConfigParserSettings, setPagesPath}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -255,23 +255,8 @@ class ConfigParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format the updated configuration with prettier's default settings
|
|
||||||
this.configuration = prettier.format(this.configuration, {
|
|
||||||
parser: 'espree',
|
|
||||||
|
|
||||||
// Matching this repo's prettier configuration
|
|
||||||
printWidth: 80,
|
|
||||||
tabWidth: 2,
|
|
||||||
useTabs: false,
|
|
||||||
semi: false,
|
|
||||||
singleQuote: true,
|
|
||||||
trailingComma: 'none',
|
|
||||||
bracketSpacing: false,
|
|
||||||
arrowParens: 'avoid'
|
|
||||||
})
|
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
core.info(`Parsing configuration:\n${this.configuration}`)
|
core.info(`Writing new configuration:\n${this.configuration}`)
|
||||||
|
|
||||||
// Finally write the new configuration in the file
|
// Finally write the new configuration in the file
|
||||||
fs.writeFileSync(this.configurationFile, this.configuration, {
|
fs.writeFileSync(this.configurationFile, this.configuration, {
|
||||||
|
|||||||
Reference in New Issue
Block a user