reuters-graphics / bluprint

Dead-easy application scaffolding and CLI.
MIT License
7 stars 2 forks source link

New feature proposals #21

Open jarib opened 2 years ago

jarib commented 2 years ago

Thanks for this project, exactly what I've been looking for πŸ‘

I would like to propose the following features. Would you accept PRs for any of these?

1. Read bluprint from a local directory

Perhaps I've missed something, but it seems any bluprint changes must be pushed to Github before you can test it? This is quite frustrating when developing new bluprints, especially since github.com seems to do a bit of caching that is hard to get around.

It would be nice to run bluprint start ../my-bluprint without having to commit every change.

Alternatively git archive to get a tarball or by adding support for git daemon to the hosted-git-info package.

2. Allow .blueprintrc.js

It would be useful to have the ability to execute JS inside this file. E.g. for my render actions I would like to have the current year in the context:

context: { year: new Date().getFullYear() } 

The only solution to this I've found is to switch from mustache to ejs and execute the JS line as part of the templates.

3. Allow templated execute actions

E.g.:

"cmds": [ ["git", ["remote", "add", "origin", "{{ org }}/{{ year }}-{{ slug }}" ]] ] 

4. Custom actions from the template repo

Not too sure about this one, but the ability to have custom actions in the bluprint repo itself would really make anything possible in terms of customization.

hobbes7878 commented 2 years ago

Hiya & thanks!

I think the answer to most of these is yes.

Re 1., I think if we make that feature maybe we expose a separate command? bluprint test ./local-path/ or something?

On 2., we'd just need to gracefully fallback to json as the minimum requirement to be a valid bluprint. There are also a few places we presume a JSON config file so we can verify a repo is a bluprint that would have to be unwound.

On 4., I can tell you we often use execute actions for this use case, for example, running local node scripts like this. I think that should cover what most folks would need in terms of template specific actions.

jarib commented 2 years ago

Great!

I think 1. is the highest priority for us, so will begin with that.

Good point on 4. That solves what I was trying to do.

However when using local node scripts I noticed that the exit code from execute actions is ignored. Perhaps we could change that? As it would be a breaking change, perhaps it would have to be explicitly enabled:

"action": "execute",
"abortOnError": true,
"cmds": [ … ],
jarib commented 1 year ago

@hobbes7878 Any interest in feature 1. here? See https://github.com/reuters-graphics/bluprint/pull/30