ng add @nativescript/schematics migration attempt failing. Reason: "NOT SUPPORTED: keyword "id", use "$id" for schema ID"

512 Views Asked by At

I am trying to run "ng add @nativescript/schematics" to migrate my Angular app to Nativescript for mobile support.

When I run the command, not only does it not generate the .tns files that signify successful conversion, it prints this in the console:

√ Packages successfully installed.
NOT SUPPORTED: keyword "id", use "$id" for schema ID

It gives very little to go off of. I have tried searching the @nativescript module in the node_modules folder and there is no "id" field to speak of.

1

There are 1 best solutions below

0
Eduardo Speroni On

@nativescript/schematics are deprecated:

@nativescript/schematics have been deprecated, better alternatives for code-sharing in NativeScript can be explored in the docs https://docs.nativescript.org/code-sharing

https://www.npmjs.com/package/@nativescript/schematics

The main way to develop angular web+nativescript projects now is using Nx. The reason being that using the old schematics and having .tns.ts and .tns.html files ended up very confusing and more often than not introduced a lot of anti-patterns on both NativeScript and web.

So while seemed like a good idea at first, you always ended up with:

my.component.ts
my.component.tns.ts
my.component.html
my.component.tns.html
my.module.ts
my.module.tns.ts

Essentially reusing 0 lines of code. On top of that, the native application would also follow a "web" approach of nesting a lot of layouts, which are much heavier on native platforms than divs are on the web (https://blog.nativescript.org/nativescript-angular-performance-tips-tricks/).

In the end you ended up with subpar DX and UX on both web and native apps, which are now much easier to solve by using Nx and creating shared libraries for code sharing and platform-specific libraries for everything else.