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

DS-408: Convert yeoman to plop alternative #2274

Merged

Conversation

adamszalapski
Copy link
Collaborator

@adamszalapski adamszalapski commented Jul 16, 2021

Jira

https://pegadigitalit.atlassian.net/browse/DS-408

Summary

Rewriting the component generator from yeoman to plop and adding the element generator.

Details

The previous yeoman generator is removed. In his place, we added a plop generator that is easier to use and more developer-friendly. Except we rewrite the component generator we add elements generator.

How to test

  1. Pull the branch locally and run yarn setup.
  2. Run yarn cc to generate component and check if all the files are generated correctly.
  3. Run yarn jest packages/generators/bolt-generator/__tests__/component/bolt-generator.js and check if all tests passed.
  4. Run yarn ce to generate element and check if all the files are generated correctly.
  5. Run yarn jest packages/generators/bolt-generator/__tests__/element/bolt-generator.js and check if all tests passed.

We need only two acceptations but I want you all to check this code.

@github-actions github-actions bot added the type: feature List this PR in the 'Features' section of the release notes. label Jul 16, 2021
@colbytcook colbytcook temporarily deployed to feature/DS-408-Convert-Yeoman-to-Plop-alternative--branch-preview July 16, 2021 14:08 Inactive
@colbytcook colbytcook temporarily deployed to feature/DS-408-Convert-Yeoman-to-Plop-alternative--branch-preview July 16, 2021 14:41 Inactive
@adamszalapski adamszalapski changed the title Convert yeoman to plop alternative DS-408: Convert yeoman to plop alternative Jul 27, 2021
@colbytcook colbytcook temporarily deployed to feature/DS-408-Convert-Yeoman-to-Plop-alternative--branch-preview July 27, 2021 21:43 Inactive
Copy link
Collaborator

@danielamorse danielamorse left a comment

Choose a reason for hiding this comment

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

@adamszalapski this is great 🎉 I thought we'd never get around to it.

I especially like:

  • plop seems much simpler than yo
  • Well-organized "helpers"
  • Testing coverage
  • User input validation, e.g. "Don't include underscores"
  • Uses the latest Jest test templates

One question: if you try to run yarn start immediately after creating a component/element you'll see an error:

Error: Cannot find module '@bolt/components-foo/package.json'

I think this is because yarn doesn't know about the new package yet, even though it has been added as a dependency. Running yarn fixes it. Should we automatically run yarn on create or just leave that up to the user? Do you know of another way to register the new package?

Approved once we decide on this question^

Update: I'm merging as is. We can discuss the yarn question later on.

const boltPackageJsonPath = resolve.sync('@bolt/starter-kit/package.json')
const boltPackageJson = require(boltPackageJsonPath);

const updateBoltPackage = (packageName, writePath) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

👏

…rnative

# Conflicts:
#	packages/generators/yeoman-create-component/CHANGELOG.md
#	packages/generators/yeoman-create-component/package.json
@danielamorse danielamorse merged commit 5126baf into master Aug 9, 2021
@danielamorse danielamorse deleted the feature/DS-408-Convert-Yeoman-to-Plop-alternative branch August 9, 2021 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature List this PR in the 'Features' section of the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants