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

Feature/logo building #89

Merged
merged 13 commits into from
Jan 31, 2023
Merged

Feature/logo building #89

merged 13 commits into from
Jan 31, 2023

Conversation

dtjones404
Copy link
Contributor

@dtjones404 dtjones404 commented Jan 27, 2023

DTPPSDK-997

  • build-logos script has been added, which creates a versioned CDN folder populated with APM SVGs and (optionally) commits to github. This script has been added as a step in the publish github action.
  • Many APM components are now capable of operating in a dual mode, where they will render raw SVG code or CDN links, depending on a prop passed by checkout-components (loadFromCDN). As an example:
    // if loadFromCDN is false, IdealLogo will render <img src=(base64-encoded SVG code) />
    // if loadFromCDN is true, IdealLogo will render  <img src=(cdn url) />
    return IdealLogo({ logoColor, optional, loadFromCDN })
    
  • Affected components have been refactored slightly to accommodate these changes.

@dtjones404 dtjones404 requested a review from a team as a code owner January 27, 2023 21:43
package.json Outdated Show resolved Hide resolved
scripts/utils.js Outdated Show resolved Hide resolved
prashantjagasia and others added 2 commits January 27, 2023 16:53
* feat: flag for committing

* feat: adding cdn/2.2.0-alpha.1

* chore: added commit variable and adressed review comments

* chore: addressing PR comments

* chore: dropped -a flag

* chore: updated commit to a chore

* feat: updated workflow to run buildscript
@dtjones404 dtjones404 force-pushed the feature/logo-building branch from 76e528a to b2fe5cd Compare January 27, 2023 21:54
@dtjones404
Copy link
Contributor Author

force push to fix commit-lint issue

dtjones404 and others added 2 commits January 27, 2023 16:59
Co-authored-by: Greg Jopa <534034+gregjopa@users.noreply.github.com>
@dtjones404 dtjones404 force-pushed the feature/logo-building branch from b2fe5cd to 7961085 Compare January 27, 2023 21:59
@codecov
Copy link

codecov bot commented Jan 27, 2023

Codecov Report

Base: 67.64% // Head: 70.31% // Increases project coverage by +2.67% 🎉

Coverage data is based on head (d3e71b3) compared to base (7f96dcf).
Patch coverage: 78.52% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #89      +/-   ##
==========================================
+ Coverage   67.64%   70.31%   +2.67%     
==========================================
  Files          41       41              
  Lines         204      283      +79     
  Branches       34       35       +1     
==========================================
+ Hits          138      199      +61     
- Misses         64       81      +17     
- Partials        2        3       +1     
Impacted Files Coverage Δ
src/lib/components.jsx 50.00% <25.00%> (-13.64%) ⬇️
src/logos/blik/logo.jsx 25.00% <33.33%> (+5.00%) ⬆️
src/logos/boleto/logo.jsx 25.00% <33.33%> (+5.00%) ⬆️
src/logos/maxima/logo.jsx 25.00% <33.33%> (+5.00%) ⬆️
src/logos/oxxo/logo.jsx 25.00% <33.33%> (+5.00%) ⬆️
src/logos/payu/logo.jsx 25.00% <33.33%> (+5.00%) ⬆️
src/logos/trustly/logo.jsx 25.00% <33.33%> (+5.00%) ⬆️
src/logos/verkkopankki/logo.jsx 25.00% <33.33%> (+5.00%) ⬆️
src/lib/util.js 75.00% <80.00%> (+3.57%) ⬆️
src/constants.js 100.00% <100.00%> (ø)
... and 16 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dtjones404 dtjones404 force-pushed the feature/logo-building branch 3 times, most recently from a53bfc6 to d80181d Compare January 31, 2023 17:10
return JSON.parse(fs.readFileSync("./package.json", "utf-8"));
}

export function getNodeOps(): NodeOps {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we use this getNodeOps() function anywhere? If not, can we delete it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah right. Should we use it to update the namespace in the CDN URL, like we do with package version? I like the idea of making it dynamic but it's another point of failure as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the .nodeops file can remain static similar to what we do in paypal/sdk-release.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought it might be confusing if somebody ever tried to change the namespace and the urls didn't update. I don't see why we would ever need to change the namespace, though

Copy link
Contributor

Choose a reason for hiding this comment

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

oh I see your point. We can keep it then to validate the namespace name since its directly tied to the cdn url.

scripts/utils.js Outdated Show resolved Hide resolved
src/constants.js Outdated Show resolved Hide resolved
dtjones404 and others added 4 commits January 31, 2023 12:18
Co-authored-by: Greg Jopa <534034+gregjopa@users.noreply.github.com>
Co-authored-by: Greg Jopa <534034+gregjopa@users.noreply.github.com>
@@ -21,7 +21,8 @@
"clean": "rimraf dist coverage",
"reinstall": "rimraf flow-typed && rimraf node_modules && npm install && flow-typed install",
"debug": "cross-env NODE_ENV=debug",
"prepare": "husky install"
"prepare": "husky install",
"build-logos": "babel-node --config-file './scripts/babel.config.json' --ignore ./fake --plugins=transform-es2015-modules-commonjs ./scripts/buildLogos.js"
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this --ignore ./fake part do? Can we remove it?

Suggested change
"build-logos": "babel-node --config-file './scripts/babel.config.json' --ignore ./fake --plugins=transform-es2015-modules-commonjs ./scripts/buildLogos.js"
"build-logos": "babel-node --config-file './scripts/babel.config.json' --plugins=transform-es2015-modules-commonjs ./scripts/buildLogos.js"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added an ignore flag to fix an issue with babel-node:

/Users/dustijones/code/public/paypal-sdk-logos/node_modules/@krakenjs/belter/src/index.js:3
export * from "./device";
^^^^^^

I'll see if I can find a long-term solution

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like it may be a bug that occurs with babel-node when you use the --config-file flag.

babel/babel#11892

Copy link
Contributor

Choose a reason for hiding this comment

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

Good find. We can keep this. I just wanted to understand why it is needed.

scripts/buildLogos.js Outdated Show resolved Hide resolved
dtjones404 and others added 2 commits January 31, 2023 14:47
Co-authored-by: Greg Jopa <534034+gregjopa@users.noreply.github.com>
scripts/buildLogos.js Outdated Show resolved Hide resolved
Copy link
Contributor

@gregjopa gregjopa left a comment

Choose a reason for hiding this comment

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

Amazing work! 💯

await $`git commit -m "chore: generate CDN packages"`;
await $`git push`;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants