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

Create Plugin: Remove Plop #602

Merged
merged 22 commits into from
Jan 9, 2024
Merged

Create Plugin: Remove Plop #602

merged 22 commits into from
Jan 9, 2024

Conversation

jackw
Copy link
Collaborator

@jackw jackw commented Dec 14, 2023

What this PR does / why we need it:

This PR aims to remove PlopJS from the generate command in favour of using enquirer and handlebars directly. The changes should not impact behaviour of scaffolding nor affect the user in any way.

  • Remove plopJS
  • Add "nested" plopJS npm packages to package.json
  • Generation - Add "glue code" to take the output from cli args and prompts and apply them to the handlebars templates
  • Generation - handle "plop modifications" using handlebars partials
  • Generation - check at generate to abort if directory exists with files
  • Generation - allow passing args via cli to support scaffolding without need for prompts
  • Generation - make it possible to skip prompts based on previous answers
  • Generation - match console output as closely to plopJS
  • Testing - add some sort of tree-recursive file check to assert changes in this PR are in line with plopjs generation

Tests

This PR can be tested locally using the version of the plugin at the end of this PR description.

Scaffolding the same plugin twice, once with npx -y @grafana/create-plugin@latest and again with npx -y @grafana/create-plugin@2.11.0-canary.602.81e7a0e.0 then running the recursiveFileCheck.mjs against each output to check the same files and directory structure exists gives the following (expected) results:

App with backend

File/Directory Change Type Diff
.cprc.json Modified
- "version": "2.10.1"
+ "version": "2.11.0-canary.602.81e7a0e.0"

Datasource with backend

File/Directory Change Type Diff
.cprc.json Modified
- "version": "2.10.1"
+ "version": "2.11.0-canary.602.81e7a0e.0"

Panel

File/Directory Change Type Diff
.cprc.json Modified
- "version": "2.10.1"
+ "version": "2.11.0-canary.602.81e7a0e.0"

Scenes App with backend

File/Directory Change Type Diff
.cprc.json Modified
- "version": "2.10.1"
+ "version": "2.11.0-canary.602.81e7a0e.0"

Datasource without backend

File/Directory Change Type Diff
.cprc.json Modified
- "version": "2.10.1"
+ "version": "2.11.0-canary.602.81e7a0e.0"

Which issue(s) this PR fixes:

Fixes #607

Special notes for your reviewer:

📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @grafana/create-plugin@2.11.0-canary.602.618fd26.0
# or 
yarn add @grafana/create-plugin@2.11.0-canary.602.618fd26.0

Copy link

github-actions bot commented Dec 14, 2023

Hello! 👋 This repository uses Auto for releasing packages using PR labels.

✨ This PR can be merged and will trigger a new minor release.
NOTE: When merging a PR with the release label please avoid merging another PR. For further information see here.

@jackw jackw changed the title Create Plugin: PoC to remove Plop Create Plugin: Remove Plop Dec 15, 2023
@jackw jackw self-assigned this Dec 15, 2023
@jackw jackw added major Increment the major version when merged release Create a release when this pr is merged labels Dec 18, 2023
@jackw jackw marked this pull request as ready for review December 18, 2023 16:57
@jackw jackw requested a review from a team as a code owner December 18, 2023 16:57
@jackw jackw requested review from oshirohugo and removed request for a team December 18, 2023 16:58
@jackw jackw added minor Increment the minor version when merged and removed major Increment the major version when merged labels Dec 18, 2023
@@ -38,14 +38,18 @@
"@types/mkdirp": "^1.0.2",
"@types/semver": "^7.3.9",
"@types/which": "^2.0.2",
"enquirer": "^2.3.6",
"chalk": "^4.1.2",
"change-case": "^3.1.0",
Copy link
Collaborator Author

@jackw jackw Dec 20, 2023

Choose a reason for hiding this comment

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

Some of these dependencies are not the latest versions. This is intentional. To keep changes to a minimum I've opted to use the same versions that plop was using.

Copy link
Collaborator

@leventebalogh leventebalogh left a comment

Choose a reason for hiding this comment

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

Nice work! 🥇

packages/create-plugin/package.json Show resolved Hide resolved
packages/create-plugin/scripts/recursiveFileCheck.mjs Outdated Show resolved Hide resolved
@jackw jackw added the create-plugin related to the create-plugin tool label Jan 9, 2024
@jackw jackw merged commit fa8bb69 into main Jan 9, 2024
15 checks passed
@jackw jackw deleted the jackw/remove-plop branch January 9, 2024 10:47
@grafana-plugins-platform-bot
Copy link

🚀 PR was released in @grafana/create-plugin@2.11.0 🚀

@grafana-plugins-platform-bot grafana-plugins-platform-bot bot added the released This issue/pull request has been released. label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
create-plugin related to the create-plugin tool minor Increment the minor version when merged release Create a release when this pr is merged released This issue/pull request has been released.
Projects
Development

Successfully merging this pull request may close these issues.

Create Plugin: Scaffold plugins without plop
3 participants