Skip to content
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

getting prd ready #61

Open
wants to merge 7 commits into
base: DOP-5168
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions extensions/redirects-and-publish/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ const extension = new Extension({
extension.addBuildEventHandler(
'onSuccess',
async ({ utils: { run }, netlifyConfig, dbEnvVars }) => {
// TODO: In the future this should also account for dotcomprd
if (netlifyConfig?.build?.environment.ENV !== 'dotcomstg') {
return;
if (netlifyConfig?.build?.environment.ENV === 'dotcomstg' || netlifyConfig?.build?.environment.ENV === 'dotcomprd') {
setMutEnvVars(dbEnvVars);
await mutRedirectsAndPublish(netlifyConfig?.build?.environment, run);
}
setMutEnvVars(dbEnvVars);
await mutRedirectsAndPublish(netlifyConfig?.build?.environment, run);
return;
},
);

Expand Down
17 changes: 13 additions & 4 deletions extensions/redirects-and-publish/src/mutRedirectsAndPublish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,21 @@ export const mutRedirectsAndPublish = async (
await run.command('unzip -d . -qq mut.zip');

await run.command('npm ci --legacy-peer-deps');

if (!configEnvironment.ENV) {
return;
}

if (configEnvironment.ENV !== 'dotcomstg' && (configEnvironment.ENV !== 'dotcomprd' && repoName !== 'docs-landing')) {
return;
}

for (const alias of urlAliases) {
// Building frontend ------------------------------------------------------------
// TODO: When uploaded to prod, run this command instead: process.env.PATH_PREFIX = `/${docsetEntry?.prefix?.[configEnvironment.ENV]}`; (DOP-5178)
const prefix = alias
? `/${docsetEntry.prefix.dotcomstg}/${alias}`
: `/${docsetEntry.prefix.dotcomstg}`;
? `/${docsetEntry.prefix[configEnvironment.ENV]}/${alias}`
: `/${docsetEntry.prefix[configEnvironment.ENV]}`;

await run.command('ls');
await run.command('npm run clean');
Expand Down Expand Up @@ -121,10 +130,10 @@ export const mutRedirectsAndPublish = async (
`${process.cwd()}/mut/mut-publish`,
[
'public',
`${docsetEntry?.bucket?.dotcomstg}`,
`${docsetEntry?.bucket[configEnvironment.ENV]}`,
`--prefix=${prefix}`,
'--deploy',
`--deployed-url-prefix=s${docsetEntry?.url?.dotcomstg}`,
`--deployed-url-prefix=s${docsetEntry?.url[configEnvironment.ENV]}`,
'--json',
'--all-subdirectories',
],
Expand Down