neuroanatomy / thresholdmann

A tool to apply a smoothly varying threshold to a nifti image
https://neuroanatomy.github.io/thresholdmann/index.html
ISC License
3 stars 2 forks source link

[joss][package structure][nice to have] Refactor into `src`-like directory structure? #21

Open sneakers-the-rat opened 6 months ago

sneakers-the-rat commented 6 months ago

Part of: https://github.com/openjournals/joss-reviews/issues/6336

Not a requirement of the review, but a nice-to-have:

Currently the project is structured s.t. the public assets/pages/etc. are in the same top-level directory as the tests and package metadata. Would be nice to make a clearer distinction between what is intended to be deployed on a web server/run locally vs. what is intended to be used as support. this is partially cosmetic, but would also be important for extensibility/maintainability later, as eg. adding more test cases that an http server would be serving could be undesirable if they exposed some vulnerability to the host machine.

So that would look something like

.eslintignore
.eslintrc.js
.gitignore
Contributing.md
LICENSE
package.json
...
src
  index.html
  thresholdmann.css
  thresholdmann.js
  ...
  img/
  render3D/
tests
  test.mjs
  fixtures.mjs
  data/
  ...
katjaq commented 5 months ago

Thank you for pointing this out and your suggestion. We were actually happy to do this at first, but then we realised it is maybe better in our case to keep it this way, and should not be too problematic? We're currently serving thresholdmann from /(root). Checking the Github Pages settings, there doesn't seem to be an option to serve the website from a folder that wouldn't be either /(root) or /docs. We could keep only index.html at /(root), all the website files at /src, and all the test files at /tests. That would work around this issue, but defeat the purpose of the restructuring. 🙈 We also would like to avoid links to our tool such as https://neuroanatomy.github.io/thresholdmann/src/. So, weighting the benefits and possible implications, being happy with serving from Github pages, we would prefer to keep the current structure of the code. Does it sound reasonable @sneakers-the-rat ?

sneakers-the-rat commented 5 months ago

ooh yes! this is another thing that the webpack stuff can help with - since gh pages are just gh actions now, you can make an action that builds the site to a branch and then deploys from there so you have more control over the structure of your source directory.

We also would like to avoid links to our tool such as https://neuroanatomy.github.io/thresholdmann/src/.

most definitely a higher priority!!!!

this was mostly just a "would this be nice for y'all?" issue, so no worries about keeping it this way.

here's a super trivial example of building something with sphinx and deploying to gh pages - https://github.com/p2p-ld/docs/blob/main/.github/workflows/sphinx.yml

yours would be even simpler since it's ready-to-roll JS

name: Deploy
on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    permissions:
      contents: write  # To push a branch 
    steps:
      - uses: actions/checkout@v3
      - name: deploy to gh-pages
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          folder: src

but again only do that if it's easier for you to tend to your code!

katjaq commented 5 months ago

Thank you very much @sneakers-the-rat . This sounds good. For the moment, we would like to keep things as they are, and once we will look into the PR that you so kindly drafted for starting the packaging, moving to actions here will become interesting.

sneakers-the-rat commented 5 months ago

Up to you, feel free to close this if youd like.