Ember CLI "Blueprint" for Creating an Addon

140 views Asked by At

I have been wanting to create Ember addons that adhere to my company's structure and have some pre-formatted files.

For instance, I would like...

  • The addon spacing to default to 4 spaces instead of 2.
  • The package.json file to contain certain default packages when created.
  • I would like to add some new files to the addon when it is first created.

My understanding is that blueprints must live inside an addon/application and therefore there is no way to modify what the addon structure looks like at the time it is generated. Is it possible to do these types of things through the concept of a "blueprint"? Or would I need to fork Ember CLI and modify the internals? I dislike the idea of forking Ember CLI since I would need to manually keep it up to date.

Thanks in advance!

1

There are 1 answers

2
Kelly Selden On

You can definitely use custom blueprints when generating a brand new project. glimmerjs uses this with success. You can use this repo as a guideline https://github.com/glimmerjs/glimmer-blueprint, then generate your new project via

ember new my-addon -b https://github.com/my-company/my-companys-blueprint.git

That blueprint source can be a git repo url, or npm package.