matcha-devs / matcha

A comprehensive web-based personal finance tracker and budgeting tool.
6 stars 0 forks source link

os-based-fsevents-dep #44

Open FaaizMemonPurdue opened 2 months ago

FaaizMemonPurdue commented 2 months ago

Rationale

tailwindcss throws error messages on Mac (darwin) if "fsevents" not present, have to manual install it. but fsevents fails on non-Mac. avoid unsynced package.json by making it optional for non-Macs, hopefully this makes it install on Macs. Also, making things work off npm install without needing to do manual, no-save installs is nice.

Usage

just run npm install (regardless of OS), do not need to manually npm -D install tailwindcss

Changes

Non-trivial Files

package.json

Testing

On my Linux device, this silently skips fsevents:

faaiz@pop-os:~/GolandProjects/matcha$ npm list 
matcha@ /home/faaiz/GolandProjects/matcha
├── UNMET OPTIONAL DEPENDENCY fsevents@^2.3.2
├── live-server@1.2.2
└── tailwindcss@3.4.5
faaiz@pop-os:~/GolandProjects/matcha$ node
Welcome to Node.js v20.6.1.
Type ".help" for more information.
> const fs = require('fsevents')
Uncaught Error: Cannot find module 'fsevents'
Require stack:
- <repl>
    at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '<repl>' ]
}

We absolutely need a Mac to re-run npm install and test these commands do install fsevents.

Dependencies

fsevents made optional per OS

Documentation Changes

Issues and Bugs

If legitimate error occurs installing fsevents on mac, this may fail silently. "overrides" also might have unknown consequences

Possible Solutions

Hopefully, the tailwindcss error messages make it obvious if fsevents failed to install, at which point you can run:

npm install fsevents@^2.3.2 --no-save

Additional Notes

As far as I know, there's no generally accepted npm method to accomplish this. Running install scripts from package.json is considered an anti-pattern; there is a package to do this run-script-os, but we'd be pulling in a new dependency around selective install of a single dep.

FaaizMemonPurdue commented 2 months ago

need the mac testing to confirm exactly what failure output is at each step for documentation

FaaizMemonPurdue commented 2 months ago

testing on andrea's computer, it left the fsevents uninstalled :(

FaaizMemonPurdue commented 2 months ago

Andrea computer running odd (maybe because conda environment) @CarlosACJ55 pls pull, ensure no package-lock.json, and run npm install then npm build-css