logto-io / logto

🧑‍🚀 The better identity infrastructure for developers and the open-source alternative to Auth0.
https://logto.io
Mozilla Public License 2.0
8.77k stars 442 forks source link

feature request: One liner installation in Windows #1607

Open j9367 opened 2 years ago

j9367 commented 2 years ago

What problem did you meet?

The one-liner script outlined in README.md does not function on Windows due to the script utilising curl, printf, and other Linux/Bash commands. When run, the script immediately errors and halts.

Describe what you'd like Logto to have

A separate install script for Windows, including a separate Windows-oriented one liner that downloads and runs a wnidows-installer.js file in node, allowing for a one-line windows install.

j9367 commented 2 years ago

Assign issue to self (@jackm9367)

j9367 commented 2 years ago

Looks like this is more than just re-writing install.js Due to the way the installation re-builds argon, and the structure of the core module, node-pre-gyp errors out with a bug on Windows (SS attached). Recommendation for the moment is that this issue is closed and left dormant to just support macOS/Linux for the time being. Alternative option is to try and find issue within node-pre-gyp and create issue, however this could lead to further problems. If @gao-sun and @demonzoo are happy to close as not planned, or just add to longterm roadmap (probably not in Q3 sprint) then can close issue without PR. Issue with node-pre-gyp image

gao-sun commented 2 years ago

thank you @jackm9367 - I didn't test developing on Windows, and it looks like the issue is straightforward. we can give it a try to see the effort. this issue can keep open, no worries.

charIeszhao commented 2 years ago

Would you like to try it in git bash env?

j9367 commented 2 years ago

Will give it a go now I'd be guessing though that if Logto only 'supports' windows through git bash, then it doesn't really count as windows support?

j9367 commented 2 years ago

Was able to download and extract the file using the one-liner in git bash, but a few issues came up:

At this stage it's just an issue of rebuilding the argon2 package then we should be good. Will keep investigating best way forward.

charIeszhao commented 2 years ago

Thank you, Jack. I'll also take a look at it this weekend.

charIeszhao commented 2 years ago

Will give it a go now I'd be guessing though that if Logto only 'supports' windows through git bash, then it doesn't really count as windows support?

I agree! But I also think that git bash might just be working as a baseline for windows users for the time being, until we work out a full compatible windows script.

charIeszhao commented 2 years ago

Hi Jack, how are you doing lately? It seems it's been awhile since we talked about this last time. And due to the inactivity of more than 3 weeks, we are going to take it back from you and see if there's anyone else who is also interested in.

And btw, we are now promoting a "Logto bounty hunter" event, in which you can complete bounties and claim rewards (real money 💰💰💰). And I think this ticket can be put on the bounty board as well. More details about this event can be found from here.

Let me know if you want to claim it back and I can assign it back to you. Cheers!

Olyno commented 2 years ago

Hi 👋

I would like to be assigned to this issue if possible please 😄

j9367 commented 2 years ago

Hey @charIeszhao and @Olyno I've been off sick for the last while so would love it if you could take this one @Olyno! Sorry for not messaging you @charIeszhao, fell off my radar a bit.....

charIeszhao commented 2 years ago

No problem. @jackm9367 Sorry to hear that, but I hope you are OK now. Feel free to let us know if you would like to contribute something. You are always welcome here

gao-sun commented 2 years ago

quick update: thanks to @Olyno we're going to launch a cross-platform CLI soon. but I cloud not figure out the permission issue that happened in GitHub Actions Windows, you can see this workflow runs down from #4640 - fought with Windows for the whole day but no luck.

I decided to move on as I'm a noob to Windows stuff meanwhile it is in CI which is hard to debug. I'll test on a real Windows laptop after launch tough. It'll be great if any of you guys would like to test the new CLI and help with the CI issue afterwards. cheers.

gao-sun commented 2 years ago

guys, i'm wondering with the new CLI can Logto properly download and work in Windows?

Olyno commented 2 years ago

As long as the code is a JS code or a .exe executable, then yes it should work correctly on Windows.

charIeszhao commented 2 years ago

Guys, I just tried npm init @logto on windows, but I ended up only creating a package.json file...

image

Olyno commented 2 years ago

It actually makes sense. The npm init command (or yarn create or pnpm create depending on the package manager) works only if the name of the package starts with create-.

For example, create-logto will make the package compatible with the command, but having a package named @logto will not work, because this one doesn't start with the create- prefix.

charIeszhao commented 2 years ago

Yes, but the same command npm init @logto works on macOS and Linux... So are you suggesting that we should rename the package name to create-logto?

Olyno commented 2 years ago

From what I see, it is mostly a bug on Mac and Linux. The package managers should not find the package in question according to their description:

With Yarn and Npm, they specify in their docs that the package name must start with the prefix "create-".

What I would suggest on my side is to rename the package to be conventional. This could fix the problem.

charIeszhao commented 2 years ago

Thanks, @Olyno. That makes sense to me. @gao-sun Any thoughts?

gao-sun commented 2 years ago

Actually we do have a "@logto/create" package otherwise the command won't work in macOS and Linux. @charIeszhao are you using an old version of npm?

charIeszhao commented 2 years ago

lol, again?? Let me check it real quick...

Nope, it's 8.5.5 image

gao-sun commented 2 years ago

The "@" is for scoped package which follows another convention "@org/create".

Actually I registered "create-logto" but didn't published anything yet (just a package.json). Since I'd like to publish it automatically instead of manually creating another package with the same content of "@logto/create".

Olyno commented 2 years ago

Nevermind. As Gao said, it is possible to use the organization as a prefix for the "npm init" command. However, this would make the package exclusive to npm, and other package managers would be excluded (Yarn, Pnpm, Deno and potentially Bun).

Even if I understand that creating a package with another name is annoying, this seems to me to be the best thing to do (and therefore deprecated "@logto/create").

You can take the example of Redwood to see how they manage their packages.

gao-sun commented 2 years ago

thanks @Olyno, I'll take a look

gao-sun commented 2 years ago

@Olyno

for the traditional create-logto approach, rather than keeping it in sync of @logto/create, i think we can just print a error message and lead users to use @logto/create instead since all our packages are scoped.

how does it sound?

Olyno commented 2 years ago

The main problem is that the CLI does not work on Window. Creating a package under the organization (@logto/create) does not seem to fix this problem, quite the opposite.

I understand your concern about creating a package that doesn't contain the organization in the name, but I still think that this is the best way to fix the problem on Window, and make the package compatible under any manager package.

gao-sun commented 1 year ago

@Olyno thanks for the feedback and sorry for the delayed response. since i don't have a Windows dev environment, @charIeszhao would you like to have a try on this?