-
-
Notifications
You must be signed in to change notification settings - Fork 801
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
[legacy-framework] feat(cli): use custom template format instead of EJS #281
Conversation
This is looking much better!!
|
@flybayer I'm guessing the delay is because the gitignore isn't getting copied, the CLI is probably trying to do some processing to the whole tree, some of which is now things like |
Ok, delay is fixed and
Missing the dot |
@flybayer 🤦 i fixed that but had the commit stashed while resolving some conflicts. pushing it up now |
Okay I might be wrong but I think @Zeko369’s recent pull broke the ability to create new projects! $ /Users/dylan/dev/blitz/node_modules/.bin/blitz new aem-test
You are using alpha software - if you have any problems, please open an issue here:
https://github.com/blitz-js/blitz/issues/new/choose
You are not inside a Blitz project, so this command won't work.
You can create a new app with blitz new myapp or see help with
› Error: Not in correct folder
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
@merelinguist you're definitely correct. I'm going to open up a revert PR for that |
Thanks! |
Otherwise this all looks great, by the way 👍 |
@flybayer Looks grand to me, will let you merge. |
Type: Feature
Closes: blitz-js/legacy-framework#823
What are the changes and their implications? ⚙️
This removes our usages of the
.ejs
templating language and replaces it with a custom templating system. Since we don't actually use any templating functionality other than pure variable replacement, we can move frommem-fs-copy
'scopyTpl
function to the rawcopy
function which lets us supply a custom processing function. In our case, we just do global string replaces on any code that matches the__variable__
pattern with a variable that exists in the template.As an extension, we had to centralize the generation logic to ensure that each generator doesn't have to re-implement this logic themselves. This drastically simplifies each
Generator
subclass which now just needs to supply a template name, a subdirectory within the project where its files should be placed, and a function that will return the values to pass to the template. I was initially worried that this API would be a bit too abstract, but I've come to like the fact that creating a new generator is now more about writing up the template and less about writing generation code. There's of course an escape hatch which is just to override theasync write
function.Checklist
packages/server/src/log.ts
Breaking change: No
Other information