ember addon の使い方について確認
イシュー
- ember-cli のaddon がうまく動かない
- そもそものaddon の使い方が分かっていないので、公式サイトのヘルプを読む
参考
ember addon ウォークスルー
Addons make it possible to easily share common code between applications. However, if an addon only covers a very project specific use-case, an In-Repo Addon could be considered instead.
This guide will walk through the development cycle of a fictional addon ember-cli-x-button.
- アドオンは、アプリケーション間で一般的なコードを共有することを簡単に可能にします。
- しかし、もしアドオンが非常にプロジェクト特有のユースケースをカバーしていた場合は、代わりにIn-Repo アドオンを考慮したほうがよいです。
- このガイドでは架空の ember-cli-x-buttonの開発サイクルをウォークスルーします。
アドオンの検知
Ember CLI will detect the presence of an addon by inspecting each of your applications dependencies and search their package.json files for the presence of ember-addon in the keywords section (see below).
"keywords": [ "ember-addon", ... ]
- Ember CLIは、アプリケーションの依存関係をそれぞれ検査したり、キーワードセクション(下記参照)内の ember-addon の存在について記載されている package.jsonファイルを検索したりすることによって、アドオンの存在を検出します。
アドオンのシナリオ
Addon scenarios The Ember CLI addons API currently supports the following scenarios: Performing operations on the EmberApp created in the consuming application’s Brocfile.js Adding preprocessors to the default registry Providing a custom application tree to be merged with the consuming application Providing custom express (server) middlewares Adding custom/extra blueprints, typically for scaffolding application/project files Adding content to consuming applications
- Ember CLIのアドオンAPIは、現在、次のシナリオをサポートしています。
- 使用するアプリケーションのBrocfile.js により作成されたエンバーアプリ上で操作を実行します。
- デフォルトのレジストリにプリプロセッサを追加します。
- 使用するアプリケーションとマージされることによってカスタムアプリケーションツリーを提供します。
- カスタム express(server)ミドルウェアの提供します。
- 一般的にアプリケーション/プロジェクトファイルをscaffoldのために、カスタム/おまけのblueprintを追加します。
- 使用するアプリケーションへのコンテンツを追加します。
ember new と ember addon
- ember new は一般的なアプリケーションを作成するために使用
- ember addon は、アドオンアプリケーションを作成するために使用
- ember addon で作ったアドオンは、ember install を使用して、一般的なアプリケーションに追加できる
- Creating a Datepicker Ember Addon - edgy circle