Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separating scripts into one file? #23

Closed
peteruithoven opened this issue Apr 16, 2016 · 2 comments
Closed

Separating scripts into one file? #23

peteruithoven opened this issue Apr 16, 2016 · 2 comments

Comments

@peteruithoven
Copy link

Is it possible to write all scripts in one file? I'm loving the idea of getting my scripts separated from the package.json config, having syntax highlighting and not having to quote-escape them, but I'm afraid that having all my scripts in separated files will make it too separated and hard to maintain.

Could I for example write a scripts/index file, like a explicit parent script, that also receives the script path that is being executed? Then I could write a switch statement to handle all scripts.

@searls
Copy link
Member

searls commented Apr 16, 2016

Thanks for opening the issue, but unfortunately I wouldn't support the inclusion of this feature. For what it's worth, writing your own module to accomplish this wouldn't be a tremendous task, I don't think. My reasoning follows:

I firmly believe that in file-system based code organization schemes (which is to say, nearly all of them), small, focused, and well-named files offer numerous substantive advantages over the apparent comfort of navigating one huge file that serves numerous purposes. The goal of scripty is to give users a low-friction way to extract scripts once they've gotten too long or too numerous to be easy-to-comprehend and maintain in a package.json.

It's for those reasons that a feature like the one proposed here wouldn't serve the goal of the package. It might salve some of the string-escape/newline pain you described, but it'd also introduce a layer of indirection. Additionally, for people otherwise familiar with scripty, it would produce surprising behavior when it was used ("where does this script live?"), requiring them to debug configuration and so forth to make sense of it. As it stands, it's pretty easy to see where a script is by looking at the file system, and this module should probably stay that way.

@searls searls closed this as completed Apr 16, 2016
@peteruithoven
Copy link
Author

Valid points, thanks for the response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants