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

MWPW-160129: DC Fill and Sign: Stage page use prod library #853

Merged
merged 4 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions acrobat/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ export const [setLibs, getLibs] = (() => {
(prodLibs, location) => {
libs = (() => {
const { hostname, search } = location || window.location;
// eslint-disable-next-line compat/compat
const branch = new URLSearchParams(search).get('milolibs') || 'main';
if (branch === 'main' && hostname === 'www.stage.adobe.com') return 'https://www.adobe.com/libs';
if (branch === 'main' && hostname === 'www.stage.adobe.com') return '/libs';
if (!(hostname.includes('.hlx.') || hostname.includes('local') || hostname.includes('stage'))) return prodLibs;
if (branch === 'local') return 'http://localhost:6456/libs';
return branch.includes('--') ? `https://${branch}.hlx.page/libs` : `https://${branch}--milo--adobecom.hlx.page/libs`;
return branch.includes('--') ? `https://${branch}.hlx.live/libs` : `https://${branch}--milo--adobecom.hlx.live/libs`;
})();
return libs;
}, () => libs,
Expand Down
4 changes: 2 additions & 2 deletions test/scripts/utils.test.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <import/order> reported by reviewdog 🐶
../../acrobat/scripts/utils import should occur after import of @esm-bundle/chai

import { setLibs, getLibs } from '../../acrobat/scripts/utils';

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <no-unused-vars> reported by reviewdog 🐶
'getLibs' is defined but never used.

import { setLibs, getLibs } from '../../acrobat/scripts/utils';

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <import/extensions> reported by reviewdog 🐶
Missing file extension "js" for "../../acrobat/scripts/utils"

import { setLibs, getLibs } from '../../acrobat/scripts/utils';

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <no-unused-vars> reported by reviewdog 🐶
'sinon' is defined but never used.

import * as sinon from 'sinon';

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import * as sinon from 'sinon';
import { expect } from '@esm-bundle/chai';

describe('Test utils.js', async () => {
it('tests setLibs', async () => {
it('tests setLibs', async () => {
const libs = setLibs('/lib');
expect(libs).to.equal('https://main--milo--adobecom.hlx.page/libs');
expect(libs).to.equal('https://main--milo--adobecom.hlx.live/libs');
});
});
Loading