Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Is "ns preview" supported in {N} nx library? #74

Open
juantot9 opened this issue Feb 8, 2024 · 3 comments
Open

[Question] Is "ns preview" supported in {N} nx library? #74

juantot9 opened this issue Feb 8, 2024 · 3 comments
Assignees
Labels
answered question Further information is requested

Comments

@juantot9
Copy link

juantot9 commented Feb 8, 2024

Hello!

I am new using {N} and I wanted to start a project using nx for an angular crossplatform app. After starting the project with nx and working correctly following the documentation, I was wondering if there is any way to use the preview feature with nx commands.

I tried to search within the docs and code but couldn't find any way to do it. It would be awesome if this exists with a command like nx run <project-name>:preview or something similar. Thank you in advance!

@NathanWalker
Copy link
Contributor

Hi @juantot9 Yes there is. We don't include one by default but you can add this to your apps/nativescript-myapp/project.json:

"preview": {
      "executor": "nx:run-commands",
      "options": {
        "commands": [
          "ns preview"
        ],
        "parallel": false,
        "cwd": "apps/nativescript-myapp"
      }
    },
  • Substitute nativescript-myapp with name of your app.

Also if you just generated your workspace, you'll notice it used newly released Nx 18. We'll release a @nativescript/nx sometime this month to match 18 major but just note that Nx 18 will init a workspace with typescript ~5.3.0 and when you generate a Angular based NativeScript app you would get Angular 16 dependencies added which require typescript ~5.2.0.

You can change typescript or what I would recommend is just using latest Angular 17 and sticking with typescript ~5.3.0 (which Nx 18 sets up). So your dependencies would look like this:

  "dependencies": {
    "@angular/animations": "^17.0.0",
    "@angular/common": "^17.0.0",
    "@angular/compiler": "^17.0.0",
    "@angular/core": "^17.0.0",
    "@angular/forms": "^17.0.0",
    "@angular/platform-browser": "^17.0.0",
    "@angular/platform-browser-dynamic": "^17.0.0",
    "@angular/router": "^17.0.0",
    "@nativescript/core": "~8.6.0",
    "@nativescript/angular": "^17.0.0",
    "nativescript-theme-core": "~1.0.4",
    "rxjs": "~7.8.0",
    "zone.js": "^0.14.0"
  },
"devDependencies": {
    "@angular-devkit/build-angular": "^17.0.0",
    "@angular/compiler-cli": "^17.0.0",
    "@nativescript/nx": "^17.1.0",
    "@nativescript/webpack": "~5.0.0",
    "@nativescript/types": "~8.6.0",
    "@ngtools/webpack": "^17.0.0"
    "@nx/js": "18.0.3",
    "@nx/workspace": "18.0.3",
    "@swc-node/register": "~1.6.7",
    "@swc/core": "~1.3.85",
    "@swc/helpers": "~0.5.2",
    "nx": "18.0.3",
    "prettier": "^2.6.2",
    "sass": "^1.32.0",
    "typescript": "~5.3.0"
  },

Hope that helps.

@NathanWalker
Copy link
Contributor

Oh also keep in mind current 'NativeScript Preview' app on appstore and google play needs @nativescript/core "~8.5.0".

Some updates will be posted this month which will work with ~8.6.0 and higher.

@NathanWalker NathanWalker self-assigned this Feb 8, 2024
@NathanWalker NathanWalker added question Further information is requested answered labels Feb 8, 2024
@NathanWalker NathanWalker pinned this issue Feb 8, 2024
@juantot9
Copy link
Author

juantot9 commented Feb 8, 2024

Hello @NathanWalker ! Thank you so much for all this information, I will try to do it in a few hours and see what happens! Seems pretty easy to do! Also, I updated the libraries, that were by defect in v16. I will let you know if it works! I had some problems figuring out that the problem with making the preview work was the version, a good folk helped me on the discord channel hehe. Again, thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants