iOnic CLI 3 Generator

I updated to iOnic 3 and also to the New Ionic CLI v3.

Because the documentation about the new version is not the best, I can’t find out how to generate components, pages or providers.

I hope somebody can help me :slight_smile:

I found a workaround to generate my providers without errors.

I just type ionic generate, select provider, give it a name and then select Use this provider in more than one template? with Yes

Just type in the command ionic generate

I tried:
ionic generate page test

Got error:
Error: The generate command is only available for projects that use ionic-angular >= 3.0.0

package.json contains:
"ionic-angular": "3.0.0-beta.3"

What stops you updating to 3.0.1?

Nothing - now that I know it is available.
So, you are saying that 3.0.0 does Not work but 3.0.1 does?

I can generate pages when I just type ionic generate

Then this page shows up

? What would you like to generate: (Use arrow keys)
❯ component 
  directive 
  page 
  pipe 
  provider 
  tabs 

No problems when I want to generate a page or component. But I can’t generate any provider without errors. I select for example my login page and then this error shows up

TypeError: Cannot read property 'initializer' of undefined
at Object.appendNgModuleDeclaration (/Users/daniel/Documents/Projekte/Cinematica/node_modules/@ionic/app-scripts/dist/util/typescript-utils.js:212:38)
at /Users/daniel/Documents/Projekte/Cinematica/node_modules/@ionic/app-scripts/dist/generators/util.js:161:46

I updated to 3.0.1 and using ionic generate works. It provides options for page, provider etc, as LoLStats noted.

Provider Did work for me though. No errors. I chose use in multiple components.
It automatically injected it into my app.module.ts.

Using 3.0.0-beta.3 did not work.

When a page is generated, it is creating the module.ts but is using the following, which throws an error:

IonicModule.forChild(TestPage),

Chaning it to this fixes it:

IonicPageModule.forChild(TestPage),

I assume this is because of something else I have not updated. Maybe @ionic/app-scripts which I have currently at 1.2.5

How does one find out which is the current package dependencies and devDependencies to update to?
It is not mentioned for 3.0.1 in the changelog:

Also, concerning the provider generated, while it did include it in the app.module.ts, on windows, it is wrong.

I created a provider called MapService which gives me this runtime error:
Cannot find module "..providersmap-service/map-service"

The genrated line in the app.module was:
import { MapServiceProvider } from '..\providers\map-service/map-service';

However, this works ( slashes):
import { MapServiceProvider } from '../providers/map-service/map-service';

Frankly, I would avoid the generators.