EDU-13262: Mapping errors from Contentful scripts #127
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR updates the following (key changes):
index.js
exportsdeleteMarkdownFiles
getEntries
replaceQuotes
fixCallouts
updateAllImages
Improved error logging
logScriptStatus
function to log script execution statuses (success or failure) with detailed error messages in thescript-errors.md
file. This file will be created once you run the first script.File deletion logic
deleteMarkdownFiles
function to recursively delete all files and folders in thedocs
directory while logging any errors encountered.Dynamic markdown file creation
createMarkdownFile
function generates.md
files for various content types based on their locale and metadata.How to Test Locally
Follow these steps to test the changes locally:
1 Clone this repository
2. Checkout to the branch
EDU-13262-mapping-scripts
.3. Open a terminal and make sure you are in the following directory:
help-center-content/index.js
.4. Now run individual functions to test each one:
- Step 1: Delete markdown files:
bash node -e "require('./index').deleteMarkdownFiles('./docs')"
node -e "require('./index').getEntries()"
node -e "require('./index').replaceQuotes()"
node -e "require('./index').fixCallouts()"
node -e "require('./index').updateAllImages()"
script-errors.md
file for any logged errors during execution.PS.:
script-errors.md
may not be entirely accurate. For example, the image below shows an error during the deletion of markdown files, but all files in thedocs
folder were still deleted despite the errors. Maybe the script retried deletion after the files were already removed?