npx create-nx-workspace --cli=nx --preset=empty
# Using npm
npm install --save-dev @nativescript/nx
# Using yarn
yarn add -D @nativescript/nx
npx nx g @nativescript/nx:app <app-name> [...options]
This will generate:
apps/nativescript-<app-name>
The NativeScript Nx plugin will prefix apps by default to help distinguish them against other apps in your workspace for clarity.
By default a "vanilla" NativeScript app will be generated using xml view files. Use this option to create a specific frontend framework integration app.
If you prefer you can also provide a flag to suffix instead:
npx nx g @nativescript/nx:app <app-name> --groupByName
This will generate:
apps/<app-name>-nativescript
Android:
npx nx run <app-name>:android
iOS: (Mac only)
npx nx run <app-name>:ios
Android:
npx nx run <app-name>:android:build
iOS: (Mac only)
npx nx run <app-name>:ios:build
npx nx run <app-name>:test
npx nx run <app-name>:lint
You can create a library of NativeScript components or plugins or whatever you'd like.
npx nx g @nativescript/nx:lib buttons
This will generate a nativescript-buttons
library where you could build out an entire suite of button behaviors and styles for your NativeScript apps.
import { PrimaryButton } from '@myorg/nativescript-buttons';
The NativeScript Nx plugin will prefix libraries by default to help distinguish them against other apps and libraries in your workspace for clarity.
If you prefer you can also provide a flag to suffix instead:
npx nx g @nativescript/nx:lib buttons --groupByName
Which would generate a buttons-nativescript
library.
import { PrimaryButton } from '@myorg/buttons-nativescript';