testdouble / scripty

Because no one should be shell-scripting inside a JSON file.
MIT License
963 stars 23 forks source link

In MAC, may be unenforceable directory, how can do before running scripts, automatically run chmod + x scripts/path/to/my/script #117

Open laterdayi opened 1 year ago

laterdayi commented 1 year ago

In MAC, may be unenforceable directory, how can do before running scripts, automatically run chmod + x scripts/path/to/my/script

Whether a pre-run hook function is provided

laterdayi commented 1 year ago

In many cases, you're not sure if scripty won't run because it has insufficient permissions, and if scripty can provide a hook that gives you permissions manually or automatically before you run Scripty

laterdayi commented 1 year ago

@searls @jasonkarns @rosston Look forward to help

jasonkarns commented 1 year ago

I'm not sure I understand the issue. The script that scripty is invoking should generally be versioned with the package and so should be committed with execute permissions.

laterdayi commented 1 year ago

On mac, the node_modules/* dependency may not have permission the first time a clone project is installed, but "prepare": "scripty" will cause the run to fail ,

So is there a hook or function that can manually or automatically grant executable permissions to node_modules/* before running 'prepare' : 'scripty' or scripty

laterdayi commented 1 year ago

@jasonkarns

laterdayi commented 1 year ago
  "config": {
    "scripty":{
      "path":"node_modules/*/scripts",
      "windowsPath":"node_modules/*/scripts-win"
    },
  }

When I set the scripty path to an npm package A and I install A, scripty may be inaccessible

jasonkarns commented 1 year ago

On mac, the node_modules/* dependency may not have permission the first time a clone project is installed,

I (and most of the devs who have worked on scripty) use mac, and have never had this issue. Under what circumstances would a project's clone not have permission to execute?

Which version of npm are you using? I recall in old versions of npm, many of the install hooks (preinstall, install, prepare) would have race conditions between the hook scripts and dependency installation. It was not possible to rely on dependencies (like scripty) being installed prior to the hook scripts running.

Judging by the documentation for npm 9 (I haven't tested again myself), they seem to indicate that dependencies are now installed prior to running these hooks.