Hi all, recently I’ve gotten into p5js and have been really enjoying it. Thing is, I don’t come from a web development background. I’m used to languages like C# and Go with all of the built in intellisense, tooling, and package managers. Moving from this to JavaScript was painful.
However, Typescript offers a solution to this problem. It adds type safety, built in documentation, and better auto complete / intellisense. I don’t think its an understatement to say my productivity has improved by at least a factor of 3 since using it.
Getting P5 up and running in a TypeScript environment that supports es6 imports for use with npm was a surprisingly difficult undertaking for me. So I figured I could share what I’ve come up with as a resource for anyone else looking to do the same.
Also if anyone has any feedback on the template I’d be happy to hear it. I’m not really a web developer so its possible I’ve made some sub-optimal decisions.
Thank you for sharing the repository! While experienced users may find it straightforward, novice programmers may find it a bit challenging.
I think, one downside of npm is that it requires a lot of disk space, which can be unsustainable. Even though all the magic happens in just 1-3kb of js file, npm makes it huge like 300-400 Mb.
Perhaps, you can create a tutorial that shows how to install dependencies globally to the system, which will help to deal with unnecessary disk space as an option. Personally, I prefer using global packages as they make things easier to create new projects and reduce the amount of disk space required.
I like the following feature. It would be good to point users to a tutorial on how to publish Github pages.
…start a github pages site pointing to the dist folder.
This is also handy niche feature;
If you want this repo to be a nested page in a website npm start_nested will use relative paths for all assets.
@micuat, @GoToLoop, I had problems before using pnpm in a project that also includes parcel. I’ll check again to see if the conflicts have been resolved.
While a bit annoying I’ve never personally found the node_modules size to be much of an issue. Storage is cheap and the benefits of a package manager far outweigh the cost, at least to me. But like other’s have pointed out, pnpm should be a drop in replacement that more intelligently handles storage. Though I’ve never personally tried it.
Each single challenge folder from this repo installs relatively big-sized “node_modules” folders:
Each 1 of those “node_modules” folders contain 1977 subfolders w/ 17820 files inside!
Total size for each “node_modules” is 47.5 MB, but occupies 65.5 MB of disk.
So far I’ve got 75 Exercism.org challenges done, which is 65.5 MB x 25 = 1637 MB of disk!
It doesn’t seem that much, but still, b/c pnpm uses hardlinks & junctions, no matter how many new challenge folders I add, each 1 is gonna re-use those same 17820 files rather than re-creating them!