angular-architects / nx-ddd-plugin

Nx plugin for structuring a monorepo with domains and layers
313 stars 56 forks source link

ERROR > Angular/NX 10 "have to provide a proper "--importPath"" #19

Closed ubergeoff closed 4 years ago

ubergeoff commented 4 years ago

Trying to run on an Angular NX 10 project

ng g @angular-architects/ddd:feature search --domain explore

Getting the following error:

For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)

If I go into the node_modules package and change:

schematics_1.externalSchematic('@nrwl/angular', 'lib', {
                name: `feature-${options.name}`,
                directory: options.domain,
                tags: `domain:${options.domain},type:feature`,
                style: 'scss',
                prefix: options.domain,
                publishable: true,
            }),

i.e. if I change the line "publishable" to false - then it works 100% fine again...

pascalbe-dev commented 4 years ago

Hi @ubergeoff are you using the latest released version of this plugin (1.0.5)? The previous release had publishable always set to true. With 1.0.5 you can configure it and it should default to having buildable libs (which does not require an importPath).

With 1.0.5, you can provide the type option with "buildable", "publishable" or "internal" as values. Check out the source code here.

So, in your case, you could either go with: ng g @angular-architects/ddd:feature search --domain explore --type internal or just ng g @angular-architects/ddd:feature search --domain explore which should default to buildable libs.

In both cases, you would have to update the plugin to version 1.0.5.

ubergeoff commented 4 years ago

HI there @pascalbe-dev

Thank you..! yes this did the trick...!

I think this was my problem as well:

image

pascalbe-dev commented 4 years ago

You're welcome, glad to help :) But you are right. This versioning is a bit misleading.

manfredsteyer commented 4 years ago

Thanks @pascalbe-dev for helping here!

jlabaj commented 4 years ago

getting Cannot read property 'paths' of undefined after updating and running ng g @angular-architects/ddd:domain experimental --add-app

jlabaj commented 4 years ago

this helped me: npm install -g @angluar/cli ng update --all --force downgrade typescript to 3.9.7 npm install ng update @angular/cli --migrate-only --from 9 --to 10 ng update @angular/core --migrate-only --from 9 --to 10

jlabaj commented 4 years ago

getting Cannot read property 'paths' of undefined after updating and running ng g @angular-architects/ddd:domain experimental --add-app

the error si basically because of missing "tsconfig.base.json" typical for agular10, you can also add it manually if the migration failed, the tsconfig olso must have the rooturl and baseurl compileroptions defined

Some-of-the-things commented 1 year ago

I just ran npx nx generate @nrwl/angular:library core-ui --buildable --directory=core-ui --publishable --no-interactive --import-path @myorg/my-awesome-package manually on the command line and it worked