Update dist

This commit is contained in:
Yoann Chaudet
2022-07-19 11:50:09 -07:00
parent ba4576e776
commit 8f29fe2748
3 changed files with 23 additions and 43 deletions

47
dist/index.js vendored
View File

@@ -63059,7 +63059,8 @@ class ConfigParser {
}
}
parse() {
// Parse a configuration file and try to inject Pages settings in it.
inject() {
// Logging
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
core.info(`Parsing configuration:\n${this.configuration}`)
core.info(`Writing new configuration:\n${this.configuration}`)
// Finally write the new configuration in the file
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()
for (const variable in requiredVars) {
if (requiredVars[variable] === undefined) {
@@ -63210,6 +63197,8 @@ module.exports = function getContext() {
return requiredVars
}
module.exports = {getContext}
/***/ }),
@@ -63302,39 +63291,45 @@ module.exports = getPagesBaseUrl
const core = __nccwpck_require__(2186)
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) {
case 'nuxt':
return {
configurationFile: './nuxt.config.js',
propertyName: 'router.base',
propertyValue: path,
blankConfigurationFile: `${process.cwd()}/blank-configurations/nuxt.js`
blankConfigurationFile: __nccwpck_require__.ab + "nuxt.js"
}
case 'next':
return {
configurationFile: './next.config.js',
propertyName: 'basePath',
propertyValue: path,
blankConfigurationFile: `${process.cwd()}/blank-configurations/next.js`
blankConfigurationFile: __nccwpck_require__.ab + "next.js"
}
case 'gatsby':
return {
configurationFile: './gatsby-config.js',
propertyName: 'pathPrefix',
propertyValue: path,
blankConfigurationFile: `${process.cwd()}/blank-configurations/gatsby.js`
blankConfigurationFile: __nccwpck_require__.ab + "gatsby.js"
}
default:
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 {
// Parse/mutate the configuration file
new ConfigParser(getParserConfiguration(staticSiteGenerator, path)).parse()
// Parse the configuration file and try to inject the Pages configuration in it
new ConfigParser(
getConfigParserSettings(staticSiteGenerator, path)
).inject()
} catch (error) {
// Logging
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.`,
error
@@ -63342,7 +63337,7 @@ async function setPagesPath({staticSiteGenerator, path}) {
}
}
module.exports = setPagesPath
module.exports = {getConfigParserSettings, setPagesPath}
/***/ }),

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@@ -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
core.info(`Parsing configuration:\n${this.configuration}`)
core.info(`Writing new configuration:\n${this.configuration}`)
// Finally write the new configuration in the file
fs.writeFileSync(this.configurationFile, this.configuration, {