Update distributables

This commit is contained in:
James M. Greene
2022-08-05 17:47:09 -05:00
parent 4f27d51853
commit 68595d0746
2 changed files with 36 additions and 17 deletions

51
dist/index.js vendored
View File

@@ -14584,14 +14584,32 @@ class ConfigParser {
// Return the configuration object or null. // Return the configuration object or null.
findConfigurationObject(ast) { findConfigurationObject(ast) {
// Try to find a default export // Try to find a default export
var defaultExport = ast.body.find( var defaultExport = ast.body.find(node => node.type === 'ExportDefaultDeclaration')
node => node.type === 'ExportDefaultDeclaration' && node.declaration.type === 'ObjectExpression'
) // Direct default export
if (defaultExport) { if (defaultExport && defaultExport.declaration.type === 'ObjectExpression') {
core.info('Found configuration object in default export declaration') core.info('Found configuration object in direct default export declaration')
return defaultExport.declaration return defaultExport.declaration
} }
// Indirect default export
else if (defaultExport && defaultExport.declaration.type === 'Identifier') {
const identifierName = defaultExport && defaultExport.declaration.name
const identifierDefinition = ast.body.find(
node =>
node.type === 'VariableDeclaration' &&
node.declarations.length == 1 &&
node.declarations[0].type === 'VariableDeclarator' &&
node.declarations[0].id.type === 'Identifier' &&
node.declarations[0].id.name === identifierName &&
node.declarations[0].init.type === 'ObjectExpression'
)
if (identifierDefinition) {
core.info('Found configuration object in indirect default export declaration')
return identifierDefinition.declarations[0].init
}
}
// Try to find a module export // Try to find a module export
var moduleExport = ast.body.find( var moduleExport = ast.body.find(
node => node =>
@@ -14699,7 +14717,7 @@ class ConfigParser {
var depth = 0 var depth = 0
const properties = propertyName.split('.') const properties = propertyName.split('.')
var lastNode = configurationObject var lastNode = configurationObject
while (1) { while (true) {
// Find the node for the current property // Find the node for the current property
var propertyNode = this.findProperty(lastNode, properties[depth]) var propertyNode = this.findProperty(lastNode, properties[depth])
@@ -14801,6 +14819,7 @@ function getRequiredVars() {
repositoryNwo: process.env.GITHUB_REPOSITORY, repositoryNwo: process.env.GITHUB_REPOSITORY,
githubToken: core.getInput('token'), githubToken: core.getInput('token'),
staticSiteGenerator: core.getInput('static_site_generator'), staticSiteGenerator: core.getInput('static_site_generator'),
generatorConfigFile: core.getInput('generator_config_file'),
enablement: core.getInput('enablement') !== 'false' enablement: core.getInput('enablement') !== 'false'
} }
} }
@@ -14845,13 +14864,13 @@ module.exports = outputPagesBaseUrl
const core = __nccwpck_require__(2186) const core = __nccwpck_require__(2186)
const { ConfigParser } = __nccwpck_require__(8395) const { ConfigParser } = __nccwpck_require__(8395)
// Return the settings to be passed to a {ConfigParser} for a given // Return the settings to be passed to a {ConfigParser} for a given static site generator,
// static site generator and a Pages path value to inject // optional configuration file path, and a Pages path value to inject
function getConfigParserSettings(staticSiteGenerator, path) { function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, path }) {
switch (staticSiteGenerator) { switch (staticSiteGenerator) {
case 'nuxt': case 'nuxt':
return { return {
configurationFile: './nuxt.config.js', configurationFile: generatorConfigFile || './nuxt.config.js',
blankConfigurationFile: __nccwpck_require__.ab + "nuxt.js", blankConfigurationFile: __nccwpck_require__.ab + "nuxt.js",
properties: { properties: {
// Configure a base path on the router // Configure a base path on the router
@@ -14869,7 +14888,7 @@ function getConfigParserSettings(staticSiteGenerator, path) {
} }
return { return {
configurationFile: './next.config.js', configurationFile: generatorConfigFile || './next.config.js',
blankConfigurationFile: __nccwpck_require__.ab + "next.js", blankConfigurationFile: __nccwpck_require__.ab + "next.js",
properties: { properties: {
// Configure a base path // Configure a base path
@@ -14882,7 +14901,7 @@ function getConfigParserSettings(staticSiteGenerator, path) {
} }
case 'gatsby': case 'gatsby':
return { return {
configurationFile: './gatsby-config.js', configurationFile: generatorConfigFile || './gatsby-config.js',
blankConfigurationFile: __nccwpck_require__.ab + "gatsby.js", blankConfigurationFile: __nccwpck_require__.ab + "gatsby.js",
properties: { properties: {
// Configure a path prefix // Configure a path prefix
@@ -14895,10 +14914,10 @@ function getConfigParserSettings(staticSiteGenerator, path) {
} }
// Inject Pages configuration in a given static site generator's configuration file // Inject Pages configuration in a given static site generator's configuration file
function setPagesPath({ staticSiteGenerator, path }) { function setPagesPath({ staticSiteGenerator, generatorConfigFile, path }) {
try { try {
// Parse the configuration file and try to inject the Pages configuration in it // Parse the configuration file and try to inject the Pages configuration in it
const settings = getConfigParserSettings(staticSiteGenerator, path) const settings = getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, path })
new ConfigParser(settings).injectAll() new ConfigParser(settings).injectAll()
} catch (error) { } catch (error) {
// Logging // Logging
@@ -16401,13 +16420,13 @@ const outputPagesBaseUrl = __nccwpck_require__(7527)
async function main() { async function main() {
try { try {
const { repositoryNwo, githubToken, enablement, staticSiteGenerator } = getContext() const { repositoryNwo, githubToken, enablement, staticSiteGenerato, generatorConfigFile } = getContext()
const pageObject = await findOrCreatePagesSite({ repositoryNwo, githubToken, enablement }) const pageObject = await findOrCreatePagesSite({ repositoryNwo, githubToken, enablement })
const siteUrl = new URL(pageObject.html_url) const siteUrl = new URL(pageObject.html_url)
if (staticSiteGenerator) { if (staticSiteGenerator) {
setPagesPath({ staticSiteGenerator, path: siteUrl.pathname }) setPagesPath({ staticSiteGenerator, generatorConfigFile, path: siteUrl.pathname })
} }
outputPagesBaseUrl(siteUrl) outputPagesBaseUrl(siteUrl)
} catch (error) { } catch (error) {

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long