简体   繁体   中英

Can we still create multiple apps in nx?

I worked a little bit with NX in the past. I'm trying to create 2 applications: the frontend and the admin. My recollection is that you would have a folder called /apps where all the applications would be and /libs where the libraries would be. You could

Now on the nx website, you can create your repo through package-based repo , integrated repo , and standalone . None of those methods generate a folder called /apps .

When I run npx create-nx-workspace@latest myorg --preset=ts , it's not asking me for the application name .

Everywhere I read or watch the videos posted on their website , they talk about libraries. Are there still apps or everything is libraries now?

I just bought on Udemy a course that was updated in July 2022 , but the course is so different from what's in the website.

Thanks for helping.

You can firstly create an empty repo with this command. Then run

nx g @nrwl/angular:app appName

To generate another application.

You can find more info on angular package root documentation: https://nx.dev/packages/angular For existing projects, you can use migration tool: https://nx.dev/recipes/adopting-nx/migration-angular .

Note that you can't create an application using angular-cli because with starting with nx your angular.json file will just have links to project.json files in each /apps/appName or /libs/libName project

When you create your workspace using

npx create-nx-workspace@latest myorg --preset=ts

you are telling Nx to setup a workspace where all projects will live under the ./packages directory (that is the --preset=ts layout).

If you'd like to have separate apps and libs directories. You can use the --preset=apps . You can also run the create-nx-workspace command without passing a preset, this will prompt you what you are looking for with descriptive information about every option available.

npx create-nx-workspace@latest myorg

And example of this setup is available in the Node tutorial docs .

Bonus:

Nx has been on active development lately. Nx v15.3 introduced standalone apps projects, where you can leverage Nx capabilities in a non-monorepo setup. Read about standalone presets in the react standalone tutorial docs . This is another layout option for your Nx workspace.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM