mliebelt/pgn-parser

Define better file structure for project

mliebelt opened this issue · 4 comments

The project files have grown lately, and we have to rethink how things should be organized:

  • Do we need one exported file then that includes everything? Will be bigger than needed for some people ...
  • Provide the chunks of functionality, but as single files: parser, splitter, clean.
  • Define a build process that
    • Generates first the sources by using peggy
    • Then use the generate in a (webpack) build step to generate the one or multiple library files.
  • Define what should be included in the npm install. This should not include examples, similar to test code ...

The current status is not ok, there are too many files in a distribution.

Maybe next week I can provide some input on this as we are finalizing our node/browser package. I know there are tools to do what you want but your package is much smaller than most. Maybe just restructure for now and thing about splitting latter.

That may all be ... From time to time you have to cleanup, and I think now is the time to do it. There is no pressure, because (in my opinion) the parser is more or less feature complete, so it is ok to restructure it a little bit. I think having only one file at the end is not flexible enough, but 3 (parse, split, clean) may be appropriate.

And if you have some experience in doing this, well! I would else use the experience of my PgnViewerJS, but of course much smaller.

I was planning to take a look at PgnViewerJS this weekend. For something like that I would typically containerize it. Then you'd literally have a single command to run, something like docker run -dp 80:80 mliebelt/pgn-viewer. This leads to things like running it on a Synology NAS https://www.synology.com/en-us/dsm/packages/Docker with ease. But yes, I can help. I'm really DevOps which is just a fancy word to say I know way to much about a lot of things but not enough about most of them. Jack of many, master of none.

By switching to Typescript and following some of the normal rules there, the file and directory structure is mostly done:

pgn-parser
  bin - for build and other scripts
  doc - for documentation
  lib - contains at the end the files generated, that are then used in the library. 
         Currently the only files included in the package published then (besides README.md and LICENSE)
  node_modules
  src - the Typescript source files, and generated `pgn_parser.js`.
  test - the Typescript test files
  CHANGELOG.md, LICENSE, package.json, package-lock.json, README.md, tsconfig.json are all regular 
        and ok. The 2 example files are (at most) part of the documentation.

The README.md has to shortened again, grown too much lately. Sections to shorten:

  • How to use it? Shortest example possible, not such a complex one. Could be moved to the doc directory then.
  • Alternative would be to have a separate USAGE.md file for all the different examples of using the parser.