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

feat(icon): moved icon generation script #535

Merged
merged 8 commits into from
Dec 31, 2020

Conversation

tveinfeld
Copy link
Contributor

  • Moved icon generation script from /package.json -> /components/icon/package.json
  • Added verbosity flag to generation script

@github-actions
Copy link

🚀

Latest successful build of the PR deployed here.

🚀

@@ -48,7 +48,7 @@ jobs:
run: yarn compile

- name: Build CDN icon resolver
run: yarn build:icon-resolver --resolveStrategy=cdn --awsAccessKey=${{ secrets.AWS_VIVID_DEMO_PROD_ACCESS }} --awsAccessSecret=${{ secrets.AWS_VIVID_DEMO_PROD_SECRET }} --awsBucketName=vivid-icons-prod --awsBaseUrl=https://icons.resources.vonage.com
run: npx lerna run "generate-icon-resolver" --parallel --scope="@vonage/vwc-icon" -- --verboseOutput --resolveStrategy=cdn --awsBucketName=vivid-icons-prod --awsBaseUrl=https://icons.resources.vonage.com --awsAccessKey=${{ secrets.AWS_VIVID_DEMO_PROD_ACCESS }} --awsAccessSecret=${{ secrets.AWS_VIVID_DEMO_PROD_SECRET }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
run: npx lerna run "generate-icon-resolver" --parallel --scope="@vonage/vwc-icon" -- --verboseOutput --resolveStrategy=cdn --awsBucketName=vivid-icons-prod --awsBaseUrl=https://icons.resources.vonage.com --awsAccessKey=${{ secrets.AWS_VIVID_DEMO_PROD_ACCESS }} --awsAccessSecret=${{ secrets.AWS_VIVID_DEMO_PROD_SECRET }}
run: yarn lerna run "generate-icon-resolver" --parallel --scope="@vonage/vwc-icon" -- --verboseOutput --resolveStrategy=cdn --awsBucketName=vivid-icons-prod --awsBaseUrl=https://icons.resources.vonage.com --awsAccessKey=${{ secrets.AWS_VIVID_DEMO_PROD_ACCESS }} --awsAccessSecret=${{ secrets.AWS_VIVID_DEMO_PROD_SECRET }}

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'm not sure it will yield the same result:
I think that yarn lerna will try to execute a package.json script named "lerna" (which does not exist), whereas npx lerna will run the default bin for package lerna.

Copy link
Contributor

Choose a reason for hiding this comment

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

It won't, obviously.
I'm referring to make it back as it was: yarn generate-icon-resolver just as you have it in a build script.

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 was asked by @yinonov to remove this script from /package.json. In fact, this was the guiding motivation behind this PR.
As for myself: I don't hold a firm opinion as to where this script fits best. Therefore I suggest that @gullerya and @yinonov will discuss their opinions and reach a conclusion.

Copy link
Contributor

Choose a reason for hiding this comment

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

What makes you think that our opinions are different? Don't push us where we aren't :)
The script can be run via yarn pointing to the package folder, as it was beforehand and there is no other opinion expressed on this specific point.

@github-actions
Copy link

github-actions bot commented Dec 30, 2020

File Coverage
All files 80%
common/context/src/vvd-context.ts 96%
common/fonts/src/vvd-fonts.ts 83%
common/foundation/src/form-association/associate-with-form.ts 89%
common/foundation/src/form-association/common.ts 90%
common/foundation/src/form-association/submit-on-enter-key.ts 80%
common/scheme/src/os-sync.utils.ts 58%
common/scheme/src/vvd-scheme-style-tag-handler.ts 79%
common/scheme/src/vvd-scheme.ts 82%
components/audio/src/vwc-audio.ts 60%
components/button/src/vwc-button.ts 78%
components/carousel/src/vwc-carousel.ts 71%
components/drawer/src/vwc-drawer.ts 42%
components/fab/src/vwc-fab.ts 63%
components/file-picker/src/vwc-file-picker.ts 67%
components/icon-button-toggle/src/vwc-icon-button-toggle.ts 67%
components/icon-button/src/vwc-icon-button.ts 67%
components/icon/src/vwc-icon.js 92%
components/list/src/vwc-list-expansion-panel.ts 73%
components/list/src/vwc-list-item.ts 80%
components/media-controller/src/vwc-media-controller.ts 84%
components/select/src/vwc-select.ts 90%
components/slider/src/vwc-slider.ts 88%
components/textarea/src/vwc-textarea.ts 81%
components/textfield/src/vwc-textfield.ts 90%
components/theme-switch/src/vwc-theme-switch.ts 88%

Minimum allowed coverage is 75%

Generated by 🐒 cobertura-action against f83f106

@@ -45,7 +45,7 @@ jobs:
run: yarn compile

- name: Build CDN icon resolver
run: yarn build:icon-resolver --resolveStrategy=cdn --awsAccessKey=${{ secrets.AWS_VIVID_DEMO_PROD_ACCESS }} --awsAccessSecret=${{ secrets.AWS_VIVID_DEMO_PROD_SECRET }} --awsBucketName=vivid-icons-prod --awsBaseUrl=https://d3fzvwfxu7izti.cloudfront.net
run: npx lerna run "generate-icon-resolver" --parallel --scope="@vonage/vwc-icon" -- --verboseOutput --resolveStrategy=cdn --awsBucketName=vivid-icons-prod --awsBaseUrl=https://icons.resources.vonage.com --awsAccessKey=${{ secrets.AWS_VIVID_DEMO_PROD_ACCESS }} --awsAccessSecret=${{ secrets.AWS_VIVID_DEMO_PROD_SECRET }}
Copy link
Contributor

Choose a reason for hiding this comment

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

same as below, can you please use yarn to preserve convention as elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you sure this will yield the same result? (see my comment☝️)

Copy link
Contributor

@gullerya gullerya Dec 30, 2020

Choose a reason for hiding this comment

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

I mean yarn generate-icon-resolver, sorry, mislead you from what I've meant.

@gullerya
Copy link
Contributor

@tveinfeld : beside the ask to replace the npx with yarn - why do you need that --parallel and lerna in general?

@gullerya gullerya self-requested a review December 30, 2020 12:52
@tveinfeld
Copy link
Contributor Author

tveinfeld commented Dec 30, 2020

@tveinfeld : beside the ask to replace the npx with yarn - why do you need that --parallel and lerna in general?

I use --parallel to make lerna output it's stdout as the command it runs executes (as opposed to waiting for it to complete, and then output the entire stdout buffer).

Using Lerna makes it easier to refactor folder structure (like the one @yinonov is promoting), since it can run scripts according to the npm package identifier rather than folder names.

@tveinfeld tveinfeld requested a review from yinonov December 30, 2020 15:15
@gullerya
Copy link
Contributor

gullerya commented Dec 30, 2020

Then I'd say it is less than obvious and quite not clear here: lerna is used mainly to serve multi-package structure - not your case here; parallel - meant to run all the same scripts in all the packages - not your case here.
I think that until you'll really need that one - please use the straight forward syntax - which you actually had before and it worked just well.

@tveinfeld
Copy link
Contributor Author

Then I'd say it is less than obvious and quite not clear here: lerna is used mainly to serve multi-package structure - not your case here; parallel - meant to run all the same scripts in all the packages - not your case here.
I think that until you'll really need that one - please use the straight forward syntax - which you actually had before and it worked just well.

Good catch! I've changed "parallel" to "stream" to enhance readability. As for the proper location for the script, well, I leave this decision to anyone who holds a firmer opinion than mine. @yinonov for one.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@gullerya
Copy link
Contributor

gullerya commented Dec 30, 2020

@tveinfeld : i'm not talking about location of the script, where do you take it from?!
All I'm saying is that it is better to execute it by yarn and no point in all that lerna ceremony here, which adds more obscurity than any value.

@tveinfeld
Copy link
Contributor Author

tveinfeld commented Dec 30, 2020

@gullerya:

In order to use yarn, i need to define a script in package.json, and this is exactly what @yinonov wishes to remove.

Now, if i want to execute the local script using yarn, i have to chdir into it and run the script, hence create coupling with the folder name in the build yml. to avoid this, lerna comes handy.

@gullerya
Copy link
Contributor

Finally we getting closer :)
So @yinonov do NOT simply want to remove it, but move from global to local, which is not the same and I'm pretty sure it is clearly understandable from the beginning.
Yes, running locally is to do cd, which is exactly what you had previously and which is perfectly fine now as well.
Lerna happens to help here, but in general a wrong tool to use when not in context of multi-package stuff.

Let's discuss the whole thing tomorrow, since we probably see here symptoms of being the whole part of icons build mis-located, so it might be a good point to fix stuff.

@tveinfeld
Copy link
Contributor Author

Lerna happens to help here, but in general a wrong tool to use when not in context of multi-package stuff.

we are using it in a context of multi package repo 😅

Lemme sum up the motivation. behind this PR for clarity:
yinon wanted to remove the icon creation specific script from /package.json and suggested using yarn package:build with a scope from the github yaml. Now, since the "build" script of icon contains two steps, and only one is relevant for github, i couldn't do it verbatim. instead, i've defined a local script and simply run it using lerna. This solution accommodates Yinon's request without impacting clarity in comparison to using yarn package:build.

Using yarn would force me to reintroduce a script to the root's package.json

i don't see how this exposes a deeper issue with the location of the icon module creation script, but it's a good opportunity to hear your opinion.

@gullerya
Copy link
Contributor

Since it becomes too lengthy and not converging I'll ask a simple short one: why cd packages/icon && yarn generate-icon-script is not an option?

@tveinfeld
Copy link
Contributor Author

it is definitely an option.. it's just that @yinonov offered a different approach of using Lerna with a scope instead.
I actually liked it because it reduces coupling from the folder structure (which proves beneficial right now with Yinon's folder refactoring suggestion).
It's not a big improvement, but it's nice to address packages by their official name rather than their monorepo folder name.
We could also just change the script on /package.json so that it uses Lerna with a scope, but that voids this PRs original intention.

@YonatanKra
Copy link
Contributor

Pull Request Test Coverage Report for Build 453054845

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.5%) to 82.393%

Totals Coverage Status
Change from base Build 452981805: -0.5%
Covered Lines: 848
Relevant Lines: 953

💛 - Coveralls

@gullerya gullerya dismissed yinonov’s stale review December 31, 2020 06:00

The proposal is not relevant since it requires a broader changes and looks like @yinonov has no meant it to be that way.

@gullerya gullerya merged commit efaddf4 into master Dec 31, 2020
@gullerya gullerya deleted the no_jira_icon_generation_script_moved branch December 31, 2020 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants