diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ff2c656b635d1..6cbd791540730 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,7 +27,7 @@ After cloning the project to your machine, to install the dependencies, run: yarn ``` -To build the `nx`, and `schematics` packages, run: +To build the all packages, run: ```bash yarn build @@ -41,10 +41,10 @@ To make sure your changes do not break any unit tests, run the following: yarn test ``` -For example, if you need to only run the **ngrx/ngrx.spec.ts** test suite, provide a path to the specific spec file, run: +For example, if you need to only run the **jest-project/jest-project.spec.ts** test suite, provide a path to the specific spec file, run: ```bash -yarn test angular/src/schematics/ngrx/ngrx +yarn test jest/src/schematics/jest-project/jest-project ``` ### Running E2E Tests @@ -77,10 +77,8 @@ Before you submit an issue, please search the issue tracker. An issue for your p We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it. Having a reproducible scenario gives us wealth of important information without going back and forth with you requiring additional information, such as: - version of Nx used -- version of Angular CLI used -- `angular.json` configuration -- version of Angular DevKit used -- 3rd-party libraries and their versions +- `workspace.json` or `angular.json` configuration +- `yarn.lock` or `package-lock.json` - and most importantly - a use-case that fails A minimal reproduction allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem. @@ -125,10 +123,10 @@ The type must be one of the following: The scope must be one of the following: -- node - anything backend specific +- backend - anything backend specific - testing - anything related to jest or cypress -- frontend - anything angular specific -- nx - dependency management, basic workspace structure, etc +- frontend - anything frontend specific +- nx - dependency management, basic workspace structure, anything touching both backend and frontend, and other related areas ##### Subject and Body @@ -141,7 +139,7 @@ Including the issue number that the PR relates to also helps with tracking. ``` feat(schematics): add an option to generate lazy-loadable modules -`ng generate lib mylib --lazy` provisions the mylib project in tslint.json +`nx generate lib mylib --lazy` provisions the mylib project in tslint.json Closes #157 ``` diff --git a/README.md b/README.md index 593ede013513f..77a449d2aad00 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,8 @@
[![Build Status](https://travis-ci.org/nrwl/nx.svg?branch=master)](https://travis-ci.org/nrwl/nx) -[![License](https://img.shields.io/npm/l/@nrwl/schematics.svg?style=flat-square)]() -[![NPM Version](https://badge.fury.io/js/%40nrwl%2Fnx.svg)](https://www.npmjs.com/@nrwl/schematics) -[![NPM Downloads](https://img.shields.io/npm/dt/@nrwl/schematics.svg?style=flat-square)](https://www.npmjs.com/@nrwl/schematics) +[![License](https://img.shields.io/npm/l/@nrwl/workspace.svg?style=flat-square)]() +[![NPM Version](https://badge.fury.io/js/%40nrwl%2Fworkspace.svg)](https://www.npmjs.com/@nrwl/workspace) [![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)]() [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) [![Join the chat at https://gitter.im/nrwl-nx/community](https://badges.gitter.im/nrwl-nx/community.svg)](https://gitter.im/nrwl-nx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) @@ -27,33 +26,21 @@ # What is Nx? -πŸ”Ž **Nx is a set of Angular CLI power-ups for modern development.** +πŸ”Ž **Extensible Dev Tools for Monorepos.** ## Nx Helps You ### Use Modern Tools -Using Nx, you can add Cypress, Jest, Prettier, and Nest into your dev workflow. Nx sets up these tools and allows you to use them seamlessly. Nx fully integrates with the other modern tools you already use and love. +Using Nx, you can add TypeScript, Cypress, Jest, Prettier, and Nest into your dev workflow. Nx sets up these tools and allows you to use them seamlessly. Nx fully integrates with the other modern tools you already use and love. ### Build Full-Stack Applications -With Nx, you can build full-stack applications using Angular and Node.js frameworks such as Nest and Express. You can share code between the frontend and the backend. And you can use the familiar `ng build/test/serve` commands to power whole dev experience. +With Nx, you can build full-stack applications using modern frameworks. You can share code between the frontend and the backend. And you can use the same `build/test/serve` commands throughout the whole dev experience. -### Develop Like Google +### Develop like Google, Facebook, and Microsoft -With Nx, you can develop multiple full-stack applications holistically and share code between them all in the same workspace. Nx provides advanced tools which help you scale your enterprise development. Nx helps enforce your organization’s standards and community best practices. - -## A la carte - -Most importantly, you can use these power-ups a la carte. Just want to build a single Angular application using Cypress? Nx is still an excellent choice for that. - -## Does it replace Angular CLI? - -Nx **is not** a replacement for Angular CLI. **An Nx workspace is an Angular CLI workspace.** - -- You run same `ng build`, `ng serve` commands. -- You configure your projects in `angular.json`. -- Anything you can do in a standard Angular CLI project, you can also do in an Nx workspace. +With Nx, you can develop multiple full-stack applications holistically and share code between them all in the same workspace. Nx provides advanced tools which help you scale your enterprise development. Nx also helps enforce your organization’s standards and community best practices. # Getting Started @@ -77,80 +64,87 @@ npm init nx-workspace myworkspace yarn create nx-workspace myworkspace ``` -## Adding Nx to an Existing Angular CLI workspace +If it's your first Nx project, the command will recommend you to install `@nrwl/cli` globally, so you can invoke `nx` directly without going through yarn or npm. + +### Adding Nx to an Existing Angular CLI workspace -If you already have a regular Angular CLI project, you can add Nx power-ups by running: +If you are an Angular user, you can also add Nx to your existing Angular CLI project by running: ```bash -ng add @nrwl/schematics +ng add @nrwl/workspace ``` ## Creating First Application -Unlike the CLI, an Nx workspace starts blank. There are no applications to build, serve, and test. To create one run: +By default, an Nx workspace starts blank. There are no applications to build, serve, and test. To create one, you need to add capabilities to the workspace. + +**To add an Angular app, run:** + +```bash +yarn add @nrwl/angular +nx g @nrwl/angular:app myapp # or just "nx g myapp" +``` + +```bash +npm install --save-dev @nrwl/angular +nx g @nrwl/angular:app myapp # or just "nx g myapp" +``` + +**To add a React app, run:** + +```bash +yarn add @nrwl/react +nx g @nrwl/react:app myapp # or just "nx g myapp" +``` + +```bash +npm install --save-dev @nrwl/react +nx g @nrwl/react:app myapp # or just "nx g myapp" +``` + +**To add a web components app, run:** + +```bash +yarn add @nrwl/web +nx g @nrwl/web:app myapp # or just "nx g myapp" +``` ```bash -ng g application myapp +npm install --save-dev @nrwl/web +nx g @nrwl/web:app myapp # or just "nx g myapp" ``` -The result will look like this: +If `nx g` fails, use: `yarn nx g @nrwl/web:app myapp` or `npm run nx -- g @nrwl/web:app myapp`. + +Regardless of what framework you chose, the resulting file tree will look like this: ```treeview / -β”œβ”€β”€ README.md -β”œβ”€β”€ angular.json β”œβ”€β”€ apps/ β”‚Β Β  β”œβ”€β”€ myapp/ -β”‚Β Β  β”‚Β Β  β”œβ”€β”€ browserslist -β”‚Β Β  β”‚Β Β  β”œβ”€β”€ jest.conf.js -β”‚Β Β  β”‚Β Β  β”œβ”€β”€ src/ -β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ app/ -β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ assets/ -β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ environments/ -β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ favicon.ico -β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ index.html -β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ main.ts -β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ polyfills.ts -β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ styles.scss -β”‚Β Β  β”‚Β Β  β”‚Β Β  └── test.ts -β”‚Β Β  β”‚Β Β  β”œβ”€β”€ tsconfig.app.json -β”‚Β Β  β”‚Β Β  β”œβ”€β”€ tsconfig.json -β”‚Β Β  β”‚Β Β  β”œβ”€β”€ tsconfig.spec.json -β”‚Β Β  β”‚Β Β  └── tslint.json β”‚Β Β  └── myapp-e2e/ -β”‚Β Β  Β Β  β”œβ”€β”€ cypress.json -β”‚Β Β  Β Β  β”œβ”€β”€ src/ -β”‚Β Β  Β Β  β”‚Β Β  β”œβ”€β”€ fixtures/ -β”‚Β Β  Β Β  β”‚Β Β  β”‚Β Β  └── example.json -β”‚Β Β  Β Β  β”‚Β Β  β”œβ”€β”€ integration/ -β”‚Β Β  Β Β  β”‚Β Β  β”‚Β Β  └── app.spec.ts -β”‚Β Β  Β Β  β”‚Β Β  β”œβ”€β”€ plugins/ -β”‚Β Β  Β Β  β”‚Β Β  β”‚Β Β  └── index.ts -β”‚Β Β  Β Β  β”‚Β Β  └── support/ -β”‚Β Β  Β Β  β”‚Β Β  Β Β  β”œβ”€β”€ app.po.ts -β”‚Β Β  Β Β  β”‚Β Β  Β Β  β”œβ”€β”€ commands.ts -β”‚Β Β  Β Β  β”‚Β Β  Β Β  └── index.ts -β”‚Β Β  Β Β  β”œβ”€β”€ tsconfig.e2e.json -β”‚Β Β  Β Β  β”œβ”€β”€ tsconfig.json -β”‚Β Β  Β Β  └── tslint.json β”œβ”€β”€ libs/ +β”œβ”€β”€ tools/ β”œβ”€β”€ nx.json β”œβ”€β”€ package.json -β”œβ”€β”€ tools/ β”œβ”€β”€ tsconfig.json └── tslint.json ``` -All the files that the CLI would have in a new project are still here, just in a different folder structure which makes it easier to create more applications and libraries in the future. - ## Serving Application -Run `ng serve myapp` to serve the newly generated application! +- Run `nx serve myapp` to serve the newly generated application! +- Run `nx test myapp` to test it. +- Run `nx e2e myapp-e2e` to run e2e tests for it. + +Angular users can also run `ng g/serve/test/e2e`. You are good to go! ## Quick Start & Documentation +

+ ### Documentation - [Nx Documentation and Guides](https://nx.dev) @@ -158,7 +152,7 @@ You are good to go! ### Books -- [Angular Enterprise Monorepo Patterns](https://go.nrwl.io/angular-enterprise-monorepo-patterns-new-book?utm_campaign=Book%3A%20Monorepo%20Patterns%2C%20Jan%202019&utm_source=Github&utm_medium=Banner%20Ad) +- [Enterprise Monorepo Patterns](https://go.nrwl.io/angular-enterprise-monorepo-patterns-new-book?utm_campaign=Book%3A%20Monorepo%20Patterns%2C%20Jan%202019&utm_source=Github&utm_medium=Banner%20Ad) ### Videos @@ -172,11 +166,6 @@ You are good to go! - [Supercharging the Angular CLI](https://www.youtube.com/watch?v=bMkKz8AedHc) - [Hands on Full Stack development with Nx and Bazel](https://www.youtube.com/watch?v=1KDDIhcQORM) -### Podcasts and Shows - -- [ngAir 140: Nx for Enterprise Angular Development](https://www.youtube.com/watch?v=qYNiOKDno_I) -- [ngHouston: NX Demo](https://www.youtube.com/watch?v=E_UlU2Yv4G0) - ## Misc - [nx-examples](https://github.com/nrwl/nx-examples) repo has branches for different nx comments to display expected behavior and example app and libraries. Check out the branch (workspace, ngrx...) to see what gets created for you. More info on readme. diff --git a/docs/guides/misc-lazy-loading.md b/docs/angular/guides/misc-lazy-loading.md similarity index 100% rename from docs/guides/misc-lazy-loading.md rename to docs/angular/guides/misc-lazy-loading.md diff --git a/nx-video-img.png b/nx-video-img.png new file mode 100755 index 0000000000000..83e04ed7eaf27 Binary files /dev/null and b/nx-video-img.png differ