-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
feat: scaffolding aurelia plugin project #1075
Conversation
After I noticed the PR, immediately wanted to give it a go. I was up and running in no-time (smart choice mentioning the
As a side note I want to definitely say that I'm really happy with this PR! Although I've only looked at it functionally, from developer/consumer perspective, the ability to create a simple plugin skeleton that handles the tough build elements is something I've been waiting a long time for. Hands down, for me one of THE most important features to hopefully get more users onboard with Aurelia. Or, at least, enrich the ecosystem in an easy and conventional way. Great work so far! |
@hanssens appreciated! There is one thing I forgot in this PR. You need to move all your "dependencies" to "devDependencies" in package.json. |
@EisenbergEffect for simplicity, what do you think about moving following two packages from "dependencies" to "devDependencies", not only for plugin project, but also for app project?
|
Seems like they should be direct dependencies for an app... |
My argument is app is not npm package, so it does not matter where you put thoses deps. Once the app is built, it has no “runtime” dependency. |
I will leave them in dependencies for app project. That was not an important simplification. |
@EisenbergEffect we will need a new doc page for writing Aurelia plugin. The plugin template readme has a link to https://aurelia.io/docs/plugins/write-new-plugin, I will compose a draft for the new guide, using cli to build plugin, covers the basics. After that, maybe some team member can jump in to enhance the guide to cover advanced topics, like registering new things to DI, using static class import (plus mandatory decorator on those classes) to load components. |
@huochunpeng That sounds great. Thank you for thinking of documentation 😄 Ping me on the docs PR and I'll merge it and then do an edit pass and publish. Then we can get some other team members involved to help expand it out a bit. @Vheissu has writing skills, so maybe he can jump in there. |
Question: following our default app setup, the default plugin setup also uses jest as default unit tests framework. Should we switch the default to karma for plugin project? Since we really want browser test for plugin. |
Everything is working great for me so far! Good work. Perhaps a sample stylesheet should be added to the component to avoid confusion for new folks? Doesn't need to utilize any feature of the selected pre-processor in my opinion. |
@CuddleBunny I was trying that yesterday. I will add a stylesheet after I cleanup module stub to support cli-bundler+jest setup |
@CuddleBunny css/less/scss/styl example is added to the custom element example, based on user's css preprocessor choice. |
@huochunpeng I just saw the docs PR. That is super awesome and very thorough. Thank you! I'll do an edit pass before publishing if that's ok with you. With that in place, are we ready to merge this PR, release the CLI and publish that documentation? |
Not yet, I am running release-check, the slowness is killing me... |
No problem. Ping me when it's ready and I'll merge both this and the docs PR. |
@EisenbergEffect passed all release-check on both windows and mac. This PR is ready for review. Please review The other thing is about the default choice of unit testing framework, which I asked in this thread. Should we switch default from jest to karma for plugin setup? |
We should probably have the default test framework be the same for apps and plugins, if possible. @huochunpeng Do you want to add that to this PR or submit it as a 2nd PR? |
If to modify default test setup for both app and plugin, better to do another PR. We will leave it as jest for now. It might be worth considering to switch default app from webpack+jest to cli-bundler+karma since built-in bundler is quite easy to use now. I don't know much about the story on the default webpack+jest, more opinion is needed. |
I personally don't care for Jest (for various reasons), so I'd prefer to use Karma. I don't know what the rest of the community thinks about that though. Whatever we do, I think both app and plugin scaffolding should use the same thing by default. |
We can push that decision to v1.1. Let's get a solid v1 release first. |
@huochunpeng Were you thinking that we'd do one more beta and then a 1.0? Or were you thinking we'd just go to 1.0 with this release. |
Definitely one more beta, with potential bugs to be fixed before v1. |
I'm pretty happy with this feature set :) Going 1.0 soon is also good timing for vNext. After it's out, we can start to look at CLI 2.0 as supporting vNext AoT and related scenarios. |
@huochunpeng @EisenbergEffect I recently made the choice to go with jest in our default setup at work.
I'm very happy with Jest so far, I struggled a bit with mocks at the start and had an issue with aurelia+scss but that's resolved now. |
For a DOM intense plugin, e.g I18N, typically Karma would be preferred. But with recent updates I made the switch to Jest as well. The thing is that Jest is neither the fastest nor the perfect deal for DOM based testing (JSDOM) but the support and ease-of-use is definitely so much better that its often worth the reduced feature set. One has to keep in mind though that tons of things have to be polyfilled for such cases. Since I expect most plugins being not too DOM intensive, I'd also argue jest is a fine default. If someone really needs to do more, doing a manual shift to Karma shouldn't be impossible. |
For what it's worth: another community-based +1 for Jest on behalf of me and my team. We switched to Jest a while ago, because of the aforementioned "ease-of-use". The convention-based, all-in-one setup is easy to start with and pretty much suits most basic needs out of the box. What was cumbersome with Karma is that we quickly had to rely on additional frameworks/libs like Mocha/Jasmine etc. for a full test experience. |
I am no fan of cumbersome karma either. But I like real browser. Personally I pipe bundled tests code directly to browser-run. |
@huochunpeng I can merge and release this today with the documentation update happening either today or tomorrow. Do you feel it's ready or do you want a specific person to do additional review before we move ahead? |
It is ready for me. :-) |
I've been using it, seems pretty solid to me. Great work! |
sorry for commenting on a closed issue, but its a minor suggestion and I'm not sure if its worth an issue: In a scaffolded typescript plugin project, I cannot import any exported members from the plugin in the dev app, because typescript cannot know the plugins module-name. Putting a path alias in tsconfig.json would solves this
Now I can import any exported members from the plugin in the dev app:
...and something noteworthy: I had some problems testing the dev app in the browser because window.process was missing. There is a hint in the docs about mocking this https://aurelia.io/docs/cli/cli-bundler/dependency-management#auto-tracing
And big thanks to this great feature! |
Thx @kennyfowler do you want to make a PR for that? |
@huochunpeng yes, I will do |
@kennyfowler if you don't mind, I used and acknowledged your fix in #1085 |
This enables
au new --plugin
(orau new project-name --plugin
) to scaffold an Aurelia plugin project. Closes #658.You can start testing this feature now with command
The README.md file in the generated project has more explanation on the project structure.
TODO