smogon / pokemon-showdown

Pokémon battle simulator.
https://pokemonshowdown.com
MIT License
4.77k stars 2.79k forks source link

Update the npm package #9428

Closed Wazbat closed 1 year ago

Wazbat commented 1 year ago

Hi there! I was trying to install the package locally on my machine, however I keep running into typescript compilation errors.

I asked around on the Typescript discord, and after investagion we found that the issue was due to this export in this file

// node_modules/pokemon-showdown/.sim-dist/index.d.ts
export * from '../lib';

However this issue appears to have since been fixed in this repository, and just requires being published to npm

mia-pi-git commented 1 year ago

Hi! We would advise using a github: dependency in your package.json instead of depending on the NPM package. (the NPM package is not currently maintained and is about two years out of date)

Wazbat commented 1 year ago

I did try that, however I run into issues both on windows and linux when installing that way

{
  "dependencies": {
    "pokemon-showdown": "github:smogon/pokemon-showdown#7030687f1c09ff1f359448272affa098e57372e5"
  }
}

image image

I can try to fix these given some time, but would it not be possible to some day re-publish this as an npm or github package? If necessary I can try to raise a PR to add the necessary CI for the latter

monsanto commented 1 year ago

Copying my response from another repo:

I'm not opposed to releasing an NPM package of any of the repos in this organization, but it has to be zero overhead for our organization. So that probably means no meaningful semver (0.x?), and an automated build & upload process as part of GH actions. Or it could be a git branch on here that has the results of a build, which would save us the trouble of maintaining a different set of credentials. If someone wants to work on that then you have my blessing and thanks.

Wazbat commented 1 year ago

I could open a PR to configure github actions to deploy to github packages which would mean no additional credentials or anything. Could just use github releases for that too, so all that would be necessary is the creation of a release and it'd automatically build and upload

I can do that if you're ok with occasionally creating releases in GH

monsanto commented 1 year ago

Thanks for looking into this.

I can do that if you're ok with occasionally creating releases in GH

I don't care that much what we use as long as it is convenient to use from npm and is fully automated. So if I have to sometimes go through the UI to create releases, then that's a no go. But if there's a separate timer making releases then that's OK too.

Wazbat commented 1 year ago

So if I have to sometimes go through the UI to create releases, then that's a no go. But if there's a separate timer making releases then that's OK too. Oh the idea I have for release creation would just be creating a release via the https://github.com/smogon/pokemon-showdown/releases page which is just a few steps draft a new release -> increment version by 0.0.1 -> auto generate release notes -> create release.

But even that can be automated with a scheduled github actions to just create a release on every commit... Though that wouldn't really be the best way (could just manually create a release once a month or something as it's only 4 clicks in the UI)

Regarding installing the package via npm, you can use github packages as I said before, however it appears that to actually install even a public package you need to create a personal GH token, so it might be best to just publish to npm again, via this automation.

However to publish to NPM all that's needed is an NPM token which would be stored as an encrypted repository secret that noone can read, if you're ok with that I can open a PR with the necessary CI to allow for automated publishing on releases (manual or scheduled) image

TLDR:

I can automate it all so there's no manual input, all I'd need is someone to create a repository secret with an NPM access token to publish to npm

monsanto commented 1 year ago

A PR publishing to NPM sounds good. I'll figure out the token

Wazbat commented 1 year ago

Ah perfect. I'll try to work on that soon then. And once you manage to create a token you can just create a repository secret for it. image

Stagory commented 1 year ago

Hi all, since there is no updated version of the npm package, is there a manual that describes how to install and use the current repository? If I'm trying to build the project I run into 1106 errors in 11 files. tsc image

Zarel commented 1 year ago

I tried building the latest version in the repository, and while it works like before, it still doesn't have TypeScript types.

(Just a warning for anyone who's trying to solve TypeScript errors by building a new version.)

Stagory commented 1 year ago

Okay, my mistake was that I had an outdated version of Node.js installed when building the repository

Wazbat commented 1 year ago

I tried building the latest version in the repository, and while it works like before, it still doesn't have TypeScript types.

I was under the impression that wasn't the case? Someone was trying to help me figure out why I was getting errors, and for them using a GitHub sha worked as it had since been fixed. Installing via github:smogon/pokemon-showdown#7030687f1c09ff1f359448272affa098e57372e5 and using "skipLibCheck": true seems to work ok

Zarel commented 1 year ago

I suppose we'll find out when we release the next version.

Dirain1700 commented 1 year ago

What about auto-publishing/auto-deprecating with the tag dev on npm? it is useful, and easy to make it (tbh i have it and using, it is nice)

Dirain1700 commented 1 year ago

Reffering to my previous comment, now I have a action to publish a package with dev tag, can I open a PR?

Glazelf commented 1 year ago

Hey! This Pull Request looks very good. However, I'm still having an error when installing this module. A screenshot and log of my error can be found below: image 2023-04-13T14_47_21_932Z-debug-0.log

Zarel commented 1 year ago

@Glazelf yes, we're aware of and working on it.

Also, I was correct about the TypeScript types.