smogon / pokemon-showdown

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

Build on NPM install #9251

Closed Glazelf closed 1 year ago

Glazelf commented 1 year ago

Currently the project doesn't automatically build when installing the latest commit through npm and you would have to manually build it every time. I tried simply adding node build or npm run build as a script in the package.json under either install or prepare, but this brings up some issues running git ls -files. So I was wondering if someone with some more expertise on the project's structure could (help) fix this!

Edit: The latter part of this issue might be a duplicate of #9219 despite me running npm install within git bash. Edit2: This is not the case.

monsanto commented 1 year ago

This issue came up on Discord and was fixed a while ago, so please let us know if its still a problem

Glazelf commented 1 year ago

This issue came up on Discord and was fixed a while ago, so please let us know if its still a problem

Whenever I run npm install, no dist folder is created. Unless it builds different as a npm module, this means it's not building correctly, right? Even after deleting the module and running npm update, still nothing. Maybe I'm missing something obvious haha but I don't think it's working as intended. Please do let me know if it's a mistake on my end.

image

mia-pi-git commented 1 year ago

This issue came up on Discord and was fixed a while ago, so please let us know if its still a problem

Whenever I run npm install, no dist folder is created. Unless it builds different as a npm module, this means it's not building correctly, right? Even after deleting the module and running npm update, still nothing. Maybe I'm missing something obvious haha but I don't think it's working as intended. Please do let me know if it's a mistake on my end.

image

Installing through npm is very out of date, so it's built using sucrase before it's published to npm. You should be looking for the .*-dist folders, (one for each TypeScript folder in the project).

Glazelf commented 1 year ago

This issue came up on Discord and was fixed a while ago, so please let us know if its still a problem

Whenever I run npm install, no dist folder is created. Unless it builds different as a npm module, this means it's not building correctly, right? Even after deleting the module and running npm update, still nothing. Maybe I'm missing something obvious haha but I don't think it's working as intended. Please do let me know if it's a mistake on my end. image

npm install is very out of date, so it's built using sucrase before it's published to npm. You should be looking for the .*-dist folders, (one for each TypeScript folder in the project).

It seems like as of more recently the folders are built into subfolders within the dist folder instead of the .*-dist folders from before.
Regardless, I'm using npm install to install github:smogon/pokemon-showdown#master so it should install and build the latest commit on the master branch of this repository. It seems to be getting the latest files fine, it's simply not building. Neither into .*-dist folders, nor into one dist folder. Downloading the repo manually and building it as its own git repo works as intended, it just doesn't want to build as an npm module.

mia-pi-git commented 1 year ago

It seems like as of more recently the folders are built into subfolders within the dist folder instead of the .*-dist folders from before. Regardless, I'm using npm install to install github:smogon/pokemon-showdown#master so it should install and build the latest commit on the master branch of this repository. It seems to be getting the latest files fine, it's simply not building. Neither into .*-dist folders, nor into one dist folder. Downloading the repo manually and building it as its own git repo works as intended, it just doesn't want to build as an npm module.

Ah, yeah, we don't have a postinstall script since the module is built before publishing to npm. Just manually cd to it in node_modules and run node build.

Glazelf commented 1 year ago

It seems like as of more recently the folders are built into subfolders within the dist folder instead of the .*-dist folders from before. Regardless, I'm using npm install to install github:smogon/pokemon-showdown#master so it should install and build the latest commit on the master branch of this repository. It seems to be getting the latest files fine, it's simply not building. Neither into .*-dist folders, nor into one dist folder. Downloading the repo manually and building it as its own git repo works as intended, it just doesn't want to build as an npm module.

Ah, yeah, we don't have a postinstall script since the module is built before publishing to npm. Just manually cd to it in node_modules and run node build.

Would it be possible to add that? Manually building on production is kind of annoying. :P
Not a big deal it would just be a nice qol improvement.

mia-pi-git commented 1 year ago

Would it be possible to add that? Manually building on production is kind of annoying. :P Not a big deal it would just be a nice qol improvement.

Sure.

Glazelf commented 1 year ago

Sure.

Oh haha thanks. I expected that to be more complicated.
It seems however that config-example.js is not included in the npm package? It is in the repo but when installed it doesn't seem like the file is included in the module(?). Building the module or installing the 35420b5a5e1e05003e6908b0ce5758086d415089 will give the error (log) as shown below:

2023-01-05T15_45_19_173Z-debug-0.log image