Additional actions
See original GitHub issue2.1.0 brings the concept of actions — see #28.
So far we have clone
and remove
. I can think of a few others that might be useful:
rename
— for moving files out of the way to prevent them being clobbered by clonereplace
— for replacing placeholder stuff in particular files, such as this TODO. Would need to come after a…prompt
— get some user input. terkelg/prompts has some nice conventions we could adopt.
So you could do this sort of thing:
[
{
"action": "prompt",
"questions": [
{ "type": "text", "name": "name", "message": "What is the project name?" }
]
},
{
"action": "replace",
"delimiters": ["<<", ">>"],
"values": ["name"],
"files": ["package.json"]
}
]
then if you had a package.json like
{
"name": "<<name>>",
...
}
it would get filled in. Not fully baked (maybe the replace
action should run in the context of the prompt?) but you get the idea. cc @mhkeller if you have thoughts
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:19 (2 by maintainers)
Top Results From Across the Web
Additional action | Final Fantasy Wiki - Fandom
Additional actions, colloquially known as cross-class skills, are abilities in Final Fantasy XIV. They are abilities that can be used by multiple ...
Read more >Import additional actions into Automator on Mac - Apple Support
Copy the action or actions you want to add to your Mac. Open Automator. Open Automator for me. Choose File > Import Actions....
Read more >Viewsets - Django REST framework
Routing additional HTTP methods for extra actions. Extra actions can map additional HTTP methods to separate ViewSet methods. For example, the above password ......
Read more >How to set up 'Additional Actions' and 'Also request for' list on ...
Procedure · Navigate to any page with "SC Order Status" widget. · Press Control key + Right Click to get service portal menu....
Read more >Extra Actions - FireGiant
Extra Actions ; ScheduleReboot After · 'InstallFinalize' /> ; ScheduleReboot After · 'InstallFinalize'>Version9X</ScheduleReboot> ; Custom Action · 'LaunchFile' After ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have made a project scaffolding project that I use all the time when I need to test something quickly. It contains the set of tools that I find myself always copying around anyway. It’s already really useful, but I’ve had to include a self removing script into it, to do the bootstrapping. It can be seen here: https://github.com/gustavnikolaj/template-node
That means that I have to run it like so:
All I do in that script is to run some actions that execute npm commands to configure test and linting tools etc. As an example; I don’t want to depend on a fixed version of say eslint, so instead of including it in a package.json file in the
degit
source repo, I run a command at install time that installs the latest version of it.The same thing goes for package.json - if I include it in the repo, I’d have to go in and update it after setting it up - but running
npm init -y
in my bootstrap script does the right thing (picking information about the writer from git config, and picking the name of the package from the folder).The obvious way of integrating this behavior would be to allow an action type that allowed the module to include such a boostrap script.
I understand why you might not want to allow arbitrary command execution, but maybe it would be okay if we required the user to answer
y/N
in a prompt before execution.Another solution could be to add an action that would allow you to execute commands in the context of the directory.
That would cover most of my use cases. I would also like a way to transform files after the fact though. Something that would allow me to define a script target in the package.json file that got created after running the
npm init
shell command.I don’t know how to do that with declarative actions, but maybe someone else has an idea? 😃
I’m happy to contribute PRs for any of these features if we can reach something that would work for us. I use my template project enough to justify improving it a little, and removing some of the ugly hacks 😃
I was in need of this for rapidly creating some packages, so I made a wrapper over degit for this purpose specifically. it doesn’t have the “exec” action proposed here to avoid the security issues mentioned, thought it might be useful to some other people checking this thread (like me).