NativeScript / nx

NativeScript for Nx.
Other
61 stars 15 forks source link

Upgrading workspace to angular 12.2 and ns 8.1 breaks the apps #41

Closed mahmoudajawad closed 2 years ago

mahmoudajawad commented 2 years ago

Upgrading a workspace to Nx 12.9, Angular 12.2, and Nativescript 8.1 is causing the following error when running apps against android:

Error executing Static Binding Generator: Couldn't find '/path/to/workspace/apps/app-name/platforms/android/build-tools/sbg-bindings.txt' bindings input file. Most probably there's an error in the JS Parser execution. You can run JS Parser with verbose logging by executing "node '/path/to/workspace/apps/app-name/platforms/android/build-tools/jsparser/js_parser.js' enableErrorLogging".

When running the suggested command I got:

Error processing '/path/to/workspace/apps/app-name/platforms/android/app/src/main/assets/app/vendor.js:' SyntaxError: Unexpected token (48:37)

And by checking the line, it seems to be failing due to optional chaining in that line which doesn't seem to be supported by js-parser/babel being used.

Any suggestions about possible things to try to get around this?

mahmoudajawad commented 2 years ago

To update this, I was able to upgrade to using NS 8.1 by changing workspace package.json to have the following:

{
  "dependencies": {
    "@nativescript/core": "~8.1.0",
  },
  "devDependencies": {
    "@nativescript/types": "~8.1.0",
    "@nativescript/webpack": "5.0.0",
  }
}

and, while this is advised against in the release notes for @nativescript/nx == 2.0, I found it the only method to make sure all the application use exactly the same version of @nativescript/core, and not install another random version with every app clean task. So, the app package.json now looks like:

{
  "dependencies": {
    "@nativescript/core": "../../node_modules/@nativescript/core",
  },
  "devDependencies": {
    "@nativescript/android": "8.1.1",
    "@nativescript/ios": "8.1.0"
  }
}

I've been using this for almost three weeks; A little after posting this issue. So far, I didn't have any issues, and I was able to get the changes of NS 8.1 into my workspace without a hassle. However, upgrading the workspace (Nx package) to higher version, seems to still break the workspace, which is not a big concern to me right now.

Next step is to see how to check if upgrading angular package to v13 will break anything or that it would maintain a healthy workspace.

mahmoudajawad commented 2 years ago

@NathanWalker, can you confirm the following: Seems like @nativescript/nx v2.0.6 does create new applications with version nativescript 8.1. Is this an accidental side effect of the plugin update?