-
Notifications
You must be signed in to change notification settings - Fork 45
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
DS-409 Update plop component generator #2292
DS-409 Update plop component generator #2292
Conversation
…ator # Conflicts: # packages/generators/yeoman-create-component/CHANGELOG.md # packages/generators/yeoman-create-component/package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks @MarcinMr. I just made one formatting fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- if we're trying to make less and less web components, do we want the default generator to be a web component out of the box? maybe we can add a step in the generator to ask if its a web component, then generate a separate directory.
- in the twig file it doesnt look to me like we are properly leveraging
this.data
/ validation out of the box. - in the test file, are the right things commented out? if we are creating a web component by default, we should be testing a web component by default. if we go with any changes from my first comment above, then the test file should be rendered differently as well, right?
---- editing in a little more ---- - should we generate the first docs file too? so we have an example of what we want the docs to look like from here out. this could use some input from @mikemai2awesome since he's been rocking the documentation.
yes, we should chat about CJ's points. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we change the name of the package? If this was already. discuss we should find all bolt-generator
occurrences and change it to generator-bolt
because of other tests and some exceptions based on this name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good except for the tests. I'm running into some Jest test errors locally that I'll need more time to debug. Tests pass individually, and then when I run yarn test:js
several generator tests fail.
Also, made a very minor fix. We were missing a closing single-quote in the commented-out test, and we included an extra space at the end. Jest adds a space for you, no need for a trailing space.
packages/generators/bolt-generator/__tests__/component/__snapshots__/bolt-generator.js.snap
Show resolved
Hide resolved
packages/generators/bolt-generator/__tests__/component/__snapshots__/bolt-generator.js.snap
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I agree with @danielamorse all-new approaches/conventions should be updated/added to our WIKI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm seeing Jest test failures when I do the following:
- Run
yarn test:js
(all tests pass... although I was seeing unrelated intermittentbolt-text
fails, disregard for now) - Run
npx jest packages/generators/bolt-generator/__tests__/component/bolt-generator.js
(pass) - Run
npx jest packages/generators/bolt-generator/__tests__/element/bolt-generator.js
(pass) - Run
yarn test:js
(fail, see error)
The second time you run yarn test:js
it produces different snapshots. It seems like something is left over from previous tests (perhaps in tmp
?) that changes the test results.
I discovered this when I had to update the individual generator snapshots. Then I ran all tests and saw the error. It's an edge case, but we should fix it before this gets merged.
@adamszalapski any thoughts on why this might happen?
Good catch @danielamorse This issue's related to testing asynchronously and how our bolt-generator uses To prevent this situation I updated the approach how we use |
…nchronisly run tests
@danielamorse I update whole folder structure for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamszalapski works perfectly now. Thank you!
Jira
https://pegadigitalit.atlassian.net/browse/DS-409
Summary
Schema, twig and test templates were updated to our standards
Details
A branch feature/DS-408-Convert-Yeoman-to-Plop-alternative was pulled to this one.
title
andcontent
were added tocomponent.schema
component.docs.twig
was updated with single quotescomponent.twig
was updated with single quotes,attributes
was changed withprops.class
,title
andcontent
were added to the templatecomponent.test.js
was updated with commented code in case to use, according to the master schemaelement.docs.twig
was updated with single quotesHow to test
yarn setup
.yarn cc
to generate component and check if all the files are generated correctly (remember to runyarn
after).yarn cc
to generate component and check if all the files are generated correctly (remember to runyarn
after).yarn ce
to generate element and check if all the files are generated correctly (remember to runyarn
after).