-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
(potential intent to rfc): ember apply
#783
Comments
This is an interesting idea, but I'll note that it doesn't need to be integrated into Ember core at all. Since addons can supply commands, you could simply write |
oh, I like that idea. however, that prevents the possibility of |
It already has support for applying blueprints, I believe? It’s just a longer form than people typically type. |
A few things that jump out at me on first read:
|
I like this idea. The name for apply sounds like a recipe name and ember apply cooks takes the ingredients and applies the "instructions". So Could imagine something like this to exist. I wouldn't need this to be part of |
I only took a quick look but this seems similar to preset. It might be better to go for a framework agnostic solution (if possible) instead of creating something custom for Ember projects? |
Oh legit, i hadn't heard of preset. Gonna prototype with that. |
The first thing that jumped to my mind was how is this actually different from a regular blueprint? You can do basically all the things you listed above in a blueprint. For some there is built-in support (like adding addons or regular npm packages), for some you would have to write custom node code run from e.g. the For cases where you would like better high level support, like adding AST-based updates to existing files (e.g. things like what
Yeah, when a recipe is basically an addon, you don't need a centralized place to store recipes, everybody can create recipes. But then even more the question arises what makes a recipe special compared to a regular addon (that has a default blueprint). It seems to me the only thing that is fundamentally different is that when the recipe is really just a "meta addon" (it itself does not have any build-time or runtime code, or dependencies that are need for the app), then you don't want to have it added to your Again, all the other possible convenience features like codemods etc. either have to be done manually (as of today), or eventually become features of blueprints in general, regardless of whether this is Does that make sense? |
it does, I mostly find the blueprint APIs immensely inconvenient to use. |
One thing I've heard (but not personally verified) is that the existence of every addon makes Replacing included commands a single |
I like this API better than the blueprint api: export default async function run(workingDirectory) {
await addDevDependencies({
autoprefixer: '^10.0.0',
postcss: '^8.0.0',
tailwindcss: '^3.0.0',
});
await applyFolder(path.join(__dirname, 'files'));
await addHTML(
'app/index.html',
`<link integrity="" rel="stylesheet" href="{{rootURL}}assets/tailwind.css">`,
{ before: 'link' }
);
await addHTML(
'tests/index.html',
`<link rel="stylesheet" href="{{rootURL}}assets/tailwind.css">`,
{ before: 'link' }
);
await addScripts({
'tailwind:build': 'npx tailwindcss -i ./tailwind-input.css -o ./public/assets/tailwind.css',
'tailwind:watch':
'npx tailwindcss -i ./tailwind-input.css -o ./public/assets/tailwind.css --watch',
build: 'npm run tailwind:build && ember build --environment=production',
});
await gitIgnore('public/assets/tailwind.css', '# compiled output');
} easier to debug, imo. today, blueprints only really do:
but what I don't have (and maybe don't care for?) is the parameterization via ERB?) also, dat speed: ❯ time node ../../NullVoxPopuli/ember-apply/src/cli/index.js tailwind
real 0m0.180s
user 0m0.198s
sys 0m0.028s |
Just tried integrating my stuff with
obvs, these things can be addressed, but I think we can do better / simpler |
In my personal opinion, it sounds like this would be easier to manage at the documentation level. Basically add a recipes section to the docs. There are always going to be gnarly stuff, and writing + maintains this in code, instead of text, will be more work. Also, the threshold for contributions is higher. Anyone can PR doc-changes, far fewer people are skilled (and read-in) enough to contribute code changes. |
I think that makes sense. Code can always mirror documentation better than the other way around. Gonna close this since https://github.com/NullVoxPopuli/ember-apply Thanks all! Excited for the cookbook RFC! |
I kinda what to see how folks feel about this before I write anything up, but during discussions with folks on adding fastboot-ability in the ember-cli blueprints (opt-in, etc etc), the possibility of applying features incrementally came up. such as
ember apply ssr
. This is similar to what we've historically used install-blueprints for, but without the developers needing to know what packages to install. This would formally adopt a "default way" to do certain things -- and I want to emphasize default, because it's not to totally replace existing ways of doing things. For example, should I write an RFC for this, an example would be:and would setup tailwind with some default / easy way of interacting with tailwind (my preference with be either this or this).
Goals:
ember new
Non-Goals:
apply
for addons (or instead we'd setup which integrations are for apps and which for addons)tailwind
,ssr
,sass
, maybepwa
, etc would have to be separate RFCs to discuss trade-offs with different "default" configurations)So, what's an example of this look like?
Using the example
ember apply tailwind
(since I'm very familiar with this)tldr:
Why:
Details:
This is kind of an outline with semi-psuedo code, because the implementation details would require some additional APIs / tooling that would be a part of this
apply
RFC in order to makeember apply tailwind
's implementation niceWhen
ember apply tailwind
runs:(it automates the tailwind setup docs)
add dependencies:
add new files:
await addFile('tailwind.config.js', content);
tailwind.config.js
await addFile('postcss.config.js', content);
postcss.config.js
await addFile('tailwind-input.css', content);
tailwind-input.css
add
scripts
topackage.json
await addScript(
tailwind:build, 'tailwindcss -i tailwind-input.css -o public/assets/tailwind.css');
await addScript('tailwind:watch', 'tailwindcss -i tailwind-input.css -o public/assets/tailwind.css --watch');
add to the
.gitignore
public/tailwind.css
, since it is a generated file and canchange frequently
await gitIgnore('# compiled output', 'public/assets/tailwind.css');
link the tailwind output in the html files so that the app loads it -- example
tests/index.html
When
--tailwind
is added toember new my-app
Thoughts?
The text was updated successfully, but these errors were encountered: