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 | crayons-icon CLI Tooling #350

Merged
merged 31 commits into from
Dec 22, 2021
Merged

Feat | crayons-icon CLI Tooling #350

merged 31 commits into from
Dec 22, 2021

Conversation

detiwari003
Copy link
Contributor

@detiwari003 detiwari003 commented Dec 17, 2021

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My commits have standard messages as mentioned in Contributing Guidelines

How Has This Been Tested?

@detiwari003 detiwari003 self-assigned this Dec 17, 2021
@detiwari003 detiwari003 added the enhancement New feature or request label Dec 17, 2021
* @freshworks/crayons-icon
* Crayons-Icon as NodeJS-CLI Tool to optimize SVGs and generate JS Imports for icons.
*
* @author Freshworks <https://freshworks.in>
Copy link
Collaborator

Choose a reason for hiding this comment

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

freshworks.in is not the right domain :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@@ -2,9 +2,3 @@

All notable changes to this project will be documented in this file.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is the changeLog removed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

"svgo yml config",
"svg JS Exports",
"svg optimizer",
"crayons-icon-cli"
Copy link
Collaborator

Choose a reason for hiding this comment

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

can u check the formatting here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

function App() {
return (
<div>
< FwIcon dataSvg = { header } label = "Header"/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pls remove the space after the starting tag token. It should be <FwIcon

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

"devDependencies": {
"fs": "^0.0.1-security",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is fs added as a dev dependency ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

}
async function optimizeSvg(optimizePass, svgData) {
const srcSvgContent = await fs_extra.readFile(svgData.srcFilePath, 'utf8');
const optimizedSvg = await optimizePass.optimize(srcSvgContent, {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please handle exceptions in the application.

Copy link
Contributor Author

@detiwari003 detiwari003 Dec 20, 2021

Choose a reason for hiding this comment

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

Centralized level in build block, Tested. I cannot add try-catch{} in all functions as it will result in eslint error: 'Unnecessary try-catch wrapper '. So done at the central level.(fn)build.
Fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2021-12-20 at 3 44 08 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2021-12-20 at 4 05 32 PM

const distSvgFilePath = path.join(distSvgDir, fileName);
const dotSplit = fileName.split('.');
if (dotSplit.length > 2) {
throw new Error(
Copy link
Collaborator

Choose a reason for hiding this comment

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

How is the error handled in this application ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Centralized level in build block, Tested. I cannot add try-catch{} in all functions as it will result in eslint error: 'Unnecessary try-catch wrapper '. So done at the central level.(fn)build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

packages/crayons-icon/readme.md Show resolved Hide resolved
Copy link
Collaborator

@arvindanta arvindanta left a comment

Choose a reason for hiding this comment

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

Screenshot 2021-12-20 at 8 39 10 PM

Am trying to use the above command , when I run this command, nothing is happening. The dest folder is not created

Answer

Please pass svgo command.
" node_modules/.bin/fw-icon-cli svgo --source ./src/assets/icons --destination ./public/assets/icons"

Copy link
Contributor

@parsuram-vijaysankar parsuram-vijaysankar left a comment

Choose a reason for hiding this comment

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

@detiwari003 I would recommend that from next time you don't club a lot of changes into one PR. it's easy to code and review one type of change you are making pushing it out!

Yes Parsu. Will do the same. I have just refactored the earlier implementation with proper variable and function names and retested exception cases, added try catch where necessary and removed unnecessary exception stack logging by using e.message.


@Element() el: HTMLElement;
@State() private setElVisible = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this a State? can't it just be a private variable?

Copy link
Contributor Author

@detiwari003 detiwari003 Dec 21, 2021

Choose a reason for hiding this comment

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

@parsuram-vijaysankar The @State() decorator is used to manage internal data for a component. This means that a user cannot modify this data from outside the component, but the component can modify it however it sees fit. Any changes to a @State() property will cause the components render function to be called again.
This is what we need in xOb.

@detiwari003 detiwari003 merged commit ef32796 into canary Dec 22, 2021
@detiwari003 detiwari003 deleted the crayons-icon-cli branch December 22, 2021 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants