-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOP-5128 and DOP-5167 #34
Conversation
❌ Deploy Preview for redoc-ext-test failed. Why did it fail? →
|
✅ Deploy Preview for git-changed-file-extension canceled.
|
✅ Deploy Preview for persistence-module-ext canceled.
|
✅ Deploy Preview for populate-data-extension canceled.
|
❌ Deploy Preview for test-monorepo-redoc failed. Why did it fail? →
|
❌ Deploy Preview for site-links-display failed. Why did it fail? →
|
❌ Deploy Preview for search-manifest-integration failed. Why did it fail? →
|
✅ Deploy Preview for snooty-cache-extension canceled.
|
✅ Deploy Preview for offline-snooty ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
❌ Deploy Preview for search-manifest-extension failed. Why did it fail? →
|
extensions/offline-snooty/src/convertGatsbyToHtml/fileHandler.ts
Outdated
Show resolved
Hide resolved
Q: Should this be run for all builds, always, regardless of the environment the build is triggered in? Also, as is, I believe this extension will error in The rest of the comments I've left are just nits, but could you also add comments to the places where work will be done in future tickets? Thanks you! |
This is designed to run in dotcomstg (for testing) and dotcomprd for prod. I think we should clean up stg (aka mongodb-snooty) so that the folder structure on each job is the same, so we don't have to account for different directory structure for that specific env each time. Until then, we can disable this extension via env var in that context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Seung! Looks good, just a few more small comments
|
||
export const convertGatsbyToHtml = async (path: string): Promise<Gzip> => { | ||
return createGzip(); | ||
type fileUpdateLog = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: Can you capitalize the first letter of this type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
const { bucketName, fileName } = readEnvConfigs({ | ||
env: netlifyConfig.build.environment.ENV ?? '', | ||
docsetEntry: | ||
(netlifyConfig.build.environment | ||
.DOCSET_ENTRY as unknown as DocsetsDocument) ?? {}, | ||
repoEntry: | ||
(netlifyConfig.build.environment | ||
.REPO_ENTRY as unknown as ReposBranchesDocument) ?? {}, | ||
branchEntry: | ||
(netlifyConfig.build.environment | ||
.BRANCH_ENTRY as unknown as BranchEntry) ?? {}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: Instead of casting as unknown as ...
, we can provide a type for the environment
property so that we can cast as the type we want directly.
const { bucketName, fileName } = readEnvConfigs({ | |
env: netlifyConfig.build.environment.ENV ?? '', | |
docsetEntry: | |
(netlifyConfig.build.environment | |
.DOCSET_ENTRY as unknown as DocsetsDocument) ?? {}, | |
repoEntry: | |
(netlifyConfig.build.environment | |
.REPO_ENTRY as unknown as ReposBranchesDocument) ?? {}, | |
branchEntry: | |
(netlifyConfig.build.environment | |
.BRANCH_ENTRY as unknown as BranchEntry) ?? {}, | |
}); | |
const environment = netlifyConfig.build.environment as Record< | |
string, | |
string | DocsetsDocument | ReposBranchesDocument | BranchEntry | |
>; | |
const { bucketName, fileName } = readEnvConfigs({ | |
env: (environment.ENV as string) ?? '', | |
docsetEntry: (environment.DOCSET_ENTRY as DocsetsDocument) ?? {}, | |
repoEntry: (environment.REPO_ENTRY as ReposBranchesDocument) ?? {}, | |
branchEntry: (environment.BRANCH_ENTRY as BranchEntry) ?? {}, | |
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good typing! i like it. done
// remove empty directories | ||
for (const [path, filenames] of Object.entries(log.filePathsPerDir)) { | ||
if (!filenames.length && path !== PUBLIC_OUTPUT_PATH) { | ||
await fsPromises.rm(path, { recursive: true, force: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to do these concurrently? ie
await Promise.all(Object.entries(log.filePathsPerDir).map(async ([path, filenames]) => {
if (!filenames.length && path !== PUBLIC_OUTPUT_PATH) {
await fsPromises.rm(path, { recursive: true, force: true });
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. minor note that this doesnt take long
5:27:55 PM: >>>>>>>>>> converted gatsby results <<<<<<<<<<<<<
then this removing directories has no log, and then
5:28:00 PM: ... uploaded to AWS S3
link to log:
https://app.netlify.com/sites/iridescent-babka-0105eb/deploys/673676f557170d869a2ac07b#L5882
❌ Deploy Preview for redirects-and-publish-extension failed. Why did it fail? →
|
This PR adds logic for the offline snooty extension.
In the entry index.ts file, this extension calls to do the following onSuccess of the build's deploy:
href
and images'src
properties in each HTML file to have a relative path to the correct html / image file.tgz
to upload to S3<bucket>/docs/offline
Follow up tickets will address updating an entry in Atlas collection
repos_branches
to signify a successful offline build uploadNetlify extension is created here
Netlify site for the extension is created here
Build log of test site using this extension
Resulting S3 upload bucket
NOTE: test is failing at an unrelated change due to biome (also failing on main)