Two critical bugs have been identified in buildScripts/copySeoFiles.mjs that prevent the correct copying of SEO files (robots.txt, llm.txt, sitemap.xml) to application build directories.
Identified Bugs:
Incorrect dist path construction:
- The script currently constructs target
dist paths like dist/<env>/<app-name>.
- This is incorrect for the Neo.mjs project structure, which requires an
apps segment: dist/<env>/apps/<app-name>.
- This leads to warnings such as
Warning: Target directory .../dist/production/portal does not exist. Skipping SEO file copy. because the expected directory structure is not being targeted.
Incomplete handling of nested application paths:
- When dealing with nested applications (e.g.,
apps/sharedcovid/childapps/sharedcovidmap), the script incorrectly derives the application name using path.basename(appRootPath). This results in sharedcovidmap instead of the full relative path sharedcovid/childapps/sharedcovidmap.
- Consequently, the
dist path construction fails for these nested apps, leading to similar "Target directory does not exist" warnings.
Omission of esm environment:
- The
copySeoFilesForApp function currently only considers development and production environments for copying SEO files.
- The
esm build output is not included, meaning SEO files are not deployed for esm builds when the --env all or --env esm options are used.
Impact:
These bugs prevent SEO files from being correctly deployed to application dist folders, which can negatively impact search engine discoverability and AI model consumption for deployed applications.
Proposed Fixes:
Refactor findAppRoots:
- Modify
findAppRoots to return an object containing both the absolute appRootPath and the appRelativePath (the path relative to the apps/ directory).
Refactor copySeoFilesForApp:
- Update
copySeoFilesForApp to accept and utilize the appRelativePath.
- Construct the
targetDistDir using path.join(DIST_DIR, targetEnv, 'apps', appRelativePath) to correctly include the apps segment and handle nested paths.
- Modify the
targetEnvs array population logic to include 'esm' when the build environment (env) is 'all' or 'esm'.
Acceptance Criteria:
- SEO files are correctly copied to
dist/<env>/apps/<app-name> for all identified applications, including nested ones.
- SEO files are copied for
development, production, and esm environments as appropriate based on the --env parameter.
- No "Target directory does not exist" warnings related to SEO file copying are observed for valid application
dist paths.
Two critical bugs have been identified in
buildScripts/copySeoFiles.mjsthat prevent the correct copying of SEO files (robots.txt,llm.txt,sitemap.xml) to application build directories.Identified Bugs:
Incorrect
distpath construction:distpaths likedist/<env>/<app-name>.appssegment:dist/<env>/apps/<app-name>.Warning: Target directory .../dist/production/portal does not exist. Skipping SEO file copy.because the expected directory structure is not being targeted.Incomplete handling of nested application paths:
apps/sharedcovid/childapps/sharedcovidmap), the script incorrectly derives the application name usingpath.basename(appRootPath). This results insharedcovidmapinstead of the full relative pathsharedcovid/childapps/sharedcovidmap.distpath construction fails for these nested apps, leading to similar "Target directory does not exist" warnings.Omission of
esmenvironment:copySeoFilesForAppfunction currently only considersdevelopmentandproductionenvironments for copying SEO files.esmbuild output is not included, meaning SEO files are not deployed foresmbuilds when the--env allor--env esmoptions are used.Impact:
These bugs prevent SEO files from being correctly deployed to application
distfolders, which can negatively impact search engine discoverability and AI model consumption for deployed applications.Proposed Fixes:
Refactor
findAppRoots:findAppRootsto return an object containing both the absoluteappRootPathand theappRelativePath(the path relative to theapps/directory).Refactor
copySeoFilesForApp:copySeoFilesForAppto accept and utilize theappRelativePath.targetDistDirusingpath.join(DIST_DIR, targetEnv, 'apps', appRelativePath)to correctly include theappssegment and handle nested paths.targetEnvsarray population logic to include'esm'when the build environment (env) is'all'or'esm'.Acceptance Criteria:
dist/<env>/apps/<app-name>for all identified applications, including nested ones.development,production, andesmenvironments as appropriate based on the--envparameter.distpaths.