Open jamesdbruner opened 2 years ago
I don't have access to the repo or I'd have put in a PR to fix the issue but this is what I was thinking...
const getSiteName = async () => {
return fsPromises.readFile('pom.xml').then(
(data) => {
return xml2js
.parseStringPromise(data)
.then((obj) => obj.project.parent[0].artifactId[0])
},
(err) => {
log(
`Could not find ${err.path}... you will have to manually enter the policy path.`
)
return false
}
)
}
const hasSiteName = (siteName, val) => {
if (Boolean(siteName) === false && val.length < 1) return '/content/<your-site>/'
return val
}
and then this below
{
type: 'text',
name: 'homePage',
message: 'What is the path to the home page of your site?',
initial: '/us/en',
format: async (val) => {
return getSiteName().then(
(siteName) => hasSiteName(siteName, val)
)
}
},
When running
npx @hoodoo/acme init
and generating aacme.settings.json
file, the user is prompted for their home page and the user inputs/content/my-brand/
they end up withWhich is obviously incorrect. The init script assumes we're inside of an AEM project but that may not always be the case.