Socket
Socket
Sign inDemoInstall

@nrwl/cli

Package Overview
Dependencies
Maintainers
1
Versions
997
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nrwl/cli - npm Package Compare versions

Comparing version 8.2.2-beta.1 to 8.3.0-beta.1

bin/nx.d.ts

85

bin/nx.js
#!/usr/bin/env node
'use strict';
const path = require('path');
const fs = require('fs');
try {
process.title =
'nx ' +
Array.from(process.argv)
.slice(2)
.join(' ');
} catch (_) {
process.title = 'nx';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fs_1 = require("fs");
var path = require("path");
function isLocalProject(dir) {
if (path.dirname(dir) === dir)
return false;
var configPath = path.join(dir, 'angular.json');
if (fileExists(configPath)) {
return true;
}
else {
return isLocalProject(path.dirname(dir));
}
}
const nxPath = pathInner(process.cwd());
if (nxPath) {
require(nxPath);
} else {
console.error('Could not find nx installed locally');
process.exit(1);
function findLocalNx(dir) {
if (path.dirname(dir) === dir)
return null;
var nxPath = path.join(dir, 'node_modules', '.bin', 'nx');
if (fileExists(nxPath)) {
return nxPath;
}
else {
return findLocalNx(path.dirname(dir));
}
}
function pathInner(dir) {
if (path.dirname(dir) === dir) return null;
const nxPath = path.join(dir, 'node_modules', '.bin', 'nx');
if (fileExists(nxPath)) {
return nxPath;
} else {
return pathInner(path.dirname(dir));
}
}
function fileExists(filePath) {
try {
return fs.statSync(filePath).isFile();
} catch (err) {
return false;
}
try {
return fs_1.statSync(filePath).isFile();
}
catch (err) {
return false;
}
}
var inLocal = isLocalProject(__dirname);
if (inLocal) {
/**
* The commandsObject is a Yargs object declared in `nx-commands.ts`,
* It is exposed and bootstrapped here to provide CLI features.
*/
var w = require('@nrwl/workspace');
if (w.supportedNxCommands.includes(process.argv[2])) {
// The commandsObject is a Yargs object declared in `nx-commands.ts`,
// It is exposed and bootstrapped here to provide CLI features.
w.commandsObject.argv;
}
else {
require(w.closestCli(__dirname));
}
}
else {
require(findLocalNx(process.cwd()));
}
{
"name": "@nrwl/cli",
"version": "8.2.2-beta.1",
"version": "8.3.0-beta.1",
"description": "",

@@ -10,8 +10,11 @@ "repository": {

"keywords": [
"RxJS",
"Monorepo",
"Angular",
"Workspace",
"NgRx",
"Schematics",
"Angular CLI"
"React",
"Web",
"Node",
"Nest",
"Jest",
"Cypress",
"CLI"
],

@@ -18,0 +21,0 @@ "bin": {

@@ -6,5 +6,4 @@ <p align="center"><img src="https://raw.githubusercontent.com/nrwl/nx/master/nx-logo.png" width="450"></p>

[![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)]()

@@ -31,3 +30,3 @@ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

πŸ”Ž **Nx is a set of Angular CLI power-ups for modern development.**
πŸ”Ž **Extensible Dev Tools for Monorepos.**

@@ -38,24 +37,12 @@ ## Nx Helps You

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.
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.
## 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.
# Getting Started

@@ -83,8 +70,10 @@

## 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.
If you already have a regular Angular CLI project, you can add Nx power-ups by running:
### Adding Nx to an Existing Angular CLI workspace
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
```

@@ -94,52 +83,53 @@

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
ng g application myapp
yarn add @nrwl/angular
nx g @nrwl/angular:app myapp # or just "nx g myapp"
```
The result will look like this:
```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
npm install --save-dev @nrwl/web
nx g @nrwl/web:app myapp # or just "nx g myapp"
```
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
<workspace name>/
β”œβ”€β”€ 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

@@ -149,8 +139,10 @@ └── 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!

@@ -160,2 +152,4 @@

<p align="center"><a href="https://www.youtube.com/watch?v=mVKMse-gFBI" target="_blank"><img src="https://raw.githubusercontent.com/nrwl/nx/master/nx-video-img.png" width="450"></p></a>
### Documentation

@@ -168,3 +162,3 @@

- [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)

@@ -183,7 +177,2 @@ ### Videos

### 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

@@ -190,0 +179,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc