How to create component in v2 addon using command line

I have v2 addon and I was create files manually, I want to be create in terminal to create components, service, utils,…etc.

I tried in v2 addon path of create component but it will get error!

PS C:\V2 Testing\v2-addon> ember generate component sample2

Unknown blueprint: component

from SO:

atm, there is no generator for v2 addons at this time.

i create components by just right clicking a folder and selecting new file

I want to be create in terminal to create components, service, utils,…etc.

all of these can be done with your editor – no need for a special tool :tada:

example: ember-primitives/ember-primitives/src at main · universal-ember/ember-primitives · GitHub

if you have to support non strict mode, make sure you fill out the appReexports plugin options ember-primitives/ember-primitives/rollup.config.mjs at main · universal-ember/ember-primitives · GitHub

defaults:

    addon.appReexports([
      'components/**/*.js',
      'helpers/**/*.js',
      'modifiers/**/*.js',
      'services/**/*.js',
    ]),

also note that utils are not an ember concept and had no business being in the old generator

1 Like

Maybe in your mind but the term “util” or “utility” was definitely a thing in the past for ember-cli users;

And in your own words;

1 Like

And in your own words;

I think we’re all aligned on what utilities are, regardless if present-day ember-cli has a convention for placing global utils in a specific place.

they key takeaway is that they’re just functions, and can live anywhere – no need to be in app/utils

Sure, I get that aspect, I just don’t like the dismissal of previous ember(-cli)'isms like this. Utilities were a thing in the past, so a “from this, to that” would be better than “had no business being in the old generator” (doesn’t provide a path forward).

2 Likes