-
Notifications
You must be signed in to change notification settings - Fork 251
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
Add composability convention, WIP #28
Conversation
Switched up the [
{
"action": "clone",
"src": "my-org/project-scaffold"
},
{
"action": "remove",
"files": [
"CONTRIBUTING.md",
"DCO.md",
"LICENSE",
"CHANGELOG.md"
]
}
] |
All set minus tests. |
Added tests via mhkeller@a8a29c8 and mhkeller@7f7e201 plus some other edge case stuff. The only question I have left is what to do about README.md files. I could see both someone wanting a README.md in their repo that contains a Maybe it's an option on the clone action such as:
That way if you're cloning multiple you could decide which readme you want. The only problem I could see is if you're cloning a repo that is also a |
wooot!!! 🎉 Added a README section and released 2.1.0. I'm not sure about |
Actually, the use case I described would be easily handled by doing a |
This PR adds a convention whereby you can modify a repo post-clone in a safe way, or combine two repos, which is neat because you can start to create variations on a scaffold in a modular way. It's a work in progress with some TODOs noted at the bottom and I'm open to other ideas on how it should work! This is a proof of concept that seems to cover my use cases for it so seemed like a good starting point to see if it's worthwhile to include in this project.
How it currently works
Let's say you do
degit mhkeller/degit-example
where that repo contains only a file calleddegit.json
that looks like the following, it will clone down the specified repo and then remove the specified files.If you have other files in
mhkeller/degit-example
, they will be written on top of the cloned repo. IN this way, if you want to include your own README.md, you can include that in the repo you rundegit
on and they'll appear in your local directory when all is done running.TODO / questions
File copying and removing should support directories also. The lazy option would be to use fs-extra but can also do a vanilla implementation (or copy the good bits from fs-extra)Done via sander in 688a390 d0639f2warn
event to warn when you want to remove a file that doesn't exist. It's magenta. Seems like a good idea??Not sure ifAdded the name indegit.json
is the best naming convention. Open to others or for it to be configurable, it's currently hardcodedsrc/utils.js
so it's more configurable.Similarly, maybe json isn't the best format. Maybe yaml, or maybe it looks forKeep it as json for nowdegit.json
and thendegit.yaml
/degit.yml
if it doesn't exist?Maybe the format ofAdd composability convention, WIP #28 (comment)degit.json
as a list of actions is not flexible for other or future options. Maybe it should be an object with aactions
as a list but allow for other top-level options that I haven't thought of?