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: Fix failing scaffolds due to marked #1319

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

jackw
Copy link
Collaborator

@jackw jackw commented Nov 12, 2024

What this PR does / why we need it:
Marked terminal and marked dependencies on npx runs are resolved incorrectly and cause scaffolding to fail to succeed.

Before

npx -y @grafana/create-plugin@latest
✔ Select a plugin type · panel
✔ Enter a name for your plugin · safas
✔ Enter your organization name (usually your Grafana Cloud org) · xxx
file:///Users/jackwestbrook/.npm/_npx/c8ca622b04c0c218/node_modules/marked-terminal/index.js:474
  return text.replace(/:([A-Za-z0-9_\-\+]+?):/g, function (emojiString) {
              ^

TypeError: text.replace is not a function
Please report this to https://github.com/markedjs/marked.
    at insertEmojis (file:///Users/jackwestbrook/.npm/_npx/c8ca622b04c0c218/node_modules/marked-terminal/index.js:474:15)
    at file:///Users/jackwestbrook/.npm/_npx/c8ca622b04c0c218/node_modules/marked-terminal/index.js:529:24
    at file:///Users/jackwestbrook/.npm/_npx/c8ca622b04c0c218/node_modules/marked-terminal/index.js:529:24
    at Renderer.paragraph (file:///Users/jackwestbrook/.npm/_npx/c8ca622b04c0c218/node_modules/marked-terminal/index.js:134:10)
    at extension.renderer.<computed> (file:///Users/jackwestbrook/.npm/_npx/c8ca622b04c0c218/node_modules/marked-terminal/index.js:264:23)
    at renderer.<computed> [as paragraph] (file:///Users/jackwestbrook/.npm/_npx/c8ca622b04c0c218/node_modules/@grafana/create-plugin/node_modules/marked/lib/marked.esm.js:2261:48)
    at _Parser.parse (file:///Users/jackwestbrook/.npm/_npx/c8ca622b04c0c218/node_modules/@grafana/create-plugin/node_modules/marked/lib/marked.esm.js:1971:42)
    at parse (file:///Users/jackwestbrook/.npm/_npx/c8ca622b04c0c218/node_modules/@grafana/create-plugin/node_modules/marked/lib/marked.esm.js:1911:23)
    at Marked.parse (file:///Users/jackwestbrook/.npm/_npx/c8ca622b04c0c218/node_modules/@grafana/create-plugin/node_modules/marked/lib/marked.esm.js:2405:28)
    at marked (file:///Users/jackwestbrook/.npm/_npx/c8ca622b04c0c218/node_modules/@grafana/create-plugin/node_modules/marked/lib/marked.esm.js:2439:27)

Node.js v20.16.0

After

npx -y  @grafana/[email protected]
✔ Select a plugin type · panel
✔ Enter a name for your plugin · safas
✔ Enter your organization name (usually your Grafana Cloud org) · xxx

✔︎ Scaffolded xxx-safas-panel panel plugin
✔︎ Added basic E2E test (Playwright)
✔︎ Set up provisioning for basic dashboard and TestData data source instance
✔︎ Configured development environment (Docker)
✔︎ Added default GitHub actions for CI, releases and Grafana compatibility


# Congratulations on scaffolding a Grafana panel plugin! 🚀

## What's next?

Run the following commands to get started:

    * `cd ./xxx-safas-panel`
    * `npm install` to install frontend dependencies.
    * `npm exec playwright install chromium` to install e2e test dependencies.
    * `npm run dev` to build (and watch) the plugin frontend code.
    * `docker compose up` to start a grafana development server.
    * Open http://localhost:3000 in your browser to create a dashboard to begin developing your plugin.

Note: We strongly recommend creating a new Git repository by running git init in ./xxx-safas-panel before continuing.

    * Learn more about Grafana Plugin Development at https://grafana.com/developers/plugin-tools

Which issue(s) this PR fixes:

Fixes #1318

Special notes for your reviewer:

📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @grafana/[email protected]
# or 
yarn add @grafana/[email protected]

@jackw jackw added create-plugin related to the create-plugin tool patch Increment the patch version when merged release Create a release when this pr is merged labels Nov 12, 2024
@jackw jackw requested a review from a team as a code owner November 12, 2024 13:56
@jackw jackw requested review from leventebalogh and removed request for a team November 12, 2024 13:56
Copy link

github-actions bot commented Nov 12, 2024

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

✨ This PR can be merged and will trigger a new patch 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 fix(create-plugin): force updates for marked and marked-terminal, mov… Create Plugin: Fix failing scaffolds due to marked Nov 12, 2024
@jackw jackw self-assigned this Nov 12, 2024
Comment on lines +31358 to +31359
"marked": "^14.1.0",
"marked-terminal": "^7.2.0",
Copy link
Collaborator Author

@jackw jackw Nov 12, 2024

Choose a reason for hiding this comment

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

This forces a refresh of the dependencies when the package is pulled via npx so they are aligned with each other.

Comment on lines +31370 to +31373
"@types/marked-terminal": "^6.0.1",
"@types/minimist": "^1.2.2",
"@types/semver": "^7.3.9",
"@types/which": "^3.0.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We don't ship TS types with this package so there's no need for these to be dependencies. @types/marked-terminal has a peer dependency on marked which was also causing limitations in the versions of marked installed via npx.

Copy link
Contributor

@sunker sunker left a comment

Choose a reason for hiding this comment

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

🚀

@jackw jackw merged commit f2a40c0 into main Nov 12, 2024
17 checks passed
@jackw jackw deleted the jackw/fix-marked-dependencies branch November 12, 2024 14:59
@grafana-plugins-platform-bot
Copy link

🚀 PR was released in @grafana/[email protected] 🚀

@grafana-plugins-platform-bot grafana-plugins-platform-bot bot added the released This issue/pull request has been released. label Nov 12, 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 patch Increment the patch 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.

something did not work in @grafana/create-plugin@latest(5.9 I believe)
2 participants