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: Introduce OS check #263

Merged
merged 5 commits into from
Jun 7, 2023
Merged

Create Plugin: Introduce OS check #263

merged 5 commits into from
Jun 7, 2023

Conversation

jackw
Copy link
Collaborator

@jackw jackw commented May 29, 2023

What this PR does / why we need it:
Adds a check to the bin file that exits early if windows powershell or command prompt is detected when running commands. Tested by running the following code on a windows VM:

import { platform, release } from 'node:os';

console.log(`This platform is ${platform}`);
console.log(`This platform is ${release()}`);

Results

Windows Command Prompt

This platform is win32
This platform is 10.0.22621

Windows PowerShell

This platform is win32
This platform is 10.0.22621

Windows WSL

This platform is linux
This platform is 5.10.16.3-microsoft-standard-WSL2

Which issue(s) this PR fixes:

Related #239

Special notes for your reviewer:

📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @grafana/create-plugin@1.6.0-canary.263.16338d8.0
# or 
yarn add @grafana/create-plugin@1.6.0-canary.263.16338d8.0

Release Notes

create-plugin will now exit when run natively on Windows, which is an unsupported platform with known issues. By exiting early we hope to prevent users from hitting issues whilst developing plugins. We recommend the use of Windows Subsystem for Linux (WSL) which is supported.

@jackw jackw added enhancement New feature or request create-plugin related to the create-plugin tool minor Increment the minor version when merged release Create a release when this pr is merged labels May 29, 2023
@jackw jackw self-assigned this May 29, 2023
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.

LGTM 👍

@mckn mckn self-requested a review May 30, 2023 07:18
Copy link
Collaborator

@mckn mckn left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@sympatheticmoose sympatheticmoose 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 added patch Increment the patch version when merged and removed minor Increment the minor version when merged labels Jun 7, 2023
@jackw jackw merged commit 8d3433b into main Jun 7, 2023
3 checks passed
@jackw jackw deleted the jackw/platform-support branch June 7, 2023 09:20
@grafana-delivery-bot
Copy link

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

@grafana-delivery-bot grafana-delivery-bot bot added the released This issue/pull request has been released. label Jun 7, 2023
@atefehsafarkhah
Copy link

I have created a grafana container in my local docker and could login in grafana UI ,I have plan to create a react plugin .when I write this command(npx @grafana/create-plugin@latest
)in my ubuntu terminal I get this error: Unsupported operating system 'Windows' detected. Please use WSL with create-plugin. can you please tell me what the error come from?
I am sure that I use Linux environment and ubuntu terminal, when I check in windows Powershell I have the following result: wsl --list --verbose
NAME STATE VERSION

  • Ubuntu Running 2
    docker-desktop Running 2
    docker-desktop-data Running 2

However, when I write the npx command in ubuntu and I get the error!

@academo
Copy link
Member

academo commented Aug 14, 2023

@atefehsafarkhah Could you please run this command in the same terminal you are trying to run create plugin and tell us the output (even if an error)? uname -a

We did tests with windows machines and all of them worked as expected. It is very important to differentiate between having WSL installed and running commands inside WSL.

@atefehsafarkhah
Copy link

@academo I do not get any error.The result is like this: Linux DESKTOP-4PNS7GT 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

@academo
Copy link
Member

academo commented Aug 14, 2023

@atefehsafarkhah thanks for coming back to me so fast. could you please run this command in the exact same terminal you get that output from uname -a: node -e "console.log(process.platform)". If is not much to ask. Could you also tell me the output of which node and node --version?

In all the tests we've done we always get linux as the platform inside WSL.

@atefehsafarkhah
Copy link

atefehsafarkhah commented Aug 14, 2023

@academo Yes, my output is also Linux . my node version is: v12.22.9

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 enhancement New feature or request 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.

None yet

6 participants