cleanup(core): remove the indirection left after inlining ta… (#9469)
This commit is contained in:
parent
22a99144be
commit
d4b5c30eba
@ -188,7 +188,7 @@ jobs:
|
||||
- run:
|
||||
name: Run E2E Tests
|
||||
command: |
|
||||
npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --exclude=e2e-storybook,e2e-react-native,e2e-detox --parallel=1
|
||||
npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --exclude=e2e-storybook,e2e-react-native,e2e-detox,e2e-workspace-integrations --parallel=1
|
||||
no_output_timeout: 45m
|
||||
- run:
|
||||
name: Stop All Running Agents for This CI Run
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// nx-ignore-next-line
|
||||
import type { DepGraphClientResponse } from '@nrwl/workspace/src/command-line/dep-graph';
|
||||
import type { DepGraphClientResponse } from 'nx/src/command-line/dep-graph';
|
||||
import { ProjectGraphService } from './interfaces';
|
||||
|
||||
export class FetchProjectGraphService implements ProjectGraphService {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// nx-ignore-next-line
|
||||
import type { DepGraphClientResponse } from '@nrwl/workspace/src/command-line/dep-graph';
|
||||
import type { DepGraphClientResponse } from 'nx/src/command-line/dep-graph';
|
||||
import { useRef } from 'react';
|
||||
import { AppConfig } from '../interfaces';
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// nx-ignore-next-line
|
||||
import type { DepGraphClientResponse } from '@nrwl/workspace/src/command-line/dep-graph';
|
||||
import type { DepGraphClientResponse } from 'nx/src/command-line/dep-graph';
|
||||
|
||||
export interface ProjectGraphList {
|
||||
id: string;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// nx-ignore-next-line
|
||||
import type { DepGraphClientResponse } from '@nrwl/workspace/src/command-line/dep-graph';
|
||||
import type { DepGraphClientResponse } from 'nx/src/command-line/dep-graph';
|
||||
import { ProjectGraphService } from './interfaces';
|
||||
|
||||
export class LocalProjectGraphService implements ProjectGraphService {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// nx-ignore-next-line
|
||||
import type { ProjectGraphProjectNode } from '@nrwl/devkit';
|
||||
import { DepGraphSelector } from '../hooks/use-dep-graph-selector';
|
||||
import { WorkspaceLayout } from '../interfaces';
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
// nx-ignore-next-line
|
||||
import type {
|
||||
ProjectGraphDependency,
|
||||
ProjectGraphProjectNode,
|
||||
} from '@nrwl/devkit';
|
||||
// nx-ignore-next-line
|
||||
import type { DepGraphClientResponse } from '@nrwl/workspace/src/command-line/dep-graph';
|
||||
import type { DepGraphClientResponse } from 'nx/src/command-line/dep-graph';
|
||||
import { ProjectGraphService } from '../app/interfaces';
|
||||
|
||||
export class MockProjectGraphService implements ProjectGraphService {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// nx-ignore-next-line
|
||||
import type { DepGraphClientResponse } from '@nrwl/workspace/src/command-line/dep-graph';
|
||||
import type { DepGraphClientResponse } from 'nx/src/command-line/dep-graph';
|
||||
import Tippy from '@tippyjs/react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import DebuggerPanel from './debugger-panel';
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// nx-ignore-next-line
|
||||
import type { ProjectGraphNode } from '@nrwl/devkit';
|
||||
import { useDepGraphService } from '../hooks/use-dep-graph';
|
||||
import { useDepGraphSelector } from '../hooks/use-dep-graph-selector';
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// nx-ignore-next-line
|
||||
import type { ProjectGraphDependency } from '@nrwl/devkit';
|
||||
import * as cy from 'cytoscape';
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// nx-ignore-next-line
|
||||
import type { ProjectGraphProjectNode } from '@nrwl/devkit';
|
||||
import * as cy from 'cytoscape';
|
||||
import { parseParentDirectoriesFromPilePath } from '../util';
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// nx-ignore-next-line
|
||||
import { ProjectGraphDependency } from '@nrwl/devkit';
|
||||
|
||||
export function trimBackSlash(value: string): string {
|
||||
|
||||
2
dep-graph/client/src/globals.d.ts
vendored
2
dep-graph/client/src/globals.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
// nx-ignore-next-line
|
||||
import type { DepGraphClientResponse } from '@nrwl/workspace/src/command-line/dep-graph';
|
||||
import type { DepGraphClientResponse } from 'nx/src/command-line/dep-graph';
|
||||
import { AppConfig } from './app/interfaces';
|
||||
|
||||
export declare global {
|
||||
|
||||
@ -23,6 +23,14 @@ It only uses language primitives and immutable objects
|
||||
|
||||
- [ProjectGraphBuilder](../../nx-devkit/index#projectgraphbuilder)
|
||||
|
||||
### Utils Classes
|
||||
|
||||
- [Hasher](../../nx-devkit/index#hasher)
|
||||
|
||||
### Workspace Classes
|
||||
|
||||
- [Workspaces](../../nx-devkit/index#workspaces)
|
||||
|
||||
### Commands Interfaces
|
||||
|
||||
- [Target](../../nx-devkit/index#target)
|
||||
@ -49,6 +57,7 @@ It only uses language primitives and immutable objects
|
||||
|
||||
### Utils Interfaces
|
||||
|
||||
- [Hash](../../nx-devkit/index#hash)
|
||||
- [JsonParseOptions](../../nx-devkit/index#jsonparseoptions)
|
||||
- [JsonSerializeOptions](../../nx-devkit/index#jsonserializeoptions)
|
||||
- [StringDeletion](../../nx-devkit/index#stringdeletion)
|
||||
@ -102,6 +111,13 @@ It only uses language primitives and immutable objects
|
||||
|
||||
- [logger](../../nx-devkit/index#logger)
|
||||
|
||||
### Utils Variables
|
||||
|
||||
- [appRootPath](../../nx-devkit/index#approotpath)
|
||||
- [cacheDir](../../nx-devkit/index#cachedir)
|
||||
- [output](../../nx-devkit/index#output)
|
||||
- [workspaceRoot](../../nx-devkit/index#workspaceroot)
|
||||
|
||||
### Functions
|
||||
|
||||
- [addDependenciesToPackageJson](../../nx-devkit/index#adddependenciestopackagejson)
|
||||
@ -109,9 +125,11 @@ It only uses language primitives and immutable objects
|
||||
- [applyChangesToString](../../nx-devkit/index#applychangestostring)
|
||||
- [convertNxExecutor](../../nx-devkit/index#convertnxexecutor)
|
||||
- [convertNxGenerator](../../nx-devkit/index#convertnxgenerator)
|
||||
- [createProjectGraphAsync](../../nx-devkit/index#createprojectgraphasync)
|
||||
- [detectPackageManager](../../nx-devkit/index#detectpackagemanager)
|
||||
- [formatFiles](../../nx-devkit/index#formatfiles)
|
||||
- [generateFiles](../../nx-devkit/index#generatefiles)
|
||||
- [getOutputsForTargetAndConfiguration](../../nx-devkit/index#getoutputsfortargetandconfiguration)
|
||||
- [getPackageManagerCommand](../../nx-devkit/index#getpackagemanagercommand)
|
||||
- [getPackageManagerVersion](../../nx-devkit/index#getpackagemanagerversion)
|
||||
- [getProjects](../../nx-devkit/index#getprojects)
|
||||
@ -126,13 +144,16 @@ It only uses language primitives and immutable objects
|
||||
- [offsetFromRoot](../../nx-devkit/index#offsetfromroot)
|
||||
- [parseJson](../../nx-devkit/index#parsejson)
|
||||
- [parseTargetString](../../nx-devkit/index#parsetargetstring)
|
||||
- [readCachedProjectGraph](../../nx-devkit/index#readcachedprojectgraph)
|
||||
- [readJson](../../nx-devkit/index#readjson)
|
||||
- [readJsonFile](../../nx-devkit/index#readjsonfile)
|
||||
- [readNxJson](../../nx-devkit/index#readnxjson)
|
||||
- [readProjectConfiguration](../../nx-devkit/index#readprojectconfiguration)
|
||||
- [readTargetOptions](../../nx-devkit/index#readtargetoptions)
|
||||
- [readWorkspaceConfiguration](../../nx-devkit/index#readworkspaceconfiguration)
|
||||
- [removeDependenciesFromPackageJson](../../nx-devkit/index#removedependenciesfrompackagejson)
|
||||
- [removeProjectConfiguration](../../nx-devkit/index#removeprojectconfiguration)
|
||||
- [reverse](../../nx-devkit/index#reverse)
|
||||
- [runExecutor](../../nx-devkit/index#runexecutor)
|
||||
- [serializeJson](../../nx-devkit/index#serializejson)
|
||||
- [stripIndents](../../nx-devkit/index#stripindents)
|
||||
@ -144,6 +165,7 @@ It only uses language primitives and immutable objects
|
||||
- [updateTsConfigsToJs](../../nx-devkit/index#updatetsconfigstojs)
|
||||
- [updateWorkspaceConfiguration](../../nx-devkit/index#updateworkspaceconfiguration)
|
||||
- [visitNotIgnoredFiles](../../nx-devkit/index#visitnotignoredfiles)
|
||||
- [workspaceLayout](../../nx-devkit/index#workspacelayout)
|
||||
- [writeJson](../../nx-devkit/index#writejson)
|
||||
- [writeJsonFile](../../nx-devkit/index#writejsonfile)
|
||||
|
||||
@ -167,6 +189,22 @@ It only uses language primitives and immutable objects
|
||||
|
||||
• **ProjectGraphBuilder**: `Object`
|
||||
|
||||
---
|
||||
|
||||
## Utils Classes
|
||||
|
||||
### Hasher
|
||||
|
||||
• **Hasher**: `Object`
|
||||
|
||||
---
|
||||
|
||||
## Workspace Classes
|
||||
|
||||
### Workspaces
|
||||
|
||||
• **Workspaces**: `Object`
|
||||
|
||||
## Commands Interfaces
|
||||
|
||||
### Target
|
||||
@ -269,6 +307,12 @@ A plugin for Nx
|
||||
|
||||
## Utils Interfaces
|
||||
|
||||
### Hash
|
||||
|
||||
• **Hash**: `Object`
|
||||
|
||||
---
|
||||
|
||||
### JsonParseOptions
|
||||
|
||||
• **JsonParseOptions**: `Object`
|
||||
@ -581,6 +625,32 @@ Implementation of a target of a project that handles multiple projects to be bat
|
||||
| `log` | (...`s`: `any`[]) => `void` |
|
||||
| `warn` | (`s`: `any`) => `void` |
|
||||
|
||||
---
|
||||
|
||||
## Utils Variables
|
||||
|
||||
### appRootPath
|
||||
|
||||
• **appRootPath**: `string`
|
||||
|
||||
---
|
||||
|
||||
### cacheDir
|
||||
|
||||
• **cacheDir**: `string`
|
||||
|
||||
---
|
||||
|
||||
### output
|
||||
|
||||
• **output**: `CLIOutput`
|
||||
|
||||
---
|
||||
|
||||
### workspaceRoot
|
||||
|
||||
• **workspaceRoot**: `string` = `appRootPath`
|
||||
|
||||
## Functions
|
||||
|
||||
### addDependenciesToPackageJson
|
||||
@ -754,6 +824,38 @@ Convert an Nx Generator into an Angular Devkit Schematic
|
||||
|
||||
---
|
||||
|
||||
### createProjectGraphAsync
|
||||
|
||||
▸ **createProjectGraphAsync**(): `Promise`<[`ProjectGraph`](../../nx-devkit/index#projectgraph)\>
|
||||
|
||||
Computes and returns a ProjectGraph.
|
||||
|
||||
Nx will compute the graph either in a daemon process or in the current process.
|
||||
|
||||
Nx will compute it in the current process if:
|
||||
|
||||
- The process is running in CI (CI env variable is to true or other common variables used by CI providers are set).
|
||||
- It is running in the docker container.
|
||||
- The daemon process is disabled because of the previous error when starting the daemon.
|
||||
- `NX_DAEMON` is set to `false`.
|
||||
- `useDaemon` is set to false in `nx.json`
|
||||
|
||||
`NX_DAEMON` env variable takes precedence:
|
||||
|
||||
- If it is set to true, the daemon will always be used.
|
||||
- If it is set to false, the graph will always be computed in the current process.
|
||||
|
||||
Tip: If you want to debug project graph creation, run your command with NX_DAEMON=false.
|
||||
|
||||
Nx uses two layers of caching: the information about explicit dependencies stored on the disk and the information
|
||||
stored in the daemon process. To reset both run: `nx reset`.
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ProjectGraph`](../../nx-devkit/index#projectgraph)\>
|
||||
|
||||
---
|
||||
|
||||
### detectPackageManager
|
||||
|
||||
▸ **detectPackageManager**(`dir?`): [`PackageManager`](../../nx-devkit/index#packagemanager)
|
||||
@ -831,6 +933,25 @@ doesn't get confused about incorrect TypeScript files.
|
||||
|
||||
---
|
||||
|
||||
### getOutputsForTargetAndConfiguration
|
||||
|
||||
▸ **getOutputsForTargetAndConfiguration**(`task`, `node`): `any`
|
||||
|
||||
Returns the list of outputs that will be cached.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :----- | :--------------------------------------------------------------------------------- | :-------------------------------------------------------- |
|
||||
| `task` | `Pick`<[`Task`](../../nx-devkit/index#task), `"target"` \| `"overrides"`\> | target + overrides |
|
||||
| `node` | [`ProjectGraphProjectNode`](../../nx-devkit/index#projectgraphprojectnode)<`any`\> | ProjectGraphProjectNode object that the task runs against |
|
||||
|
||||
#### Returns
|
||||
|
||||
`any`
|
||||
|
||||
---
|
||||
|
||||
### getPackageManagerCommand
|
||||
|
||||
▸ **getPackageManagerCommand**(`packageManager?`): `PackageManagerCommands`
|
||||
@ -1008,6 +1129,8 @@ Normalized path fragments and joins them
|
||||
|
||||
▸ **moveFilesToNewDirectory**(`tree`, `oldDir`, `newDir`): `void`
|
||||
|
||||
Analogous to cp -r oldDir newDir
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
@ -1151,6 +1274,20 @@ parseTargetString('proj:test:production'); // returns { project: "proj", target:
|
||||
|
||||
---
|
||||
|
||||
### readCachedProjectGraph
|
||||
|
||||
▸ **readCachedProjectGraph**(): [`ProjectGraph`](../../nx-devkit/index#projectgraph)
|
||||
|
||||
Synchronously reads the latest cached copy of the workspace's ProjectGraph.
|
||||
|
||||
**`throws`** {Error} if there is no cached ProjectGraph to read from
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ProjectGraph`](../../nx-devkit/index#projectgraph)
|
||||
|
||||
---
|
||||
|
||||
### readJson
|
||||
|
||||
▸ **readJson**<`T`\>(`tree`, `path`, `options?`): `T`
|
||||
@ -1204,6 +1341,26 @@ Object the JSON content of the file represents
|
||||
|
||||
---
|
||||
|
||||
### readNxJson
|
||||
|
||||
▸ **readNxJson**(`path?`): [`NxJsonConfiguration`](../../nx-devkit/index#nxjsonconfiguration)
|
||||
|
||||
Returns the contents of nx.json.
|
||||
|
||||
If nx.json extends another config file, it will be inlined here.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :----- | :------- |
|
||||
| `path` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`NxJsonConfiguration`](../../nx-devkit/index#nxjsonconfiguration)
|
||||
|
||||
---
|
||||
|
||||
### readProjectConfiguration
|
||||
|
||||
▸ **readProjectConfiguration**(`tree`, `projectName`): [`ProjectConfiguration`](../../nx-devkit/index#projectconfiguration)
|
||||
@ -1328,6 +1485,27 @@ The utility will update either file.
|
||||
|
||||
---
|
||||
|
||||
### reverse
|
||||
|
||||
▸ **reverse**(`graph`): [`ProjectGraph`](../../nx-devkit/index#projectgraph)
|
||||
|
||||
Returns a new project graph where all the edges are reversed.
|
||||
|
||||
For instance, if project A depends on B, in the reversed graph
|
||||
B will depend on A.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :----------------------------------------------------------- |
|
||||
| `graph` | [`ProjectGraph`](../../nx-devkit/index#projectgraph)<`any`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ProjectGraph`](../../nx-devkit/index#projectgraph)
|
||||
|
||||
---
|
||||
|
||||
### runExecutor
|
||||
|
||||
▸ **runExecutor**<`T`\>(`targetDescription`, `options`, `context`): `Promise`<`AsyncIterableIterator`<`T`\>\>
|
||||
@ -1607,6 +1785,23 @@ Utility to act on all files in a tree that are not ignored by git.
|
||||
|
||||
---
|
||||
|
||||
### workspaceLayout
|
||||
|
||||
▸ **workspaceLayout**(): `Object`
|
||||
|
||||
Returns information about where apps and libs will be created.
|
||||
|
||||
#### Returns
|
||||
|
||||
`Object`
|
||||
|
||||
| Name | Type |
|
||||
| :-------- | :------- |
|
||||
| `appsDir` | `string` |
|
||||
| `libsDir` | `string` |
|
||||
|
||||
---
|
||||
|
||||
### writeJson
|
||||
|
||||
▸ **writeJson**<`T`\>(`tree`, `path`, `value`, `options?`): `void`
|
||||
|
||||
@ -37,6 +37,14 @@ nx g migration my-migration --project=my-plugin --version=1.0.0
|
||||
|
||||
## Options
|
||||
|
||||
### packageVersion (_**required**_)
|
||||
|
||||
Alias(es): v
|
||||
|
||||
Type: `string`
|
||||
|
||||
Version to use for the migration
|
||||
|
||||
### project (_**required**_)
|
||||
|
||||
Alias(es): p
|
||||
@ -45,14 +53,6 @@ Type: `string`
|
||||
|
||||
The name of the project.
|
||||
|
||||
### version (_**required**_)
|
||||
|
||||
Alias(es): v
|
||||
|
||||
Type: `string`
|
||||
|
||||
Version to use for the migration
|
||||
|
||||
### description
|
||||
|
||||
Alias(es): d
|
||||
|
||||
@ -1,118 +0,0 @@
|
||||
---
|
||||
title: 'affected:build - CLI command'
|
||||
description: 'Build applications and publishable libraries affected by changes'
|
||||
---
|
||||
|
||||
# affected:build
|
||||
|
||||
Build applications and publishable libraries affected by changes
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
nx affected:build
|
||||
```
|
||||
|
||||
[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.
|
||||
|
||||
### Examples
|
||||
|
||||
Run build in parallel:
|
||||
|
||||
```bash
|
||||
nx affected:build --parallel=5
|
||||
```
|
||||
|
||||
Run the build target for all projects:
|
||||
|
||||
```bash
|
||||
nx affected:build --all
|
||||
```
|
||||
|
||||
Run build for all the projects affected by changing the index.ts file:
|
||||
|
||||
```bash
|
||||
nx affected:build --files=libs/mylib/src/index.ts
|
||||
```
|
||||
|
||||
Run build for all the projects affected by the changes between main and HEAD (e.g., PR):
|
||||
|
||||
```bash
|
||||
nx affected:build --base=main --head=HEAD
|
||||
```
|
||||
|
||||
Run build for all the projects affected by the last commit on main:
|
||||
|
||||
```bash
|
||||
nx affected:build --base=main~1 --head=main
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### all
|
||||
|
||||
All projects
|
||||
|
||||
### base
|
||||
|
||||
Base of the current branch (usually main)
|
||||
|
||||
### configuration
|
||||
|
||||
This is the configuration to use when performing tasks on projects
|
||||
|
||||
### exclude
|
||||
|
||||
Default: ``
|
||||
|
||||
Exclude certain projects from being processed
|
||||
|
||||
### files
|
||||
|
||||
Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas
|
||||
|
||||
### head
|
||||
|
||||
Latest commit of the current branch (usually HEAD)
|
||||
|
||||
### help
|
||||
|
||||
Show help
|
||||
|
||||
### ~~only-failed~~
|
||||
|
||||
Default: `false`
|
||||
|
||||
**Deprecated:** The command to rerun failed projects will appear if projects fail. This now does nothing and will be removed in v15.
|
||||
|
||||
Isolate projects which previously failed
|
||||
|
||||
### parallel
|
||||
|
||||
Max number of parallel processes [default is 3]
|
||||
|
||||
### runner
|
||||
|
||||
This is the name of the tasks runner configured in nx.json
|
||||
|
||||
### skip-nx-cache
|
||||
|
||||
Default: `false`
|
||||
|
||||
Rerun the tasks even when the results are available in the cache
|
||||
|
||||
### uncommitted
|
||||
|
||||
Uncommitted changes
|
||||
|
||||
### untracked
|
||||
|
||||
Untracked changes
|
||||
|
||||
### verbose
|
||||
|
||||
Print additional error stack trace on failure
|
||||
|
||||
### version
|
||||
|
||||
Show version number
|
||||
@ -1,118 +0,0 @@
|
||||
---
|
||||
title: 'affected:e2e - CLI command'
|
||||
description: 'Run e2e tests for the applications affected by changes'
|
||||
---
|
||||
|
||||
# affected:e2e
|
||||
|
||||
Run e2e tests for the applications affected by changes
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
nx affected:e2e
|
||||
```
|
||||
|
||||
[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.
|
||||
|
||||
### Examples
|
||||
|
||||
Run tests in parallel:
|
||||
|
||||
```bash
|
||||
nx affected:e2e --parallel=5
|
||||
```
|
||||
|
||||
Run the test target for all projects:
|
||||
|
||||
```bash
|
||||
nx affected:e2e --all
|
||||
```
|
||||
|
||||
Run tests for all the projects affected by changing the index.ts file:
|
||||
|
||||
```bash
|
||||
nx affected:e2e --files=libs/mylib/src/index.ts
|
||||
```
|
||||
|
||||
Run tests for all the projects affected by the changes between main and HEAD (e.g., PR):
|
||||
|
||||
```bash
|
||||
nx affected:e2e --base=main --head=HEAD
|
||||
```
|
||||
|
||||
Run tests for all the projects affected by the last commit on main:
|
||||
|
||||
```bash
|
||||
nx affected:e2e --base=main~1 --head=main
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### all
|
||||
|
||||
All projects
|
||||
|
||||
### base
|
||||
|
||||
Base of the current branch (usually main)
|
||||
|
||||
### configuration
|
||||
|
||||
This is the configuration to use when performing tasks on projects
|
||||
|
||||
### exclude
|
||||
|
||||
Default: ``
|
||||
|
||||
Exclude certain projects from being processed
|
||||
|
||||
### files
|
||||
|
||||
Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas
|
||||
|
||||
### head
|
||||
|
||||
Latest commit of the current branch (usually HEAD)
|
||||
|
||||
### help
|
||||
|
||||
Show help
|
||||
|
||||
### ~~only-failed~~
|
||||
|
||||
Default: `false`
|
||||
|
||||
**Deprecated:** The command to rerun failed projects will appear if projects fail. This now does nothing and will be removed in v15.
|
||||
|
||||
Isolate projects which previously failed
|
||||
|
||||
### parallel
|
||||
|
||||
Max number of parallel processes [default is 3]
|
||||
|
||||
### runner
|
||||
|
||||
This is the name of the tasks runner configured in nx.json
|
||||
|
||||
### skip-nx-cache
|
||||
|
||||
Default: `false`
|
||||
|
||||
Rerun the tasks even when the results are available in the cache
|
||||
|
||||
### uncommitted
|
||||
|
||||
Uncommitted changes
|
||||
|
||||
### untracked
|
||||
|
||||
Untracked changes
|
||||
|
||||
### verbose
|
||||
|
||||
Print additional error stack trace on failure
|
||||
|
||||
### version
|
||||
|
||||
Show version number
|
||||
@ -1,118 +0,0 @@
|
||||
---
|
||||
title: 'affected:lint - CLI command'
|
||||
description: 'Lint projects affected by changes'
|
||||
---
|
||||
|
||||
# affected:lint
|
||||
|
||||
Lint projects affected by changes
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
nx affected:lint
|
||||
```
|
||||
|
||||
[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.
|
||||
|
||||
### Examples
|
||||
|
||||
Run lint in parallel:
|
||||
|
||||
```bash
|
||||
nx affected:lint --parallel=5
|
||||
```
|
||||
|
||||
Run the lint target for all projects:
|
||||
|
||||
```bash
|
||||
nx affected:lint --all
|
||||
```
|
||||
|
||||
Run lint for all the projects affected by changing the index.ts file:
|
||||
|
||||
```bash
|
||||
nx affected:lint --files=libs/mylib/src/index.ts
|
||||
```
|
||||
|
||||
Run lint for all the projects affected by the changes between main and HEAD (e.g., PR):
|
||||
|
||||
```bash
|
||||
nx affected:lint --base=main --head=HEAD
|
||||
```
|
||||
|
||||
Run lint for all the projects affected by the last commit on main:
|
||||
|
||||
```bash
|
||||
nx affected:lint --base=main~1 --head=main
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### all
|
||||
|
||||
All projects
|
||||
|
||||
### base
|
||||
|
||||
Base of the current branch (usually main)
|
||||
|
||||
### configuration
|
||||
|
||||
This is the configuration to use when performing tasks on projects
|
||||
|
||||
### exclude
|
||||
|
||||
Default: ``
|
||||
|
||||
Exclude certain projects from being processed
|
||||
|
||||
### files
|
||||
|
||||
Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas
|
||||
|
||||
### head
|
||||
|
||||
Latest commit of the current branch (usually HEAD)
|
||||
|
||||
### help
|
||||
|
||||
Show help
|
||||
|
||||
### ~~only-failed~~
|
||||
|
||||
Default: `false`
|
||||
|
||||
**Deprecated:** The command to rerun failed projects will appear if projects fail. This now does nothing and will be removed in v15.
|
||||
|
||||
Isolate projects which previously failed
|
||||
|
||||
### parallel
|
||||
|
||||
Max number of parallel processes [default is 3]
|
||||
|
||||
### runner
|
||||
|
||||
This is the name of the tasks runner configured in nx.json
|
||||
|
||||
### skip-nx-cache
|
||||
|
||||
Default: `false`
|
||||
|
||||
Rerun the tasks even when the results are available in the cache
|
||||
|
||||
### uncommitted
|
||||
|
||||
Uncommitted changes
|
||||
|
||||
### untracked
|
||||
|
||||
Untracked changes
|
||||
|
||||
### verbose
|
||||
|
||||
Print additional error stack trace on failure
|
||||
|
||||
### version
|
||||
|
||||
Show version number
|
||||
@ -1,118 +0,0 @@
|
||||
---
|
||||
title: 'affected:test - CLI command'
|
||||
description: 'Test projects affected by changes'
|
||||
---
|
||||
|
||||
# affected:test
|
||||
|
||||
Test projects affected by changes
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
nx affected:test
|
||||
```
|
||||
|
||||
[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.
|
||||
|
||||
### Examples
|
||||
|
||||
Run tests in parallel:
|
||||
|
||||
```bash
|
||||
nx affected:test --parallel=5
|
||||
```
|
||||
|
||||
Run the test target for all projects:
|
||||
|
||||
```bash
|
||||
nx affected:test --all
|
||||
```
|
||||
|
||||
Run tests for all the projects affected by changing the index.ts file:
|
||||
|
||||
```bash
|
||||
nx affected:test --files=libs/mylib/src/index.ts
|
||||
```
|
||||
|
||||
Run tests for all the projects affected by the changes between main and HEAD (e.g., PR):
|
||||
|
||||
```bash
|
||||
nx affected:test --base=main --head=HEAD
|
||||
```
|
||||
|
||||
Run tests for all the projects affected by the last commit on main:
|
||||
|
||||
```bash
|
||||
nx affected:test --base=main~1 --head=main
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### all
|
||||
|
||||
All projects
|
||||
|
||||
### base
|
||||
|
||||
Base of the current branch (usually main)
|
||||
|
||||
### configuration
|
||||
|
||||
This is the configuration to use when performing tasks on projects
|
||||
|
||||
### exclude
|
||||
|
||||
Default: ``
|
||||
|
||||
Exclude certain projects from being processed
|
||||
|
||||
### files
|
||||
|
||||
Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas
|
||||
|
||||
### head
|
||||
|
||||
Latest commit of the current branch (usually HEAD)
|
||||
|
||||
### help
|
||||
|
||||
Show help
|
||||
|
||||
### ~~only-failed~~
|
||||
|
||||
Default: `false`
|
||||
|
||||
**Deprecated:** The command to rerun failed projects will appear if projects fail. This now does nothing and will be removed in v15.
|
||||
|
||||
Isolate projects which previously failed
|
||||
|
||||
### parallel
|
||||
|
||||
Max number of parallel processes [default is 3]
|
||||
|
||||
### runner
|
||||
|
||||
This is the name of the tasks runner configured in nx.json
|
||||
|
||||
### skip-nx-cache
|
||||
|
||||
Default: `false`
|
||||
|
||||
Rerun the tasks even when the results are available in the cache
|
||||
|
||||
### uncommitted
|
||||
|
||||
Uncommitted changes
|
||||
|
||||
### untracked
|
||||
|
||||
Untracked changes
|
||||
|
||||
### verbose
|
||||
|
||||
Print additional error stack trace on failure
|
||||
|
||||
### version
|
||||
|
||||
Show version number
|
||||
@ -1,11 +1,11 @@
|
||||
---
|
||||
title: 'daemon - CLI command'
|
||||
description: "The Nx Daemon is a local server which runs in the background in order to intelligently cache information about the workspace's project graph."
|
||||
description: 'Prints information about the Nx Daemon process'
|
||||
---
|
||||
|
||||
# daemon
|
||||
|
||||
The Nx Daemon is a local server which runs in the background in order to intelligently cache information about the workspace's project graph.
|
||||
Prints information about the Nx Daemon process
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@ -61,10 +61,26 @@ nx migrate --run-migrations=migrations.json
|
||||
|
||||
## Options
|
||||
|
||||
### from
|
||||
|
||||
Use the provided versions for packages instead of the ones installed in node_modules (e.g., --from="@nrwl/react:12.0.0,@nrwl/js:12.0.0")
|
||||
|
||||
### help
|
||||
|
||||
Show help
|
||||
|
||||
### packageAndVersion
|
||||
|
||||
The target package and version (e.g, @nrwl/workspace@13.0.0)
|
||||
|
||||
### runMigrations
|
||||
|
||||
Execute migrations from a file (when the file isn't provided, execute migrations from migrations.json)
|
||||
|
||||
### to
|
||||
|
||||
Use the provided versions for packages instead of the ones calculated by the migrator (e.g., --to="@nrwl/react:12.0.0,@nrwl/js:12.0.0")
|
||||
|
||||
### version
|
||||
|
||||
Show version number
|
||||
|
||||
@ -14,13 +14,3 @@ nx report
|
||||
```
|
||||
|
||||
[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.
|
||||
|
||||
## Options
|
||||
|
||||
### help
|
||||
|
||||
Show help
|
||||
|
||||
### version
|
||||
|
||||
Show version number
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
---
|
||||
title: 'workspace-lint - CLI command'
|
||||
description: 'Lint nx specific workspace files (nx.json, workspace.json), checks if your configuration and your source code are in sync. This command identifies projects with no files in the configured project root folder, as well as files that are not part of any projects in the workspace. Note: To exclude files from this lint rule, you can add them to the `.nxignore` file.'
|
||||
description: 'Lint nx specific workspace files (nx.json, workspace.json)'
|
||||
---
|
||||
|
||||
# workspace-lint
|
||||
|
||||
Lint nx specific workspace files (nx.json, workspace.json), checks if your configuration and your source code are in sync. This command identifies projects with no files in the configured project root folder, as well as files that are not part of any projects in the workspace. Note: To exclude files from this lint rule, you can add them to the `.nxignore` file.
|
||||
Lint nx specific workspace files (nx.json, workspace.json)
|
||||
|
||||
## Usage
|
||||
|
||||
@ -14,13 +14,3 @@ nx workspace-lint
|
||||
```
|
||||
|
||||
[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.
|
||||
|
||||
## Options
|
||||
|
||||
### help
|
||||
|
||||
Show help
|
||||
|
||||
### version
|
||||
|
||||
Show version number
|
||||
|
||||
@ -356,7 +356,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"name": "CLI",
|
||||
"id": "cli",
|
||||
@ -416,26 +415,6 @@
|
||||
"id": "affected",
|
||||
"file": "generated/cli/affected"
|
||||
},
|
||||
{
|
||||
"name": "affected:build",
|
||||
"id": "affected-build",
|
||||
"file": "generated/cli/affected-build"
|
||||
},
|
||||
{
|
||||
"name": "affected:test",
|
||||
"id": "affected-test",
|
||||
"file": "generated/cli/affected-test"
|
||||
},
|
||||
{
|
||||
"name": "affected:lint",
|
||||
"id": "affected-lint",
|
||||
"file": "generated/cli/affected-lint"
|
||||
},
|
||||
{
|
||||
"name": "affected:e2e",
|
||||
"id": "affected-e2e",
|
||||
"file": "generated/cli/affected-e2e"
|
||||
},
|
||||
{
|
||||
"name": "affected:graph",
|
||||
"id": "affected-dep-graph",
|
||||
@ -943,7 +922,6 @@
|
||||
"id": "migrate-stories-to-6-2",
|
||||
"file": "generated/api-storybook/generators/migrate-stories-to-6-2"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "Executors: Build",
|
||||
"id": "executors-build",
|
||||
|
||||
@ -197,7 +197,7 @@ The following is an expanded version showing all options. Your `nx.json` will li
|
||||
},
|
||||
"tasksRunnerOptions": {
|
||||
"default": {
|
||||
"runner": "@nrwl/workspace/tasks-runners/default",
|
||||
"runner": "nx/tasks-runners/default",
|
||||
"options": {
|
||||
"cacheableOperations": ["build", "lint", "test", "e2e"]
|
||||
}
|
||||
@ -327,7 +327,7 @@ Tasks runners are invoked when you run `nx test`, `nx build`, `nx run-many`, `nx
|
||||
named "default" is used by default. Specify a different one like this `nx run-many --target=build --all --runner=another`.
|
||||
|
||||
Tasks runners can accept different options. The following are the options supported
|
||||
by `"@nrwl/workspace/tasks-runners/default"` and `"@nrwl/nx-cloud"`.
|
||||
by `"nx/tasks-runners/default"` and `"@nrwl/nx-cloud"`.
|
||||
|
||||
- `cacheableOperations` defines the list of targets/operations that are cached by Nx.
|
||||
- `parallel` defines the max number of targets ran in parallel (in older versions of Nx you had to
|
||||
@ -349,7 +349,7 @@ by `"@nrwl/workspace/tasks-runners/default"` and `"@nrwl/nx-cloud"`.
|
||||
{
|
||||
"tasksRunnerOptions": {
|
||||
"default": {
|
||||
"runner": "@nrwl/workspace/tasks-runners/default",
|
||||
"runner": "nx/tasks-runners/default",
|
||||
"options": {
|
||||
"cacheableOperations": ["build", "lint", "test", "e2e"],
|
||||
"runtimeCacheInputs": ["node -v"]
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { PackageManager } from 'nx/src/utils/package-manager';
|
||||
|
||||
process.env.SELECTED_CLI = 'angular';
|
||||
|
||||
import {
|
||||
@ -13,7 +15,6 @@ import {
|
||||
uniq,
|
||||
updateFile,
|
||||
} from '@nrwl/e2e/utils';
|
||||
import { PackageManager } from 'nx/src/shared/package-manager';
|
||||
|
||||
describe('convert Angular CLI workspace to an Nx workspace', () => {
|
||||
let project: string;
|
||||
@ -143,7 +144,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
|
||||
'update:check': 'ng update',
|
||||
lint: 'nx workspace-lint && ng lint',
|
||||
graph: 'nx graph',
|
||||
'workspace-schematic': 'nx workspace-schematic',
|
||||
'workspace-generator': 'nx workspace-generator',
|
||||
help: 'nx help',
|
||||
postinstall: 'node ./decorate-angular-cli.js',
|
||||
});
|
||||
@ -153,33 +154,38 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
|
||||
// check nx.json
|
||||
const nxJson = readJson('nx.json');
|
||||
expect(nxJson).toEqual({
|
||||
npmScope: 'projscope',
|
||||
affected: { defaultBase: 'main' },
|
||||
affected: {
|
||||
defaultBase: 'main',
|
||||
},
|
||||
cli: {
|
||||
defaultCollection: '@nrwl/angular',
|
||||
packageManager: packageManager,
|
||||
},
|
||||
defaultProject: project,
|
||||
implicitDependencies: {
|
||||
'.eslintrc.json': '*',
|
||||
'package.json': {
|
||||
dependencies: '*',
|
||||
devDependencies: '*',
|
||||
},
|
||||
'.eslintrc.json': '*',
|
||||
},
|
||||
tasksRunnerOptions: {
|
||||
default: {
|
||||
runner: '@nrwl/workspace/tasks-runners/default',
|
||||
options: {
|
||||
cacheableOperations: ['build', 'lint', 'test', 'e2e'],
|
||||
},
|
||||
},
|
||||
},
|
||||
npmScope: 'projscope',
|
||||
targetDependencies: {
|
||||
build: [
|
||||
{
|
||||
target: 'build',
|
||||
projects: 'dependencies',
|
||||
target: 'build',
|
||||
},
|
||||
],
|
||||
},
|
||||
cli: { defaultCollection: '@nrwl/angular', packageManager },
|
||||
defaultProject: project,
|
||||
tasksRunnerOptions: {
|
||||
default: {
|
||||
options: {
|
||||
cacheableOperations: ['build', 'lint', 'test', 'e2e'],
|
||||
},
|
||||
runner: 'nx/tasks-runners/default',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// check angular.json
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import { packagesWeCareAbout } from '@nrwl/workspace/src/command-line/report';
|
||||
import { renameSync } from 'fs';
|
||||
import {
|
||||
newProject,
|
||||
@ -11,6 +10,7 @@ import {
|
||||
updateFile,
|
||||
updateProjectConfig,
|
||||
} from '@nrwl/e2e/utils';
|
||||
import { packagesWeCareAbout } from 'nx/src/command-line/report';
|
||||
|
||||
describe('Cli', () => {
|
||||
beforeEach(() => newProject());
|
||||
@ -156,7 +156,7 @@ describe('list', () => {
|
||||
describe('migrate', () => {
|
||||
beforeEach(() => newProject());
|
||||
|
||||
it('should run migrations', () => {
|
||||
it('clear-cacheshould run migrations', () => {
|
||||
updateFile(
|
||||
`./node_modules/migrate-parent-package/package.json`,
|
||||
JSON.stringify({
|
||||
@ -210,7 +210,7 @@ describe('migrate', () => {
|
||||
})
|
||||
);
|
||||
|
||||
updateFile('./node_modules/nx/src/commands/migrate.js', (content) => {
|
||||
updateFile('./node_modules/nx/src/command-line/migrate.js', (content) => {
|
||||
const start = content.indexOf('// testing-fetch-start');
|
||||
const end = content.indexOf('// testing-fetch-end');
|
||||
|
||||
|
||||
@ -143,8 +143,7 @@ describe('js e2e', () => {
|
||||
|
||||
expect(readJson(`dist/libs/${lib}/package.json`)).toHaveProperty(
|
||||
'peerDependencies.tslib',
|
||||
rootPackageJson.dependencies.tslib ??
|
||||
rootPackageJson.devDependencies.tslib
|
||||
rootPackageJson.dependencies.tslib
|
||||
);
|
||||
|
||||
updateJson(`libs/${lib}/tsconfig.json`, (json) => {
|
||||
|
||||
@ -10,7 +10,6 @@ import {
|
||||
updateFile,
|
||||
} from '@nrwl/e2e/utils';
|
||||
import * as ts from 'typescript';
|
||||
import { names } from '@nrwl/devkit';
|
||||
|
||||
describe('Linter', () => {
|
||||
describe('linting errors', () => {
|
||||
|
||||
@ -78,7 +78,7 @@ describe('Nx Plugin', () => {
|
||||
|
||||
runCLI(`generate @nrwl/nx-plugin:plugin ${plugin} --linter=eslint`);
|
||||
runCLI(
|
||||
`generate @nrwl/nx-plugin:migration --project=${plugin} --version=${version} --packageJsonUpdates=false`
|
||||
`generate @nrwl/nx-plugin:migration --project=${plugin} --packageVersion=${version} --packageJsonUpdates=false`
|
||||
);
|
||||
|
||||
const lintResults = runCLI(`lint ${plugin}`);
|
||||
|
||||
@ -606,8 +606,8 @@ describe('remove project', () => {
|
||||
*/
|
||||
it('should work', () => {
|
||||
newProject();
|
||||
const lib1 = uniq('mylib');
|
||||
const lib2 = uniq('mylib');
|
||||
const lib1 = uniq('myliba');
|
||||
const lib2 = uniq('mylibb');
|
||||
|
||||
runCLI(`generate @nrwl/workspace:lib ${lib1}`);
|
||||
expect(exists(tmpProjPath(`libs/${lib1}`))).toBeTruthy();
|
||||
@ -628,7 +628,7 @@ describe('remove project', () => {
|
||||
|
||||
let error;
|
||||
try {
|
||||
runCLI(`generate @nrwl/workspace:remove --project ${lib1}`);
|
||||
console.log(runCLI(`generate @nrwl/workspace:remove --project ${lib1}`));
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
263
e2e/workspace-integrations/src/affected.test.ts
Normal file
263
e2e/workspace-integrations/src/affected.test.ts
Normal file
@ -0,0 +1,263 @@
|
||||
import type { NxJsonConfiguration } from '@nrwl/devkit';
|
||||
import {
|
||||
getPackageManagerCommand,
|
||||
isNotWindows,
|
||||
listFiles,
|
||||
newProject,
|
||||
readFile,
|
||||
readJson,
|
||||
readProjectConfig,
|
||||
cleanupProject,
|
||||
rmDist,
|
||||
runCLI,
|
||||
runCLIAsync,
|
||||
runCommand,
|
||||
uniq,
|
||||
updateFile,
|
||||
updateProjectConfig,
|
||||
workspaceConfigName,
|
||||
} from '@nrwl/e2e/utils';
|
||||
|
||||
describe('affected:*', () => {
|
||||
let proj: string;
|
||||
|
||||
beforeEach(() => (proj = newProject()));
|
||||
afterEach(() => cleanupProject());
|
||||
|
||||
it('should print, build, and test affected apps', async () => {
|
||||
const myapp = uniq('myapp');
|
||||
const myapp2 = uniq('myapp2');
|
||||
const mylib = uniq('mylib');
|
||||
const mylib2 = uniq('mylib2');
|
||||
const mypublishablelib = uniq('mypublishablelib');
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
runCLI(`generate @nrwl/react:app ${myapp2}`);
|
||||
runCLI(`generate @nrwl/react:lib ${mylib}`);
|
||||
runCLI(`generate @nrwl/react:lib ${mylib2}`);
|
||||
runCLI(
|
||||
`generate @nrwl/react:lib ${mypublishablelib} --publishable --importPath=@${proj}/${mypublishablelib}`
|
||||
);
|
||||
|
||||
updateFile(
|
||||
`apps/${myapp}/src/app/app.component.spec.ts`,
|
||||
`
|
||||
import '@${proj}/${mylib}';
|
||||
describe('sample test', () => {
|
||||
it('should test', () => {
|
||||
expect(1).toEqual(1);
|
||||
});
|
||||
});
|
||||
`
|
||||
);
|
||||
updateFile(
|
||||
`libs/${mypublishablelib}/src/lib/${mypublishablelib}.module.spec.ts`,
|
||||
`
|
||||
import '@${proj}/${mylib}';
|
||||
describe('sample test', () => {
|
||||
it('should test', () => {
|
||||
expect(1).toEqual(1);
|
||||
});
|
||||
});
|
||||
`
|
||||
);
|
||||
expect(
|
||||
(
|
||||
await runCLIAsync(
|
||||
`affected:apps --files="libs/${mylib}/src/index.ts" --plain`,
|
||||
{ silent: true }
|
||||
)
|
||||
).stdout.trim()
|
||||
).toEqual(myapp);
|
||||
|
||||
const affectedApps = runCLI(
|
||||
`affected:apps --files="libs/${mylib}/src/index.ts"`
|
||||
);
|
||||
expect(affectedApps).toContain(myapp);
|
||||
expect(affectedApps).not.toContain(myapp2);
|
||||
expect(affectedApps).not.toContain(`${myapp}-e2e`);
|
||||
|
||||
const implicitlyAffectedApps = runCLI(
|
||||
'affected:apps --files="tsconfig.base.json"'
|
||||
);
|
||||
expect(implicitlyAffectedApps).toContain(myapp);
|
||||
expect(implicitlyAffectedApps).toContain(myapp2);
|
||||
|
||||
const noAffectedApps = runCLI('affected:apps --files="README.md"');
|
||||
expect(noAffectedApps).not.toContain(myapp);
|
||||
expect(noAffectedApps).not.toContain(myapp2);
|
||||
|
||||
expect(
|
||||
(
|
||||
await runCLIAsync(
|
||||
`affected:libs --files="libs/${mylib}/src/index.ts" --plain`,
|
||||
{ silent: true }
|
||||
)
|
||||
).stdout.trim()
|
||||
).toEqual(`${mylib} ${mypublishablelib}`);
|
||||
|
||||
const affectedLibs = runCLI(
|
||||
`affected:libs --files="libs/${mylib}/src/index.ts"`
|
||||
);
|
||||
expect(affectedLibs).toContain(mypublishablelib);
|
||||
expect(affectedLibs).toContain(mylib);
|
||||
expect(affectedLibs).not.toContain(mylib2);
|
||||
|
||||
const implicitlyAffectedLibs = runCLI(
|
||||
'affected:libs --files="tsconfig.base.json"'
|
||||
);
|
||||
expect(implicitlyAffectedLibs).toContain(mypublishablelib);
|
||||
expect(implicitlyAffectedLibs).toContain(mylib);
|
||||
expect(implicitlyAffectedLibs).toContain(mylib2);
|
||||
|
||||
const noAffectedLibsNonExistentFile = runCLI(
|
||||
'affected:libs --files="tsconfig.json"'
|
||||
);
|
||||
expect(noAffectedLibsNonExistentFile).not.toContain(mypublishablelib);
|
||||
expect(noAffectedLibsNonExistentFile).not.toContain(mylib);
|
||||
expect(noAffectedLibsNonExistentFile).not.toContain(mylib2);
|
||||
|
||||
const noAffectedLibs = runCLI('affected:libs --files="README.md"');
|
||||
expect(noAffectedLibs).not.toContain(mypublishablelib);
|
||||
expect(noAffectedLibs).not.toContain(mylib);
|
||||
expect(noAffectedLibs).not.toContain(mylib2);
|
||||
|
||||
// build
|
||||
const build = runCLI(
|
||||
`affected:build --files="libs/${mylib}/src/index.ts" --parallel`
|
||||
);
|
||||
expect(build).toContain(`Running target build for 2 project(s):`);
|
||||
expect(build).toContain(`- ${myapp}`);
|
||||
expect(build).toContain(`- ${mypublishablelib}`);
|
||||
expect(build).not.toContain('is not registered with the build command');
|
||||
expect(build).toContain('Successfully ran target build');
|
||||
|
||||
const buildExcluded = runCLI(
|
||||
`affected:build --files="libs/${mylib}/src/index.ts" --exclude ${myapp}`
|
||||
);
|
||||
expect(buildExcluded).toContain(`Running target build for 1 project(s):`);
|
||||
expect(buildExcluded).toContain(`- ${mypublishablelib}`);
|
||||
|
||||
// test
|
||||
updateFile(
|
||||
`apps/${myapp}/src/app/app.component.spec.ts`,
|
||||
readFile(`apps/${myapp}/src/app/app.component.spec.ts`).replace(
|
||||
'.toEqual(1)',
|
||||
'.toEqual(2)'
|
||||
)
|
||||
);
|
||||
|
||||
const failedTests = runCLI(
|
||||
`affected:test --files="libs/${mylib}/src/index.ts"`,
|
||||
{ silenceError: true }
|
||||
);
|
||||
expect(failedTests).toContain(`Running target test for 3 project(s):`);
|
||||
expect(failedTests).toContain(`- ${mylib}`);
|
||||
expect(failedTests).toContain(`- ${myapp}`);
|
||||
expect(failedTests).toContain(`- ${mypublishablelib}`);
|
||||
expect(failedTests).toContain(`Failed tasks:`);
|
||||
|
||||
// Fix failing Unit Test
|
||||
updateFile(
|
||||
`apps/${myapp}/src/app/app.component.spec.ts`,
|
||||
readFile(`apps/${myapp}/src/app/app.component.spec.ts`).replace(
|
||||
'.toEqual(2)',
|
||||
'.toEqual(1)'
|
||||
)
|
||||
);
|
||||
}, 1000000);
|
||||
});
|
||||
|
||||
describe('affected (with git)', () => {
|
||||
let myapp;
|
||||
let myapp2;
|
||||
let mylib;
|
||||
|
||||
beforeEach(() => {
|
||||
myapp = uniq('myapp');
|
||||
myapp2 = uniq('myapp');
|
||||
mylib = uniq('mylib');
|
||||
newProject();
|
||||
const nxJson: NxJsonConfiguration = readJson('nx.json');
|
||||
|
||||
delete nxJson.implicitDependencies;
|
||||
|
||||
updateFile('nx.json', JSON.stringify(nxJson));
|
||||
runCommand(`git init`);
|
||||
runCommand(`git config user.email "test@test.com"`);
|
||||
runCommand(`git config user.name "Test"`);
|
||||
runCommand(`git config commit.gpgsign false`);
|
||||
try {
|
||||
runCommand(
|
||||
`git add . && git commit -am "initial commit" && git checkout -b main`
|
||||
);
|
||||
} catch (e) {}
|
||||
});
|
||||
afterAll(() => cleanupProject());
|
||||
|
||||
function generateAll() {
|
||||
runCLI(`generate @nrwl/angular:app ${myapp}`);
|
||||
runCLI(`generate @nrwl/angular:app ${myapp2}`);
|
||||
runCLI(`generate @nrwl/angular:lib ${mylib}`);
|
||||
runCommand(`git add . && git commit -am "add all"`);
|
||||
}
|
||||
|
||||
it('should not affect other projects by generating a new project', () => {
|
||||
// TODO: investigate why affected gives different results on windows
|
||||
if (isNotWindows()) {
|
||||
runCLI(`generate @nrwl/angular:app ${myapp}`);
|
||||
expect(runCLI('affected:apps')).toContain(myapp);
|
||||
runCommand(`git add . && git commit -am "add ${myapp}"`);
|
||||
|
||||
runCLI(`generate @nrwl/angular:app ${myapp2}`);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp);
|
||||
expect(runCLI('affected:apps')).toContain(myapp2);
|
||||
runCommand(`git add . && git commit -am "add ${myapp2}"`);
|
||||
|
||||
runCLI(`generate @nrwl/angular:lib ${mylib}`);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp2);
|
||||
expect(runCLI('affected:libs')).toContain(mylib);
|
||||
}
|
||||
}, 1000000);
|
||||
|
||||
it('should detect changes to projects based on tags changes', () => {
|
||||
// TODO: investigate why affected gives different results on windows
|
||||
if (isNotWindows()) {
|
||||
generateAll();
|
||||
updateProjectConfig(myapp, (config) => ({
|
||||
...config,
|
||||
tags: ['tag'],
|
||||
}));
|
||||
expect(runCLI('affected:apps')).toContain(myapp);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp2);
|
||||
expect(runCLI('affected:libs')).not.toContain(mylib);
|
||||
}
|
||||
});
|
||||
|
||||
it('should detect changes to projects based on the workspace.json', () => {
|
||||
// TODO: investigate why affected gives different results on windows
|
||||
if (isNotWindows()) {
|
||||
generateAll();
|
||||
updateProjectConfig(myapp, (config) => ({
|
||||
...config,
|
||||
prefix: 'my-app',
|
||||
}));
|
||||
|
||||
expect(runCLI('affected:apps')).toContain(myapp);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp2);
|
||||
expect(runCLI('affected:libs')).not.toContain(mylib);
|
||||
}
|
||||
});
|
||||
|
||||
it('should affect all projects by removing projects', () => {
|
||||
generateAll();
|
||||
updateFile(workspaceConfigName(), (old) => {
|
||||
const workspaceJson = JSON.parse(old);
|
||||
delete workspaceJson.projects[mylib];
|
||||
return JSON.stringify(workspaceJson, null, 2);
|
||||
});
|
||||
expect(runCLI('affected:apps')).toContain(myapp);
|
||||
expect(runCLI('affected:apps')).toContain(myapp2);
|
||||
expect(runCLI('affected:libs')).not.toContain(mylib);
|
||||
});
|
||||
});
|
||||
241
e2e/workspace-integrations/src/cache.test.ts
Normal file
241
e2e/workspace-integrations/src/cache.test.ts
Normal file
@ -0,0 +1,241 @@
|
||||
import {
|
||||
cleanupProject,
|
||||
listFiles,
|
||||
newProject,
|
||||
rmDist,
|
||||
runCLI,
|
||||
uniq,
|
||||
updateFile,
|
||||
updateProjectConfig,
|
||||
} from '@nrwl/e2e/utils';
|
||||
|
||||
describe('cache', () => {
|
||||
beforeEach(() => newProject());
|
||||
|
||||
afterEach(() => cleanupProject());
|
||||
|
||||
it('should cache command execution', async () => {
|
||||
const myapp1 = uniq('myapp1');
|
||||
const myapp2 = uniq('myapp2');
|
||||
runCLI(`generate @nrwl/web:app ${myapp1}`);
|
||||
runCLI(`generate @nrwl/web:app ${myapp2}`);
|
||||
const files = `--files="apps/${myapp1}/src/main.ts,apps/${myapp2}/src/main.ts"`;
|
||||
|
||||
// run build with caching
|
||||
// --------------------------------------------
|
||||
const outputThatPutsDataIntoCache = runCLI(`affected:build ${files}`);
|
||||
const filesApp1 = listFiles(`dist/apps/${myapp1}`);
|
||||
const filesApp2 = listFiles(`dist/apps/${myapp2}`);
|
||||
// now the data is in cache
|
||||
expect(outputThatPutsDataIntoCache).not.toContain(
|
||||
'read the output from the cache'
|
||||
);
|
||||
|
||||
rmDist();
|
||||
|
||||
const outputWithBothBuildTasksCached = runCLI(`affected:build ${files}`);
|
||||
expect(outputWithBothBuildTasksCached).toContain(
|
||||
'read the output from the cache'
|
||||
);
|
||||
expectCached(outputWithBothBuildTasksCached, [myapp1, myapp2]);
|
||||
expect(listFiles(`dist/apps/${myapp1}`)).toEqual(filesApp1);
|
||||
expect(listFiles(`dist/apps/${myapp2}`)).toEqual(filesApp2);
|
||||
|
||||
// run with skipping cache
|
||||
const outputWithBothBuildTasksCachedButSkipped = runCLI(
|
||||
`affected:build ${files} --skip-nx-cache`
|
||||
);
|
||||
expect(outputWithBothBuildTasksCachedButSkipped).not.toContain(
|
||||
`read the output from the cache`
|
||||
);
|
||||
|
||||
// touch myapp1
|
||||
// --------------------------------------------
|
||||
updateFile(`apps/${myapp1}/src/main.ts`, (c) => {
|
||||
return `${c}\n//some comment`;
|
||||
});
|
||||
const outputWithBuildApp2Cached = runCLI(`affected:build ${files}`);
|
||||
expect(outputWithBuildApp2Cached).toContain(
|
||||
'read the output from the cache'
|
||||
);
|
||||
expectMatchedOutput(outputWithBuildApp2Cached, [myapp2]);
|
||||
|
||||
// touch package.json
|
||||
// --------------------------------------------
|
||||
updateFile(`package.json`, (c) => {
|
||||
const r = JSON.parse(c);
|
||||
r.description = 'different';
|
||||
return JSON.stringify(r);
|
||||
});
|
||||
const outputWithNoBuildCached = runCLI(`affected:build ${files}`);
|
||||
expect(outputWithNoBuildCached).not.toContain(
|
||||
'read the output from the cache'
|
||||
);
|
||||
|
||||
// build individual project with caching
|
||||
const individualBuildWithCache = runCLI(`build ${myapp1}`);
|
||||
expect(individualBuildWithCache).toContain(
|
||||
'existing outputs match the cache'
|
||||
);
|
||||
|
||||
// skip caching when building individual projects
|
||||
const individualBuildWithSkippedCache = runCLI(
|
||||
`build ${myapp1} --skip-nx-cache`
|
||||
);
|
||||
expect(individualBuildWithSkippedCache).not.toContain(
|
||||
'existing outputs match the cache'
|
||||
);
|
||||
|
||||
// run lint with caching
|
||||
// --------------------------------------------
|
||||
const outputWithNoLintCached = runCLI(`affected:lint ${files}`);
|
||||
expect(outputWithNoLintCached).not.toContain(
|
||||
'read the output from the cache'
|
||||
);
|
||||
|
||||
const outputWithBothLintTasksCached = runCLI(`affected:lint ${files}`);
|
||||
expect(outputWithBothLintTasksCached).toContain(
|
||||
'read the output from the cache'
|
||||
);
|
||||
expectCached(outputWithBothLintTasksCached, [
|
||||
myapp1,
|
||||
myapp2,
|
||||
`${myapp1}-e2e`,
|
||||
`${myapp2}-e2e`,
|
||||
]);
|
||||
|
||||
// cache task failures
|
||||
// --------------------------------------------
|
||||
// updateFile('workspace.json', (c) => {
|
||||
// const workspaceJson = JSON.parse(c);
|
||||
// workspaceJson.projects[myapp1].targets.lint = {
|
||||
// executor: '@nrwl/workspace:run-commands',
|
||||
// options: {
|
||||
// command: 'echo hi && exit 1',
|
||||
// },
|
||||
// };
|
||||
// return JSON.stringify(workspaceJson, null, 2);
|
||||
// });
|
||||
// const failingRun = runCLI(`lint ${myapp1}`, {
|
||||
// silenceError: true,
|
||||
// env: { ...process.env, NX_CACHE_FAILURES: 'true' },
|
||||
// });
|
||||
// expect(failingRun).not.toContain('[retrieved from cache]');
|
||||
//
|
||||
// const cachedFailingRun = runCLI(`lint ${myapp1}`, {
|
||||
// silenceError: true,
|
||||
// env: { ...process.env, NX_CACHE_FAILURES: 'true' },
|
||||
// });
|
||||
// expect(cachedFailingRun).toContain('[retrieved from cache]');
|
||||
|
||||
// run without caching
|
||||
// --------------------------------------------
|
||||
|
||||
// disable caching
|
||||
// --------------------------------------------
|
||||
updateFile('nx.json', (c) => {
|
||||
const nxJson = JSON.parse(c);
|
||||
nxJson.tasksRunnerOptions = {
|
||||
default: {
|
||||
options: {
|
||||
cacheableOperations: [],
|
||||
},
|
||||
},
|
||||
};
|
||||
return JSON.stringify(nxJson, null, 2);
|
||||
});
|
||||
|
||||
const outputWithoutCachingEnabled1 = runCLI(`affected:build ${files}`);
|
||||
|
||||
expect(outputWithoutCachingEnabled1).not.toContain(
|
||||
'read the output from the cache'
|
||||
);
|
||||
|
||||
const outputWithoutCachingEnabled2 = runCLI(`affected:build ${files}`);
|
||||
expect(outputWithoutCachingEnabled2).not.toContain(
|
||||
'read the output from the cache'
|
||||
);
|
||||
}, 120000);
|
||||
|
||||
it('should only cache specific files if build outputs is configured with specific files', async () => {
|
||||
const mylib1 = uniq('mylib1');
|
||||
runCLI(`generate @nrwl/react:lib ${mylib1} --buildable`);
|
||||
|
||||
// Update outputs in workspace.json to just be a particular file
|
||||
updateProjectConfig(mylib1, (config) => {
|
||||
config.targets['build-base'] = {
|
||||
...config.targets.build,
|
||||
};
|
||||
config.targets.build = {
|
||||
executor: '@nrwl/workspace:run-commands',
|
||||
outputs: [`dist/libs/${mylib1}/index.esm.js`],
|
||||
options: {
|
||||
commands: [
|
||||
{
|
||||
command: `npx nx run ${mylib1}:build-base`,
|
||||
},
|
||||
],
|
||||
parallel: false,
|
||||
},
|
||||
};
|
||||
return config;
|
||||
});
|
||||
|
||||
// run build with caching
|
||||
// --------------------------------------------
|
||||
const outputThatPutsDataIntoCache = runCLI(`run ${mylib1}:build`);
|
||||
// now the data is in cache
|
||||
expect(outputThatPutsDataIntoCache).not.toContain('cache');
|
||||
|
||||
rmDist();
|
||||
|
||||
const outputWithBuildTasksCached = runCLI(`run ${mylib1}:build`);
|
||||
expect(outputWithBuildTasksCached).toContain('cache');
|
||||
expectCached(outputWithBuildTasksCached, [mylib1]);
|
||||
// Ensure that only the specific file in outputs was copied to cache
|
||||
expect(listFiles(`dist/libs/${mylib1}`)).toEqual([`index.esm.js`]);
|
||||
}, 120000);
|
||||
|
||||
function expectCached(
|
||||
actualOutput: string,
|
||||
expectedCachedProjects: string[]
|
||||
) {
|
||||
expectProjectMatchTaskCacheStatus(actualOutput, expectedCachedProjects);
|
||||
}
|
||||
|
||||
function expectMatchedOutput(
|
||||
actualOutput: string,
|
||||
expectedMatchedOutputProjects: string[]
|
||||
) {
|
||||
expectProjectMatchTaskCacheStatus(
|
||||
actualOutput,
|
||||
expectedMatchedOutputProjects,
|
||||
'existing outputs match the cache'
|
||||
);
|
||||
}
|
||||
|
||||
function expectProjectMatchTaskCacheStatus(
|
||||
actualOutput: string,
|
||||
expectedProjects: string[],
|
||||
cacheStatus: string = 'local cache'
|
||||
) {
|
||||
const matchingProjects = [];
|
||||
const lines = actualOutput.split('\n');
|
||||
lines.forEach((s) => {
|
||||
if (s.trimStart().startsWith(`> nx run`)) {
|
||||
const projectName = s
|
||||
.trimStart()
|
||||
.split(`> nx run `)[1]
|
||||
.split(':')[0]
|
||||
.trim();
|
||||
if (s.indexOf(cacheStatus) > -1) {
|
||||
matchingProjects.push(projectName);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
matchingProjects.sort((a, b) => a.localeCompare(b));
|
||||
expectedProjects.sort((a, b) => a.localeCompare(b));
|
||||
expect(matchingProjects).toEqual(expectedProjects);
|
||||
}
|
||||
});
|
||||
159
e2e/workspace-integrations/src/print-affected.test.ts
Normal file
159
e2e/workspace-integrations/src/print-affected.test.ts
Normal file
@ -0,0 +1,159 @@
|
||||
import {
|
||||
cleanupProject,
|
||||
getPackageManagerCommand,
|
||||
newProject,
|
||||
runCLI,
|
||||
runCLIAsync,
|
||||
uniq,
|
||||
updateFile,
|
||||
} from '@nrwl/e2e/utils';
|
||||
|
||||
describe('print-affected', () => {
|
||||
let proj: string;
|
||||
|
||||
beforeEach(() => (proj = newProject()));
|
||||
afterEach(() => cleanupProject());
|
||||
|
||||
it('should print information about affected projects', async () => {
|
||||
const myapp = uniq('myapp-a');
|
||||
const myapp2 = uniq('myapp-b');
|
||||
const mylib = uniq('mylib');
|
||||
const mylib2 = uniq('mylib2');
|
||||
const mypublishablelib = uniq('mypublishablelib');
|
||||
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
runCLI(`generate @nrwl/react:app ${myapp2}`);
|
||||
runCLI(`generate @nrwl/react:lib ${mylib}`);
|
||||
runCLI(`generate @nrwl/react:lib ${mylib2}`);
|
||||
runCLI(`generate @nrwl/react:lib ${mypublishablelib} --buildable`);
|
||||
|
||||
updateFile(
|
||||
`apps/${myapp}/src/main.tsx`,
|
||||
`
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import "@${proj}/${mylib}";
|
||||
import "@${proj}/${mypublishablelib}";
|
||||
import App from './app/app';
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('root'));
|
||||
|
||||
`
|
||||
);
|
||||
|
||||
updateFile(
|
||||
`apps/${myapp2}/src/main.tsx`,
|
||||
`
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import "@${proj}/${mylib}";
|
||||
import "@${proj}/${mypublishablelib}";
|
||||
import App from './app/app';
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('root'));
|
||||
`
|
||||
);
|
||||
|
||||
const resWithoutTarget = JSON.parse(
|
||||
(
|
||||
await runCLIAsync(`print-affected --files=apps/${myapp}/src/main.tsx`, {
|
||||
silent: true,
|
||||
})
|
||||
).stdout
|
||||
);
|
||||
expect(resWithoutTarget.tasks).toEqual([]);
|
||||
compareTwoArrays(resWithoutTarget.projects, [`${myapp}-e2e`, myapp]);
|
||||
|
||||
const resWithTarget = JSON.parse(
|
||||
(
|
||||
await runCLIAsync(
|
||||
`print-affected --files=apps/${myapp}/src/main.tsx --target=test`,
|
||||
{ silent: true }
|
||||
)
|
||||
).stdout.trim()
|
||||
);
|
||||
|
||||
const { runNx } = getPackageManagerCommand();
|
||||
expect(resWithTarget.tasks[0]).toMatchObject({
|
||||
id: `${myapp}:test`,
|
||||
overrides: {},
|
||||
target: {
|
||||
project: myapp,
|
||||
target: 'test',
|
||||
},
|
||||
command: `${runNx} run ${myapp}:test`,
|
||||
outputs: [`coverage/apps/${myapp}`],
|
||||
});
|
||||
compareTwoArrays(resWithTarget.projects, [`${myapp}-e2e`, myapp]);
|
||||
|
||||
const resWithDeps = JSON.parse(
|
||||
(
|
||||
await runCLIAsync(
|
||||
`print-affected --files=apps/${myapp}/src/main.tsx --target=build --with-deps`,
|
||||
{ silent: true }
|
||||
)
|
||||
).stdout
|
||||
);
|
||||
|
||||
expect(resWithDeps.tasks[0]).toMatchObject({
|
||||
id: `${myapp}:build:production`,
|
||||
overrides: {},
|
||||
target: {
|
||||
project: myapp,
|
||||
target: 'build',
|
||||
},
|
||||
command: `${runNx} run ${myapp}:build:production`,
|
||||
outputs: [`dist/apps/${myapp}`],
|
||||
});
|
||||
|
||||
expect(resWithDeps.tasks[1]).toMatchObject({
|
||||
id: `${mypublishablelib}:build`,
|
||||
overrides: {},
|
||||
target: {
|
||||
project: mypublishablelib,
|
||||
target: 'build',
|
||||
},
|
||||
command: `${runNx} run ${mypublishablelib}:build`,
|
||||
outputs: [`dist/libs/${mypublishablelib}`],
|
||||
});
|
||||
|
||||
compareTwoArrays(resWithDeps.projects, [
|
||||
mylib,
|
||||
mypublishablelib,
|
||||
myapp,
|
||||
`${myapp}-e2e`,
|
||||
]);
|
||||
|
||||
const resWithTargetWithSelect1 = (
|
||||
await runCLIAsync(
|
||||
`print-affected --files=apps/${myapp}/src/main.tsx --target=test --select=projects`,
|
||||
{ silent: true }
|
||||
)
|
||||
).stdout.trim();
|
||||
compareTwoSerializedArrays(
|
||||
resWithTargetWithSelect1,
|
||||
`${myapp}-e2e, ${myapp}`
|
||||
);
|
||||
|
||||
const resWithTargetWithSelect2 = (
|
||||
await runCLIAsync(
|
||||
`print-affected --files=apps/${myapp}/src/main.tsx --target=test --select="tasks.target.project"`,
|
||||
{ silent: true }
|
||||
)
|
||||
).stdout.trim();
|
||||
compareTwoSerializedArrays(resWithTargetWithSelect2, `${myapp}`);
|
||||
}, 120000);
|
||||
|
||||
function compareTwoSerializedArrays(a: string, b: string) {
|
||||
compareTwoArrays(
|
||||
a.split(',').map((_) => _.trim()),
|
||||
b.split(',').map((_) => _.trim())
|
||||
);
|
||||
}
|
||||
|
||||
function compareTwoArrays(a: string[], b: string[]) {
|
||||
expect(a.sort((x, y) => x.localeCompare(y))).toEqual(
|
||||
b.sort((x, y) => x.localeCompare(y))
|
||||
);
|
||||
}
|
||||
});
|
||||
109
e2e/workspace-integrations/src/run-many.test.ts
Normal file
109
e2e/workspace-integrations/src/run-many.test.ts
Normal file
@ -0,0 +1,109 @@
|
||||
import type { NxJsonConfiguration } from '@nrwl/devkit';
|
||||
import {
|
||||
getPackageManagerCommand,
|
||||
isNotWindows,
|
||||
listFiles,
|
||||
newProject,
|
||||
readFile,
|
||||
readJson,
|
||||
readProjectConfig,
|
||||
cleanupProject,
|
||||
rmDist,
|
||||
runCLI,
|
||||
runCLIAsync,
|
||||
runCommand,
|
||||
uniq,
|
||||
updateFile,
|
||||
updateProjectConfig,
|
||||
workspaceConfigName,
|
||||
} from '@nrwl/e2e/utils';
|
||||
|
||||
describe('run-many', () => {
|
||||
let proj: string;
|
||||
|
||||
beforeEach(() => (proj = newProject()));
|
||||
afterEach(() => {
|
||||
cleanupProject();
|
||||
});
|
||||
|
||||
it('should build specific and all projects', () => {
|
||||
const appA = uniq('appa-rand');
|
||||
const libA = uniq('liba-rand');
|
||||
const libB = uniq('libb-rand');
|
||||
const libC = uniq('libc-rand');
|
||||
const libD = uniq('libd-rand');
|
||||
|
||||
runCLI(`generate @nrwl/react:app ${appA}`);
|
||||
runCLI(`generate @nrwl/react:lib ${libA} --buildable --defaults`);
|
||||
runCLI(`generate @nrwl/react:lib ${libB} --buildable --defaults`);
|
||||
runCLI(`generate @nrwl/react:lib ${libC} --buildable --defaults`);
|
||||
runCLI(`generate @nrwl/react:lib ${libD} --defaults`);
|
||||
|
||||
// libA depends on libC
|
||||
updateFile(
|
||||
`libs/${libA}/src/lib/${libA}.module.spec.ts`,
|
||||
`
|
||||
import '@${proj}/${libC}';
|
||||
describe('sample test', () => {
|
||||
it('should test', () => {
|
||||
expect(1).toEqual(1);
|
||||
});
|
||||
});
|
||||
`
|
||||
);
|
||||
|
||||
// testing run many starting'
|
||||
const buildParallel = runCLI(
|
||||
`run-many --target=build --projects="${libC},${libB}"`
|
||||
);
|
||||
expect(buildParallel).toContain(`Running target build for 2 project(s):`);
|
||||
expect(buildParallel).not.toContain(`- ${libA}`);
|
||||
expect(buildParallel).toContain(`- ${libB}`);
|
||||
expect(buildParallel).toContain(`- ${libC}`);
|
||||
expect(buildParallel).not.toContain(`- ${libD}`);
|
||||
expect(buildParallel).toContain('Successfully ran target build');
|
||||
|
||||
// testing run many --all starting
|
||||
const buildAllParallel = runCLI(`run-many --target=build --all`);
|
||||
expect(buildAllParallel).toContain(
|
||||
`Running target build for 4 project(s):`
|
||||
);
|
||||
expect(buildAllParallel).toContain(`- ${appA}`);
|
||||
expect(buildAllParallel).toContain(`- ${libA}`);
|
||||
expect(buildAllParallel).toContain(`- ${libB}`);
|
||||
expect(buildAllParallel).toContain(`- ${libC}`);
|
||||
expect(buildAllParallel).not.toContain(`- ${libD}`);
|
||||
expect(buildAllParallel).toContain('Successfully ran target build');
|
||||
|
||||
// testing run many when project depends on other projects
|
||||
const buildWithDeps = runCLI(
|
||||
`run-many --target=build --projects="${libA}"`
|
||||
);
|
||||
expect(buildWithDeps).toContain(
|
||||
`Running target build for 1 project(s) and 1 task(s) they depend on:`
|
||||
);
|
||||
expect(buildWithDeps).toContain(`- ${libA}`);
|
||||
expect(buildWithDeps).toContain(`${libC}`); // build should include libC as dependency
|
||||
expect(buildWithDeps).not.toContain(`- ${libB}`);
|
||||
expect(buildWithDeps).not.toContain(`- ${libD}`);
|
||||
expect(buildWithDeps).toContain('Successfully ran target build');
|
||||
|
||||
// testing run many --configuration
|
||||
const buildConfig = runCLI(
|
||||
`run-many --target=build --projects="${appA},${libA}" --prod`
|
||||
);
|
||||
expect(buildConfig).toContain(
|
||||
`Running target build for 2 project(s) and 1 task(s) they depend on:`
|
||||
);
|
||||
expect(buildConfig).toContain(`run ${appA}:build:production`);
|
||||
expect(buildConfig).toContain(`run ${libA}:build`);
|
||||
expect(buildConfig).toContain(`run ${libC}:build`);
|
||||
expect(buildConfig).toContain('Successfully ran target build');
|
||||
|
||||
// testing run many with daemon enabled
|
||||
const buildWithDaemon = runCLI(`run-many --target=build --all`, {
|
||||
env: { ...process.env, NX_DAEMON: 'true' },
|
||||
});
|
||||
expect(buildWithDaemon).toContain(`Successfully ran target build`);
|
||||
}, 1000000);
|
||||
});
|
||||
179
e2e/workspace-integrations/src/run-one.test.ts
Normal file
179
e2e/workspace-integrations/src/run-one.test.ts
Normal file
@ -0,0 +1,179 @@
|
||||
import {
|
||||
cleanupProject,
|
||||
newProject,
|
||||
readFile,
|
||||
readJson,
|
||||
readProjectConfig,
|
||||
runCLI,
|
||||
runCommand,
|
||||
uniq,
|
||||
updateFile,
|
||||
updateProjectConfig,
|
||||
} from '@nrwl/e2e/utils';
|
||||
|
||||
describe('run-one', () => {
|
||||
let proj: string;
|
||||
|
||||
beforeAll(() => (proj = newProject()));
|
||||
afterAll(() => {
|
||||
cleanupProject();
|
||||
});
|
||||
|
||||
it('should build a specific project', () => {
|
||||
const myapp = uniq('app');
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
|
||||
runCLI(`build ${myapp}`);
|
||||
}, 10000);
|
||||
|
||||
it('should run targets from package json', () => {
|
||||
const myapp = uniq('app');
|
||||
const target = uniq('script');
|
||||
const expectedOutput = uniq('myEchoedString');
|
||||
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
updateFile(
|
||||
`apps/${myapp}/package.json`,
|
||||
JSON.stringify({
|
||||
name: myapp,
|
||||
scripts: {
|
||||
[target]: `echo ${expectedOutput}`,
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
expect(runCLI(`${target} ${myapp}`)).toContain(expectedOutput);
|
||||
}, 10000);
|
||||
|
||||
it('should run targets inferred from plugin-specified project files', () => {
|
||||
// Setup an app to extend
|
||||
const myapp = uniq('app');
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
|
||||
// Register an Nx plugin
|
||||
const plugin = `module.exports = {
|
||||
projectFilePatterns: ['inferred-project.nxproject'],
|
||||
registerProjectTargets: () => ({
|
||||
"echo": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"options": {
|
||||
"command": "echo inferred-target"
|
||||
}
|
||||
}
|
||||
})
|
||||
}`;
|
||||
updateFile('tools/local-plugin/plugin.js', plugin);
|
||||
updateFile('nx.json', (c) => {
|
||||
const nxJson = JSON.parse(c);
|
||||
nxJson.plugins = ['./tools/local-plugin/plugin.js'];
|
||||
return JSON.stringify(nxJson, null, 2);
|
||||
});
|
||||
|
||||
// Create a custom project file for the app
|
||||
updateFile(`apps/${myapp}/inferred-project.nxproject`, 'contents');
|
||||
|
||||
expect(runCLI(`echo ${myapp}`)).toContain('inferred-target');
|
||||
});
|
||||
|
||||
it('should build a specific project with the daemon enabled', () => {
|
||||
const myapp = uniq('app');
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
|
||||
const buildWithDaemon = runCLI(`build ${myapp}`, {
|
||||
env: { ...process.env, NX_DAEMON: 'true' },
|
||||
});
|
||||
|
||||
expect(buildWithDaemon).toContain('Successfully ran target build');
|
||||
}, 10000);
|
||||
|
||||
it('should build the project when within the project root', () => {
|
||||
const myapp = uniq('app');
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
|
||||
// Should work within the project directory
|
||||
expect(runCommand(`cd apps/${myapp}/src && npx nx build`)).toContain(
|
||||
`nx run ${myapp}:build:production`
|
||||
);
|
||||
}, 10000);
|
||||
|
||||
it('should error for invalid configurations', () => {
|
||||
const myapp = uniq('app');
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
// configuration has to be valid for the initiating project
|
||||
expect(() => runCLI(`build ${myapp} -c=invalid`)).toThrow();
|
||||
}, 10000);
|
||||
|
||||
describe('target dependencies', () => {
|
||||
let myapp;
|
||||
let mylib1;
|
||||
let mylib2;
|
||||
beforeAll(() => {
|
||||
myapp = uniq('myapp');
|
||||
mylib1 = uniq('mylib1');
|
||||
mylib2 = uniq('mylib1');
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
runCLI(`generate @nrwl/react:lib ${mylib1} --buildable`);
|
||||
runCLI(`generate @nrwl/react:lib ${mylib2} --buildable`);
|
||||
|
||||
updateFile(
|
||||
`apps/${myapp}/src/main.ts`,
|
||||
`
|
||||
import "@${proj}/${mylib1}";
|
||||
import "@${proj}/${mylib2}";
|
||||
`
|
||||
);
|
||||
});
|
||||
|
||||
it('should be able to include deps using target dependencies', () => {
|
||||
const originalWorkspace = readProjectConfig(myapp);
|
||||
updateProjectConfig(myapp, (config) => {
|
||||
config.targets.build.dependsOn = [
|
||||
{
|
||||
target: 'build',
|
||||
projects: 'dependencies',
|
||||
},
|
||||
];
|
||||
return config;
|
||||
});
|
||||
|
||||
const output = runCLI(`build ${myapp}`);
|
||||
expect(output).toContain(
|
||||
`NX Running target build for project ${myapp} and 2 task(s) it depends on`
|
||||
);
|
||||
expect(output).toContain(myapp);
|
||||
expect(output).toContain(mylib1);
|
||||
expect(output).toContain(mylib2);
|
||||
|
||||
updateProjectConfig(myapp, () => originalWorkspace);
|
||||
}, 10000);
|
||||
|
||||
it('should be able to include deps using target dependencies defined at the root', () => {
|
||||
const originalNxJson = readFile('nx.json');
|
||||
const nxJson = readJson('nx.json');
|
||||
nxJson.targetDependencies = {
|
||||
build: [
|
||||
{
|
||||
target: 'build',
|
||||
projects: 'dependencies',
|
||||
},
|
||||
/**
|
||||
* At the time of writing, the above object is also the default in nx.json, so we need to make an additional change to ensure
|
||||
* that the JSON is structurally different and the build results are therefore not read from the cache as part of this test.
|
||||
*/
|
||||
{ target: 'e2e-extra-entry-to-bust-cache', projects: 'dependencies' },
|
||||
],
|
||||
};
|
||||
updateFile('nx.json', JSON.stringify(nxJson));
|
||||
|
||||
const output = runCLI(`build ${myapp}`);
|
||||
expect(output).toContain(
|
||||
`NX Running target build for project ${myapp} and 2 task(s) it depends on`
|
||||
);
|
||||
expect(output).toContain(myapp);
|
||||
expect(output).toContain(mylib1);
|
||||
expect(output).toContain(mylib2);
|
||||
|
||||
updateFile('nx.json', originalNxJson);
|
||||
}, 10000);
|
||||
});
|
||||
});
|
||||
@ -1,941 +0,0 @@
|
||||
import type { NxJsonConfiguration } from '@nrwl/devkit';
|
||||
import {
|
||||
getPackageManagerCommand,
|
||||
isNotWindows,
|
||||
listFiles,
|
||||
newProject,
|
||||
readFile,
|
||||
readJson,
|
||||
readProjectConfig,
|
||||
cleanupProject,
|
||||
rmDist,
|
||||
runCLI,
|
||||
runCLIAsync,
|
||||
runCommand,
|
||||
uniq,
|
||||
updateFile,
|
||||
updateProjectConfig,
|
||||
workspaceConfigName,
|
||||
} from '@nrwl/e2e/utils';
|
||||
|
||||
describe('run-one', () => {
|
||||
let proj: string;
|
||||
|
||||
beforeAll(() => (proj = newProject()));
|
||||
afterAll(() => {
|
||||
cleanupProject();
|
||||
});
|
||||
|
||||
it('should build a specific project', () => {
|
||||
const myapp = uniq('app');
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
|
||||
runCLI(`build ${myapp}`);
|
||||
}, 10000);
|
||||
|
||||
it('should run targets from package json', () => {
|
||||
const myapp = uniq('app');
|
||||
const target = uniq('script');
|
||||
const expectedOutput = uniq('myEchoedString');
|
||||
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
updateFile(
|
||||
`apps/${myapp}/package.json`,
|
||||
JSON.stringify({
|
||||
name: myapp,
|
||||
scripts: {
|
||||
[target]: `echo ${expectedOutput}`,
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
expect(runCLI(`${target} ${myapp}`)).toContain(expectedOutput);
|
||||
}, 10000);
|
||||
|
||||
it('should run targets inferred from plugin-specified project files', () => {
|
||||
// Setup an app to extend
|
||||
const myapp = uniq('app');
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
|
||||
// Register an Nx plugin
|
||||
const plugin = `module.exports = {
|
||||
projectFilePatterns: ['inferred-project.nxproject'],
|
||||
registerProjectTargets: () => ({
|
||||
"echo": {
|
||||
"executor": "@nrwl/workspace:run-commands",
|
||||
"options": {
|
||||
"command": "echo inferred-target"
|
||||
}
|
||||
}
|
||||
})
|
||||
}`;
|
||||
updateFile('tools/local-plugin/plugin.js', plugin);
|
||||
updateFile('nx.json', (c) => {
|
||||
const nxJson = JSON.parse(c);
|
||||
nxJson.plugins = ['./tools/local-plugin/plugin.js'];
|
||||
return JSON.stringify(nxJson, null, 2);
|
||||
});
|
||||
|
||||
// Create a custom project file for the app
|
||||
updateFile(`apps/${myapp}/inferred-project.nxproject`, 'contents');
|
||||
|
||||
expect(runCLI(`echo ${myapp}`)).toContain('inferred-target');
|
||||
});
|
||||
|
||||
it('should build a specific project with the daemon enabled', () => {
|
||||
const myapp = uniq('app');
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
|
||||
const buildWithDaemon = runCLI(`build ${myapp}`, {
|
||||
env: { ...process.env, NX_DAEMON: 'true' },
|
||||
});
|
||||
|
||||
expect(buildWithDaemon).toContain('Successfully ran target build');
|
||||
}, 10000);
|
||||
|
||||
it('should build the project when within the project root', () => {
|
||||
const myapp = uniq('app');
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
|
||||
// Should work within the project directory
|
||||
expect(runCommand(`cd apps/${myapp}-e2e/src && npx nx lint`)).toContain(
|
||||
`nx run ${myapp}-e2e:lint`
|
||||
);
|
||||
}, 10000);
|
||||
|
||||
it('should error for invalid configurations', () => {
|
||||
const myapp = uniq('app');
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
// configuration has to be valid for the initiating project
|
||||
expect(() => runCLI(`build ${myapp} -c=invalid`)).toThrow();
|
||||
}, 10000);
|
||||
|
||||
describe('--with-deps', () => {
|
||||
let myapp;
|
||||
let mylib1;
|
||||
let mylib2;
|
||||
beforeAll(() => {
|
||||
myapp = uniq('myapp');
|
||||
mylib1 = uniq('mylib1');
|
||||
mylib2 = uniq('mylib1');
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
runCLI(`generate @nrwl/react:lib ${mylib1} --buildable`);
|
||||
runCLI(`generate @nrwl/react:lib ${mylib2} --buildable`);
|
||||
|
||||
updateFile(
|
||||
`apps/${myapp}/src/main.ts`,
|
||||
`
|
||||
import "@${proj}/${mylib1}";
|
||||
import "@${proj}/${mylib2}";
|
||||
`
|
||||
);
|
||||
});
|
||||
|
||||
it('should include deps', () => {
|
||||
const output = runCLI(`test ${myapp} --with-deps`);
|
||||
expect(output).toContain(
|
||||
`NX Running target test for project ${myapp} and 2 task(s) it depends on`
|
||||
);
|
||||
expect(output).toContain(myapp);
|
||||
expect(output).toContain(mylib1);
|
||||
expect(output).toContain(mylib2);
|
||||
}, 10000);
|
||||
|
||||
it('should include deps without the configuration if it does not exist', () => {
|
||||
const buildWithDeps = runCLI(`build ${myapp} --with-deps --prod`);
|
||||
expect(buildWithDeps).toContain('Successfully ran target build');
|
||||
expect(buildWithDeps).toContain(`nx run ${myapp}:build:production`);
|
||||
expect(buildWithDeps).toContain(`nx run ${mylib1}:build`);
|
||||
expect(buildWithDeps).toContain(`nx run ${mylib2}:build`);
|
||||
expect(buildWithDeps).not.toContain(`nx run ${mylib1}:build:production`);
|
||||
expect(buildWithDeps).not.toContain(`nx run ${mylib2}:build:production`);
|
||||
}, 10000);
|
||||
});
|
||||
|
||||
describe('target dependencies', () => {
|
||||
let myapp;
|
||||
let mylib1;
|
||||
let mylib2;
|
||||
beforeAll(() => {
|
||||
myapp = uniq('myapp');
|
||||
mylib1 = uniq('mylib1');
|
||||
mylib2 = uniq('mylib1');
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
runCLI(`generate @nrwl/react:lib ${mylib1} --buildable`);
|
||||
runCLI(`generate @nrwl/react:lib ${mylib2} --buildable`);
|
||||
|
||||
updateFile(
|
||||
`apps/${myapp}/src/main.ts`,
|
||||
`
|
||||
import "@${proj}/${mylib1}";
|
||||
import "@${proj}/${mylib2}";
|
||||
`
|
||||
);
|
||||
});
|
||||
|
||||
it('should be able to include deps using target dependencies', () => {
|
||||
const originalWorkspace = readProjectConfig(myapp);
|
||||
updateProjectConfig(myapp, (config) => {
|
||||
config.targets.build.dependsOn = [
|
||||
{
|
||||
target: 'build',
|
||||
projects: 'dependencies',
|
||||
},
|
||||
];
|
||||
return config;
|
||||
});
|
||||
|
||||
const output = runCLI(`build ${myapp}`);
|
||||
expect(output).toContain(
|
||||
`NX Running target build for project ${myapp} and 2 task(s) it depends on`
|
||||
);
|
||||
expect(output).toContain(myapp);
|
||||
expect(output).toContain(mylib1);
|
||||
expect(output).toContain(mylib2);
|
||||
|
||||
updateProjectConfig(myapp, () => originalWorkspace);
|
||||
}, 10000);
|
||||
|
||||
it('should be able to include deps using target dependencies defined at the root', () => {
|
||||
const originalNxJson = readFile('nx.json');
|
||||
const nxJson = readJson('nx.json');
|
||||
nxJson.targetDependencies = {
|
||||
build: [
|
||||
{
|
||||
target: 'build',
|
||||
projects: 'dependencies',
|
||||
},
|
||||
/**
|
||||
* At the time of writing, the above object is also the default in nx.json, so we need to make an additional change to ensure
|
||||
* that the JSON is structurally different and the build results are therefore not read from the cache as part of this test.
|
||||
*/
|
||||
{ target: 'e2e-extra-entry-to-bust-cache', projects: 'dependencies' },
|
||||
],
|
||||
};
|
||||
updateFile('nx.json', JSON.stringify(nxJson));
|
||||
|
||||
const output = runCLI(`build ${myapp}`);
|
||||
expect(output).toContain(
|
||||
`NX Running target build for project ${myapp} and 2 task(s) it depends on`
|
||||
);
|
||||
expect(output).toContain(myapp);
|
||||
expect(output).toContain(mylib1);
|
||||
expect(output).toContain(mylib2);
|
||||
|
||||
updateFile('nx.json', originalNxJson);
|
||||
}, 10000);
|
||||
});
|
||||
});
|
||||
|
||||
describe('run-many', () => {
|
||||
let proj: string;
|
||||
|
||||
beforeEach(() => (proj = newProject()));
|
||||
afterEach(() => {
|
||||
cleanupProject();
|
||||
});
|
||||
|
||||
it('should build specific and all projects', () => {
|
||||
const appA = uniq('appa-rand');
|
||||
const libA = uniq('liba-rand');
|
||||
const libB = uniq('libb-rand');
|
||||
const libC = uniq('libc-rand');
|
||||
const libD = uniq('libd-rand');
|
||||
|
||||
runCLI(`generate @nrwl/react:app ${appA}`);
|
||||
runCLI(`generate @nrwl/react:lib ${libA} --buildable --defaults`);
|
||||
runCLI(`generate @nrwl/react:lib ${libB} --buildable --defaults`);
|
||||
runCLI(`generate @nrwl/react:lib ${libC} --buildable --defaults`);
|
||||
runCLI(`generate @nrwl/react:lib ${libD} --defaults`);
|
||||
|
||||
// libA depends on libC
|
||||
updateFile(
|
||||
`libs/${libA}/src/lib/${libA}.module.spec.ts`,
|
||||
`
|
||||
import '@${proj}/${libC}';
|
||||
describe('sample test', () => {
|
||||
it('should test', () => {
|
||||
expect(1).toEqual(1);
|
||||
});
|
||||
});
|
||||
`
|
||||
);
|
||||
|
||||
// testing run many starting'
|
||||
const buildParallel = runCLI(
|
||||
`run-many --target=build --projects="${libC},${libB}"`
|
||||
);
|
||||
expect(buildParallel).toContain(`Running target build for 2 project(s):`);
|
||||
expect(buildParallel).not.toContain(`- ${libA}`);
|
||||
expect(buildParallel).toContain(`- ${libB}`);
|
||||
expect(buildParallel).toContain(`- ${libC}`);
|
||||
expect(buildParallel).not.toContain(`- ${libD}`);
|
||||
expect(buildParallel).toContain('Successfully ran target build');
|
||||
|
||||
// testing run many --all starting
|
||||
const buildAllParallel = runCLI(`run-many --target=build --all`);
|
||||
expect(buildAllParallel).toContain(
|
||||
`Running target build for 4 project(s):`
|
||||
);
|
||||
expect(buildAllParallel).toContain(`- ${appA}`);
|
||||
expect(buildAllParallel).toContain(`- ${libA}`);
|
||||
expect(buildAllParallel).toContain(`- ${libB}`);
|
||||
expect(buildAllParallel).toContain(`- ${libC}`);
|
||||
expect(buildAllParallel).not.toContain(`- ${libD}`);
|
||||
expect(buildAllParallel).toContain('Successfully ran target build');
|
||||
|
||||
// testing run many --with-deps
|
||||
const buildWithDeps = runCLI(
|
||||
`run-many --target=build --projects="${libA}" --with-deps`
|
||||
);
|
||||
expect(buildWithDeps).toContain(
|
||||
`Running target build for 1 project(s) and 1 task(s) they depend on:`
|
||||
);
|
||||
expect(buildWithDeps).toContain(`- ${libA}`);
|
||||
expect(buildWithDeps).toContain(`${libC}`); // build should include libC as dependency
|
||||
expect(buildWithDeps).not.toContain(`- ${libB}`);
|
||||
expect(buildWithDeps).not.toContain(`- ${libD}`);
|
||||
expect(buildWithDeps).toContain('Successfully ran target build');
|
||||
|
||||
// testing run many --configuration
|
||||
const buildConfig = runCLI(
|
||||
`run-many --target=build --projects="${appA},${libA}" --prod`
|
||||
);
|
||||
expect(buildConfig).toContain(
|
||||
`Running target build for 2 project(s) and 1 task(s) they depend on:`
|
||||
);
|
||||
expect(buildConfig).toContain(`run ${appA}:build:production`);
|
||||
expect(buildConfig).toContain(`run ${libA}:build`);
|
||||
expect(buildConfig).toContain(`run ${libC}:build`);
|
||||
expect(buildConfig).toContain('Successfully ran target build');
|
||||
|
||||
// testing run many with daemon enabled
|
||||
const buildWithDaemon = runCLI(`run-many --target=build --all`, {
|
||||
env: { ...process.env, NX_DAEMON: 'true' },
|
||||
});
|
||||
expect(buildWithDaemon).toContain(`Successfully ran target build`);
|
||||
}, 1000000);
|
||||
});
|
||||
|
||||
describe('affected:*', () => {
|
||||
let proj: string;
|
||||
|
||||
beforeEach(() => (proj = newProject()));
|
||||
afterEach(() => cleanupProject());
|
||||
|
||||
it('should print, build, and test affected apps', async () => {
|
||||
const myapp = uniq('myapp');
|
||||
const myapp2 = uniq('myapp2');
|
||||
const mylib = uniq('mylib');
|
||||
const mylib2 = uniq('mylib2');
|
||||
const mypublishablelib = uniq('mypublishablelib');
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
runCLI(`generate @nrwl/react:app ${myapp2}`);
|
||||
runCLI(`generate @nrwl/react:lib ${mylib}`);
|
||||
runCLI(`generate @nrwl/react:lib ${mylib2}`);
|
||||
runCLI(
|
||||
`generate @nrwl/react:lib ${mypublishablelib} --publishable --importPath=@${proj}/${mypublishablelib}`
|
||||
);
|
||||
|
||||
updateFile(
|
||||
`apps/${myapp}/src/app/app.component.spec.ts`,
|
||||
`
|
||||
import '@${proj}/${mylib}';
|
||||
describe('sample test', () => {
|
||||
it('should test', () => {
|
||||
expect(1).toEqual(1);
|
||||
});
|
||||
});
|
||||
`
|
||||
);
|
||||
updateFile(
|
||||
`libs/${mypublishablelib}/src/lib/${mypublishablelib}.module.spec.ts`,
|
||||
`
|
||||
import '@${proj}/${mylib}';
|
||||
describe('sample test', () => {
|
||||
it('should test', () => {
|
||||
expect(1).toEqual(1);
|
||||
});
|
||||
});
|
||||
`
|
||||
);
|
||||
expect(
|
||||
(
|
||||
await runCLIAsync(
|
||||
`affected:apps --files="libs/${mylib}/src/index.ts" --plain`,
|
||||
{ silent: true }
|
||||
)
|
||||
).stdout.trim()
|
||||
).toEqual(myapp);
|
||||
|
||||
const affectedApps = runCLI(
|
||||
`affected:apps --files="libs/${mylib}/src/index.ts"`
|
||||
);
|
||||
expect(affectedApps).toContain(myapp);
|
||||
expect(affectedApps).not.toContain(myapp2);
|
||||
expect(affectedApps).not.toContain(`${myapp}-e2e`);
|
||||
|
||||
const implicitlyAffectedApps = runCLI(
|
||||
'affected:apps --files="tsconfig.base.json"'
|
||||
);
|
||||
expect(implicitlyAffectedApps).toContain(myapp);
|
||||
expect(implicitlyAffectedApps).toContain(myapp2);
|
||||
|
||||
const noAffectedApps = runCLI('affected:apps --files="README.md"');
|
||||
expect(noAffectedApps).not.toContain(myapp);
|
||||
expect(noAffectedApps).not.toContain(myapp2);
|
||||
|
||||
expect(
|
||||
(
|
||||
await runCLIAsync(
|
||||
`affected:libs --files="libs/${mylib}/src/index.ts" --plain`,
|
||||
{ silent: true }
|
||||
)
|
||||
).stdout.trim()
|
||||
).toEqual(`${mylib} ${mypublishablelib}`);
|
||||
|
||||
const affectedLibs = runCLI(
|
||||
`affected:libs --files="libs/${mylib}/src/index.ts"`
|
||||
);
|
||||
expect(affectedLibs).toContain(mypublishablelib);
|
||||
expect(affectedLibs).toContain(mylib);
|
||||
expect(affectedLibs).not.toContain(mylib2);
|
||||
|
||||
const implicitlyAffectedLibs = runCLI(
|
||||
'affected:libs --files="tsconfig.base.json"'
|
||||
);
|
||||
expect(implicitlyAffectedLibs).toContain(mypublishablelib);
|
||||
expect(implicitlyAffectedLibs).toContain(mylib);
|
||||
expect(implicitlyAffectedLibs).toContain(mylib2);
|
||||
|
||||
const noAffectedLibsNonExistentFile = runCLI(
|
||||
'affected:libs --files="tsconfig.json"'
|
||||
);
|
||||
expect(noAffectedLibsNonExistentFile).not.toContain(mypublishablelib);
|
||||
expect(noAffectedLibsNonExistentFile).not.toContain(mylib);
|
||||
expect(noAffectedLibsNonExistentFile).not.toContain(mylib2);
|
||||
|
||||
const noAffectedLibs = runCLI('affected:libs --files="README.md"');
|
||||
expect(noAffectedLibs).not.toContain(mypublishablelib);
|
||||
expect(noAffectedLibs).not.toContain(mylib);
|
||||
expect(noAffectedLibs).not.toContain(mylib2);
|
||||
|
||||
// build
|
||||
const build = runCLI(
|
||||
`affected:build --files="libs/${mylib}/src/index.ts" --parallel`
|
||||
);
|
||||
expect(build).toContain(`Running target build for 2 project(s):`);
|
||||
expect(build).toContain(`- ${myapp}`);
|
||||
expect(build).toContain(`- ${mypublishablelib}`);
|
||||
expect(build).not.toContain('is not registered with the build command');
|
||||
expect(build).toContain('Successfully ran target build');
|
||||
|
||||
const buildExcluded = runCLI(
|
||||
`affected:build --files="libs/${mylib}/src/index.ts" --exclude ${myapp}`
|
||||
);
|
||||
expect(buildExcluded).toContain(`Running target build for 1 project(s):`);
|
||||
expect(buildExcluded).toContain(`- ${mypublishablelib}`);
|
||||
|
||||
// test
|
||||
updateFile(
|
||||
`apps/${myapp}/src/app/app.component.spec.ts`,
|
||||
readFile(`apps/${myapp}/src/app/app.component.spec.ts`).replace(
|
||||
'.toEqual(1)',
|
||||
'.toEqual(2)'
|
||||
)
|
||||
);
|
||||
|
||||
const failedTests = runCLI(
|
||||
`affected:test --files="libs/${mylib}/src/index.ts"`,
|
||||
{ silenceError: true }
|
||||
);
|
||||
expect(failedTests).toContain(`Running target test for 3 project(s):`);
|
||||
expect(failedTests).toContain(`- ${mylib}`);
|
||||
expect(failedTests).toContain(`- ${myapp}`);
|
||||
expect(failedTests).toContain(`- ${mypublishablelib}`);
|
||||
expect(failedTests).toContain(`Failed tasks:`);
|
||||
|
||||
// Fix failing Unit Test
|
||||
updateFile(
|
||||
`apps/${myapp}/src/app/app.component.spec.ts`,
|
||||
readFile(`apps/${myapp}/src/app/app.component.spec.ts`).replace(
|
||||
'.toEqual(2)',
|
||||
'.toEqual(1)'
|
||||
)
|
||||
);
|
||||
}, 1000000);
|
||||
});
|
||||
|
||||
describe('affected (with git)', () => {
|
||||
let myapp;
|
||||
let myapp2;
|
||||
let mylib;
|
||||
|
||||
beforeEach(() => {
|
||||
myapp = uniq('myapp');
|
||||
myapp2 = uniq('myapp');
|
||||
mylib = uniq('mylib');
|
||||
newProject();
|
||||
const nxJson: NxJsonConfiguration = readJson('nx.json');
|
||||
|
||||
delete nxJson.implicitDependencies;
|
||||
|
||||
updateFile('nx.json', JSON.stringify(nxJson));
|
||||
runCommand(`git init`);
|
||||
runCommand(`git config user.email "test@test.com"`);
|
||||
runCommand(`git config user.name "Test"`);
|
||||
runCommand(`git config commit.gpgsign false`);
|
||||
runCommand(
|
||||
`git add . && git commit -am "initial commit" && git checkout -b main`
|
||||
);
|
||||
});
|
||||
afterAll(() => cleanupProject());
|
||||
|
||||
function generateAll() {
|
||||
runCLI(`generate @nrwl/angular:app ${myapp}`);
|
||||
runCLI(`generate @nrwl/angular:app ${myapp2}`);
|
||||
runCLI(`generate @nrwl/angular:lib ${mylib}`);
|
||||
runCommand(`git add . && git commit -am "add all"`);
|
||||
}
|
||||
|
||||
it('should not affect other projects by generating a new project', () => {
|
||||
// TODO: investigate why affected gives different results on windows
|
||||
if (isNotWindows()) {
|
||||
runCLI(`generate @nrwl/angular:app ${myapp}`);
|
||||
expect(runCLI('affected:apps')).toContain(myapp);
|
||||
runCommand(`git add . && git commit -am "add ${myapp}"`);
|
||||
|
||||
runCLI(`generate @nrwl/angular:app ${myapp2}`);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp);
|
||||
expect(runCLI('affected:apps')).toContain(myapp2);
|
||||
runCommand(`git add . && git commit -am "add ${myapp2}"`);
|
||||
|
||||
runCLI(`generate @nrwl/angular:lib ${mylib}`);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp2);
|
||||
expect(runCLI('affected:libs')).toContain(mylib);
|
||||
}
|
||||
}, 1000000);
|
||||
|
||||
it('should detect changes to projects based on tags changes', () => {
|
||||
// TODO: investigate why affected gives different results on windows
|
||||
if (isNotWindows()) {
|
||||
generateAll();
|
||||
updateProjectConfig(myapp, (config) => ({
|
||||
...config,
|
||||
tags: ['tag'],
|
||||
}));
|
||||
expect(runCLI('affected:apps')).toContain(myapp);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp2);
|
||||
expect(runCLI('affected:libs')).not.toContain(mylib);
|
||||
}
|
||||
});
|
||||
|
||||
it('should detect changes to projects based on the workspace.json', () => {
|
||||
// TODO: investigate why affected gives different results on windows
|
||||
if (isNotWindows()) {
|
||||
generateAll();
|
||||
updateProjectConfig(myapp, (config) => ({
|
||||
...config,
|
||||
prefix: 'my-app',
|
||||
}));
|
||||
|
||||
expect(runCLI('affected:apps')).toContain(myapp);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp2);
|
||||
expect(runCLI('affected:libs')).not.toContain(mylib);
|
||||
}
|
||||
});
|
||||
|
||||
it('should affect all projects by removing projects', () => {
|
||||
generateAll();
|
||||
updateFile(workspaceConfigName(), (old) => {
|
||||
const workspaceJson = JSON.parse(old);
|
||||
delete workspaceJson.projects[mylib];
|
||||
return JSON.stringify(workspaceJson, null, 2);
|
||||
});
|
||||
expect(runCLI('affected:apps')).toContain(myapp);
|
||||
expect(runCLI('affected:apps')).toContain(myapp2);
|
||||
expect(runCLI('affected:libs')).not.toContain(mylib);
|
||||
});
|
||||
});
|
||||
|
||||
describe('print-affected', () => {
|
||||
let proj: string;
|
||||
|
||||
beforeEach(() => (proj = newProject()));
|
||||
afterEach(() => cleanupProject());
|
||||
|
||||
it('should print information about affected projects', async () => {
|
||||
const myapp = uniq('myapp-a');
|
||||
const myapp2 = uniq('myapp-b');
|
||||
const mylib = uniq('mylib');
|
||||
const mylib2 = uniq('mylib2');
|
||||
const mypublishablelib = uniq('mypublishablelib');
|
||||
|
||||
runCLI(`generate @nrwl/react:app ${myapp}`);
|
||||
runCLI(`generate @nrwl/react:app ${myapp2}`);
|
||||
runCLI(`generate @nrwl/react:lib ${mylib}`);
|
||||
runCLI(`generate @nrwl/react:lib ${mylib2}`);
|
||||
runCLI(`generate @nrwl/react:lib ${mypublishablelib} --buildable`);
|
||||
|
||||
updateFile(
|
||||
`apps/${myapp}/src/main.tsx`,
|
||||
`
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import "@${proj}/${mylib}";
|
||||
import "@${proj}/${mypublishablelib}";
|
||||
import App from './app/app';
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('root'));
|
||||
|
||||
`
|
||||
);
|
||||
|
||||
updateFile(
|
||||
`apps/${myapp2}/src/main.tsx`,
|
||||
`
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import "@${proj}/${mylib}";
|
||||
import "@${proj}/${mypublishablelib}";
|
||||
import App from './app/app';
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('root'));
|
||||
`
|
||||
);
|
||||
|
||||
const resWithoutTarget = JSON.parse(
|
||||
(
|
||||
await runCLIAsync(`print-affected --files=apps/${myapp}/src/main.tsx`, {
|
||||
silent: true,
|
||||
})
|
||||
).stdout
|
||||
);
|
||||
expect(resWithoutTarget.tasks).toEqual([]);
|
||||
compareTwoArrays(resWithoutTarget.projects, [`${myapp}-e2e`, myapp]);
|
||||
|
||||
const resWithTarget = JSON.parse(
|
||||
(
|
||||
await runCLIAsync(
|
||||
`print-affected --files=apps/${myapp}/src/main.tsx --target=test`,
|
||||
{ silent: true }
|
||||
)
|
||||
).stdout.trim()
|
||||
);
|
||||
|
||||
const { runNx } = getPackageManagerCommand();
|
||||
expect(resWithTarget.tasks[0]).toMatchObject({
|
||||
id: `${myapp}:test`,
|
||||
overrides: {},
|
||||
target: {
|
||||
project: myapp,
|
||||
target: 'test',
|
||||
},
|
||||
command: `${runNx} run ${myapp}:test`,
|
||||
outputs: [`coverage/apps/${myapp}`],
|
||||
});
|
||||
compareTwoArrays(resWithTarget.projects, [`${myapp}-e2e`, myapp]);
|
||||
|
||||
const resWithDeps = JSON.parse(
|
||||
(
|
||||
await runCLIAsync(
|
||||
`print-affected --files=apps/${myapp}/src/main.tsx --target=build --with-deps`,
|
||||
{ silent: true }
|
||||
)
|
||||
).stdout
|
||||
);
|
||||
|
||||
expect(resWithDeps.tasks[0]).toMatchObject({
|
||||
id: `${myapp}:build:production`,
|
||||
overrides: {},
|
||||
target: {
|
||||
project: myapp,
|
||||
target: 'build',
|
||||
},
|
||||
command: `${runNx} run ${myapp}:build:production`,
|
||||
outputs: [`dist/apps/${myapp}`],
|
||||
});
|
||||
|
||||
expect(resWithDeps.tasks[1]).toMatchObject({
|
||||
id: `${mypublishablelib}:build`,
|
||||
overrides: {},
|
||||
target: {
|
||||
project: mypublishablelib,
|
||||
target: 'build',
|
||||
},
|
||||
command: `${runNx} run ${mypublishablelib}:build`,
|
||||
outputs: [`dist/libs/${mypublishablelib}`],
|
||||
});
|
||||
|
||||
compareTwoArrays(resWithDeps.projects, [
|
||||
mylib,
|
||||
mypublishablelib,
|
||||
myapp,
|
||||
`${myapp}-e2e`,
|
||||
]);
|
||||
|
||||
const resWithTargetWithSelect1 = (
|
||||
await runCLIAsync(
|
||||
`print-affected --files=apps/${myapp}/src/main.tsx --target=test --select=projects`,
|
||||
{ silent: true }
|
||||
)
|
||||
).stdout.trim();
|
||||
compareTwoSerializedArrays(
|
||||
resWithTargetWithSelect1,
|
||||
`${myapp}-e2e, ${myapp}`
|
||||
);
|
||||
|
||||
const resWithTargetWithSelect2 = (
|
||||
await runCLIAsync(
|
||||
`print-affected --files=apps/${myapp}/src/main.tsx --target=test --select="tasks.target.project"`,
|
||||
{ silent: true }
|
||||
)
|
||||
).stdout.trim();
|
||||
compareTwoSerializedArrays(resWithTargetWithSelect2, `${myapp}`);
|
||||
}, 120000);
|
||||
|
||||
function compareTwoSerializedArrays(a: string, b: string) {
|
||||
compareTwoArrays(
|
||||
a.split(',').map((_) => _.trim()),
|
||||
b.split(',').map((_) => _.trim())
|
||||
);
|
||||
}
|
||||
|
||||
function compareTwoArrays(a: string[], b: string[]) {
|
||||
expect(a.sort((x, y) => x.localeCompare(y))).toEqual(
|
||||
b.sort((x, y) => x.localeCompare(y))
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
describe('cache', () => {
|
||||
beforeEach(() => newProject());
|
||||
|
||||
afterEach(() => cleanupProject());
|
||||
|
||||
it('should cache command execution', async () => {
|
||||
const myapp1 = uniq('myapp1');
|
||||
const myapp2 = uniq('myapp2');
|
||||
runCLI(`generate @nrwl/web:app ${myapp1}`);
|
||||
runCLI(`generate @nrwl/web:app ${myapp2}`);
|
||||
const files = `--files="apps/${myapp1}/src/main.ts,apps/${myapp2}/src/main.ts"`;
|
||||
|
||||
// run build with caching
|
||||
// --------------------------------------------
|
||||
const outputThatPutsDataIntoCache = runCLI(`affected:build ${files}`);
|
||||
const filesApp1 = listFiles(`dist/apps/${myapp1}`);
|
||||
const filesApp2 = listFiles(`dist/apps/${myapp2}`);
|
||||
// now the data is in cache
|
||||
expect(outputThatPutsDataIntoCache).not.toContain(
|
||||
'read the output from the cache'
|
||||
);
|
||||
|
||||
rmDist();
|
||||
|
||||
const outputWithBothBuildTasksCached = runCLI(`affected:build ${files}`);
|
||||
expect(outputWithBothBuildTasksCached).toContain(
|
||||
'read the output from the cache'
|
||||
);
|
||||
expectCached(outputWithBothBuildTasksCached, [myapp1, myapp2]);
|
||||
expect(listFiles(`dist/apps/${myapp1}`)).toEqual(filesApp1);
|
||||
expect(listFiles(`dist/apps/${myapp2}`)).toEqual(filesApp2);
|
||||
|
||||
// run with skipping cache
|
||||
const outputWithBothBuildTasksCachedButSkipped = runCLI(
|
||||
`affected:build ${files} --skip-nx-cache`
|
||||
);
|
||||
expect(outputWithBothBuildTasksCachedButSkipped).not.toContain(
|
||||
`read the output from the cache`
|
||||
);
|
||||
|
||||
// touch myapp1
|
||||
// --------------------------------------------
|
||||
updateFile(`apps/${myapp1}/src/main.ts`, (c) => {
|
||||
return `${c}\n//some comment`;
|
||||
});
|
||||
const outputWithBuildApp2Cached = runCLI(`affected:build ${files}`);
|
||||
expect(outputWithBuildApp2Cached).toContain(
|
||||
'read the output from the cache'
|
||||
);
|
||||
expectMatchedOutput(outputWithBuildApp2Cached, [myapp2]);
|
||||
|
||||
// touch package.json
|
||||
// --------------------------------------------
|
||||
updateFile(`package.json`, (c) => {
|
||||
const r = JSON.parse(c);
|
||||
r.description = 'different';
|
||||
return JSON.stringify(r);
|
||||
});
|
||||
const outputWithNoBuildCached = runCLI(`affected:build ${files}`);
|
||||
expect(outputWithNoBuildCached).not.toContain(
|
||||
'read the output from the cache'
|
||||
);
|
||||
|
||||
// build individual project with caching
|
||||
const individualBuildWithCache = runCLI(`build ${myapp1}`);
|
||||
expect(individualBuildWithCache).toContain(
|
||||
'existing outputs match the cache'
|
||||
);
|
||||
|
||||
// skip caching when building individual projects
|
||||
const individualBuildWithSkippedCache = runCLI(
|
||||
`build ${myapp1} --skip-nx-cache`
|
||||
);
|
||||
expect(individualBuildWithSkippedCache).not.toContain(
|
||||
'existing outputs match the cache'
|
||||
);
|
||||
|
||||
// run lint with caching
|
||||
// --------------------------------------------
|
||||
const outputWithNoLintCached = runCLI(`affected:lint ${files}`);
|
||||
expect(outputWithNoLintCached).not.toContain(
|
||||
'read the output from the cache'
|
||||
);
|
||||
|
||||
const outputWithBothLintTasksCached = runCLI(`affected:lint ${files}`);
|
||||
expect(outputWithBothLintTasksCached).toContain(
|
||||
'read the output from the cache'
|
||||
);
|
||||
expectCached(outputWithBothLintTasksCached, [
|
||||
myapp1,
|
||||
myapp2,
|
||||
`${myapp1}-e2e`,
|
||||
`${myapp2}-e2e`,
|
||||
]);
|
||||
|
||||
// cache task failures
|
||||
// --------------------------------------------
|
||||
// updateFile('workspace.json', (c) => {
|
||||
// const workspaceJson = JSON.parse(c);
|
||||
// workspaceJson.projects[myapp1].targets.lint = {
|
||||
// executor: '@nrwl/workspace:run-commands',
|
||||
// options: {
|
||||
// command: 'echo hi && exit 1',
|
||||
// },
|
||||
// };
|
||||
// return JSON.stringify(workspaceJson, null, 2);
|
||||
// });
|
||||
// const failingRun = runCLI(`lint ${myapp1}`, {
|
||||
// silenceError: true,
|
||||
// env: { ...process.env, NX_CACHE_FAILURES: 'true' },
|
||||
// });
|
||||
// expect(failingRun).not.toContain('[retrieved from cache]');
|
||||
//
|
||||
// const cachedFailingRun = runCLI(`lint ${myapp1}`, {
|
||||
// silenceError: true,
|
||||
// env: { ...process.env, NX_CACHE_FAILURES: 'true' },
|
||||
// });
|
||||
// expect(cachedFailingRun).toContain('[retrieved from cache]');
|
||||
|
||||
// run without caching
|
||||
// --------------------------------------------
|
||||
|
||||
// disable caching
|
||||
// --------------------------------------------
|
||||
updateFile('nx.json', (c) => {
|
||||
const nxJson = JSON.parse(c);
|
||||
nxJson.tasksRunnerOptions = {
|
||||
default: {
|
||||
options: {
|
||||
cacheableOperations: [],
|
||||
},
|
||||
},
|
||||
};
|
||||
return JSON.stringify(nxJson, null, 2);
|
||||
});
|
||||
|
||||
const outputWithoutCachingEnabled1 = runCLI(`affected:build ${files}`);
|
||||
|
||||
expect(outputWithoutCachingEnabled1).not.toContain(
|
||||
'read the output from the cache'
|
||||
);
|
||||
|
||||
const outputWithoutCachingEnabled2 = runCLI(`affected:build ${files}`);
|
||||
expect(outputWithoutCachingEnabled2).not.toContain(
|
||||
'read the output from the cache'
|
||||
);
|
||||
}, 120000);
|
||||
|
||||
it('should only cache specific files if build outputs is configured with specific files', async () => {
|
||||
const mylib1 = uniq('mylib1');
|
||||
runCLI(`generate @nrwl/react:lib ${mylib1} --buildable`);
|
||||
|
||||
// Update outputs in workspace.json to just be a particular file
|
||||
updateProjectConfig(mylib1, (config) => {
|
||||
config.targets['build-base'] = {
|
||||
...config.targets.build,
|
||||
};
|
||||
config.targets.build = {
|
||||
executor: '@nrwl/workspace:run-commands',
|
||||
outputs: [`dist/libs/${mylib1}/index.esm.js`],
|
||||
options: {
|
||||
commands: [
|
||||
{
|
||||
command: `npx nx run ${mylib1}:build-base`,
|
||||
},
|
||||
],
|
||||
parallel: false,
|
||||
},
|
||||
};
|
||||
return config;
|
||||
});
|
||||
|
||||
// run build with caching
|
||||
// --------------------------------------------
|
||||
const outputThatPutsDataIntoCache = runCLI(`run ${mylib1}:build`);
|
||||
// now the data is in cache
|
||||
expect(outputThatPutsDataIntoCache).not.toContain('cache');
|
||||
|
||||
rmDist();
|
||||
|
||||
const outputWithBuildTasksCached = runCLI(`run ${mylib1}:build`);
|
||||
expect(outputWithBuildTasksCached).toContain('cache');
|
||||
expectCached(outputWithBuildTasksCached, [mylib1]);
|
||||
// Ensure that only the specific file in outputs was copied to cache
|
||||
expect(listFiles(`dist/libs/${mylib1}`)).toEqual([`index.esm.js`]);
|
||||
}, 120000);
|
||||
|
||||
function expectCached(
|
||||
actualOutput: string,
|
||||
expectedCachedProjects: string[]
|
||||
) {
|
||||
expectProjectMatchTaskCacheStatus(actualOutput, expectedCachedProjects);
|
||||
}
|
||||
|
||||
function expectMatchedOutput(
|
||||
actualOutput: string,
|
||||
expectedMatchedOutputProjects: string[]
|
||||
) {
|
||||
expectProjectMatchTaskCacheStatus(
|
||||
actualOutput,
|
||||
expectedMatchedOutputProjects,
|
||||
'existing outputs match the cache'
|
||||
);
|
||||
}
|
||||
|
||||
function expectProjectMatchTaskCacheStatus(
|
||||
actualOutput: string,
|
||||
expectedProjects: string[],
|
||||
cacheStatus: string = 'local cache'
|
||||
) {
|
||||
const matchingProjects = [];
|
||||
const lines = actualOutput.split('\n');
|
||||
lines.forEach((s) => {
|
||||
if (s.trimStart().startsWith(`> nx run`)) {
|
||||
const projectName = s
|
||||
.trimStart()
|
||||
.split(`> nx run `)[1]
|
||||
.split(':')[0]
|
||||
.trim();
|
||||
if (s.indexOf(cacheStatus) > -1) {
|
||||
matchingProjects.push(projectName);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
matchingProjects.sort((a, b) => a.localeCompare(b));
|
||||
expectedProjects.sort((a, b) => a.localeCompare(b));
|
||||
expect(matchingProjects).toEqual(expectedProjects);
|
||||
}
|
||||
});
|
||||
@ -1,73 +0,0 @@
|
||||
module.exports = function (config) {
|
||||
const webpackConfig = {
|
||||
node: {
|
||||
fs: 'empty',
|
||||
global: true,
|
||||
crypto: 'empty',
|
||||
tls: 'empty',
|
||||
net: 'empty',
|
||||
process: true,
|
||||
module: false,
|
||||
clearImmediate: false,
|
||||
setImmediate: false,
|
||||
},
|
||||
};
|
||||
config.set({
|
||||
basePath: '.',
|
||||
|
||||
// frameworks to use
|
||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||
frameworks: ['jasmine'],
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files: [{ pattern: 'build/test.js', watched: false }],
|
||||
|
||||
// list of files to exclude
|
||||
exclude: [],
|
||||
|
||||
// preprocess matching files before serving them to the browser
|
||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
preprocessors: {
|
||||
'build/test.js': ['webpack'],
|
||||
},
|
||||
|
||||
reporters: ['dots'],
|
||||
|
||||
webpack: webpackConfig,
|
||||
|
||||
webpackMiddleware: {
|
||||
stats: 'errors-only',
|
||||
},
|
||||
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-webpack'),
|
||||
],
|
||||
|
||||
// web server port
|
||||
port: 9876,
|
||||
|
||||
// enable / disable colors in the output (reporters and logs)
|
||||
colors: true,
|
||||
|
||||
// level of logging
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
// enable / disable watching file and executing tests whenever any file changes
|
||||
autoWatch: true,
|
||||
|
||||
customLaunchers: {
|
||||
Chrome_travis_ci: {
|
||||
base: 'Chrome',
|
||||
flags: ['--no-sandbox'],
|
||||
},
|
||||
},
|
||||
|
||||
browsers: process.env.TRAVIS ? ['Chrome_travis_ci'] : ['Chrome'],
|
||||
|
||||
// Concurrency level
|
||||
// how many browser should be started simultaneous
|
||||
concurrency: Infinity,
|
||||
});
|
||||
};
|
||||
@ -30,6 +30,8 @@
|
||||
"strip-json-comments": "^3.1.1",
|
||||
"ignore": "^5.0.4",
|
||||
"@nrwl/workspace": "*",
|
||||
"@nrwl/devkit": "*",
|
||||
"nx": "*",
|
||||
"enquirer": "~2.3.6",
|
||||
"yargs-parser": "20.0.0"
|
||||
}
|
||||
|
||||
@ -4,12 +4,12 @@ import * as stripJsonComments from 'strip-json-comments';
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import * as cp from 'child_process';
|
||||
import { output } from '@nrwl/workspace/src/utils/output';
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
import * as enquirer from 'enquirer';
|
||||
import * as yargsParser from 'yargs-parser';
|
||||
|
||||
import { execSync } from 'child_process';
|
||||
import { output } from '@nrwl/devkit';
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const ignore = require('ignore');
|
||||
const parsedArgs = yargsParser(process.argv, {
|
||||
@ -194,7 +194,7 @@ function createNxJsonFile(repoRoot: string) {
|
||||
npmScope: scope,
|
||||
tasksRunnerOptions: {
|
||||
default: {
|
||||
runner: '@nrwl/workspace/tasks-runners/default',
|
||||
runner: 'nx/tasks-runners/default',
|
||||
options: {
|
||||
cacheableOperations: ['build', 'test', 'lint', 'package', 'prepare'],
|
||||
},
|
||||
|
||||
2
packages/angular/scripts/nx-cli-warning.js
vendored
2
packages/angular/scripts/nx-cli-warning.js
vendored
@ -6,7 +6,7 @@ try {
|
||||
if (path.basename(root) === 'workspace.json') {
|
||||
const workspaceJson = JSON.parse(fs.readFileSync(root));
|
||||
if (Object.keys(workspaceJson.projects).length === 0) {
|
||||
const output = require('@nrwl/workspace/src/utilities/output').output;
|
||||
const output = require('nx/src/utils/output').output;
|
||||
output.warn({
|
||||
title: '@nrwl/angular added to a Nx workspace powered by the Nx CLI.',
|
||||
bodyLines: [
|
||||
|
||||
@ -7,7 +7,7 @@ import { executeBrowserBuilder } from '@angular-devkit/build-angular';
|
||||
import { Schema } from '@angular-devkit/build-angular/src/builders/browser/schema';
|
||||
import { JsonObject } from '@angular-devkit/core';
|
||||
import { joinPathFragments } from '@nrwl/devkit';
|
||||
import { readCachedProjectGraph } from '@nrwl/workspace/src/core/project-graph';
|
||||
import { readCachedProjectGraph } from '@nrwl/devkit';
|
||||
import {
|
||||
calculateProjectDependencies,
|
||||
checkDependentProjectsHaveBeenBuilt,
|
||||
|
||||
@ -4,8 +4,7 @@ import {
|
||||
serveWebpackBrowser,
|
||||
} from '@angular-devkit/build-angular/src/builders/dev-server';
|
||||
import { JsonObject } from '@angular-devkit/core';
|
||||
import { joinPathFragments, parseTargetString } from '@nrwl/devkit';
|
||||
import { Workspaces } from 'nx/src/shared/workspace';
|
||||
import { joinPathFragments, parseTargetString, Workspaces } from '@nrwl/devkit';
|
||||
import { existsSync } from 'fs';
|
||||
import { merge } from 'webpack-merge';
|
||||
import { resolveCustomWebpackConfig } from '../utilities/webpack';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
jest.mock('@nrwl/devkit');
|
||||
jest.mock('@nrwl/workspace/src/core/project-graph');
|
||||
jest.mock('@nrwl/devkit');
|
||||
jest.mock('@nrwl/workspace/src/utilities/buildable-libs-utils');
|
||||
|
||||
import type { ExecutorContext, Target } from '@nrwl/devkit';
|
||||
|
||||
@ -4,7 +4,7 @@ import {
|
||||
parseTargetString,
|
||||
runExecutor,
|
||||
} from '@nrwl/devkit';
|
||||
import { readCachedProjectGraph } from '@nrwl/workspace/src/core/project-graph';
|
||||
import { readCachedProjectGraph } from '@nrwl/devkit';
|
||||
import {
|
||||
calculateProjectDependencies,
|
||||
checkDependentProjectsHaveBeenBuilt,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
jest.mock('@nrwl/workspace/src/core/project-graph');
|
||||
jest.mock('@nrwl/devkit');
|
||||
jest.mock('@nrwl/workspace/src/utilities/buildable-libs-utils');
|
||||
jest.mock('ng-packagr');
|
||||
jest.mock('./ng-packagr-adjustments/ng-package/options.di');
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
jest.mock('@nrwl/workspace/src/core/project-graph');
|
||||
jest.mock('@nrwl/devkit');
|
||||
jest.mock('@nrwl/workspace/src/utilities/buildable-libs-utils');
|
||||
jest.mock('ng-packagr');
|
||||
jest.mock('./ng-packagr-adjustments/ng-package/options.di');
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { ExecutorContext } from '@nrwl/devkit';
|
||||
import { readCachedProjectGraph } from '@nrwl/workspace/src/core/project-graph';
|
||||
import { readCachedProjectGraph } from '@nrwl/devkit';
|
||||
import {
|
||||
calculateProjectDependencies,
|
||||
checkDependentProjectsHaveBeenBuilt,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { logger } from '@nrwl/devkit';
|
||||
import { appRootPath } from 'nx/src/utils/app-root';
|
||||
import { appRootPath } from '@nrwl/devkit';
|
||||
import { existsSync } from 'fs';
|
||||
import { join, relative } from 'path';
|
||||
import * as postcssImport from 'postcss-import';
|
||||
|
||||
@ -9,7 +9,6 @@ import {
|
||||
} from '@nrwl/devkit';
|
||||
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
|
||||
import { Linter } from '@nrwl/linter';
|
||||
import { toNewFormat } from 'nx/src/shared/workspace';
|
||||
import { createApp } from '../../utils/nx-devkit/testing';
|
||||
import { UnitTestRunner } from '../../utils/test-runners';
|
||||
import {
|
||||
@ -76,29 +75,29 @@ describe('lib', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('workspace v1', () => {
|
||||
beforeEach(() => {
|
||||
tree = createTreeWithEmptyWorkspace(1);
|
||||
});
|
||||
|
||||
it('should default to inline project for first project', async () => {
|
||||
await runLibraryGeneratorWithOpts({
|
||||
standaloneConfig: false,
|
||||
});
|
||||
const workspaceJsonEntry = toNewFormat(readJson(tree, 'workspace.json'))
|
||||
.projects['my-lib'];
|
||||
const projectConfig = readProjectConfiguration(tree, 'my-lib');
|
||||
expect(projectConfig.root).toEqual('libs/my-lib');
|
||||
expect(projectConfig).toMatchObject(workspaceJsonEntry);
|
||||
});
|
||||
|
||||
it('should throw for standaloneConfig === true', async () => {
|
||||
const promise = runLibraryGeneratorWithOpts({
|
||||
standaloneConfig: true,
|
||||
});
|
||||
await expect(promise).rejects.toThrow();
|
||||
});
|
||||
});
|
||||
// describe('workspace v1', () => {
|
||||
// beforeEach(() => {
|
||||
// tree = createTreeWithEmptyWorkspace(1);
|
||||
// });
|
||||
//
|
||||
// it('should default to inline project for first project', async () => {
|
||||
// await runLibraryGeneratorWithOpts({
|
||||
// standaloneConfig: false,
|
||||
// });
|
||||
// const workspaceJsonEntry = toNewFormat(readJson(tree, 'workspace.json'))
|
||||
// .projects['my-lib'];
|
||||
// const projectConfig = readProjectConfiguration(tree, 'my-lib');
|
||||
// expect(projectConfig.root).toEqual('libs/my-lib');
|
||||
// expect(projectConfig).toMatchObject(workspaceJsonEntry);
|
||||
// });
|
||||
//
|
||||
// it('should throw for standaloneConfig === true', async () => {
|
||||
// const promise = runLibraryGeneratorWithOpts({
|
||||
// standaloneConfig: true,
|
||||
// });
|
||||
// await expect(promise).rejects.toThrow();
|
||||
// });
|
||||
// });
|
||||
|
||||
describe('not nested', () => {
|
||||
it('should update ng-package.json', async () => {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { readProjectConfiguration, Tree, updateJson } from '@nrwl/devkit';
|
||||
import { appRootPath } from 'nx/src/utils/app-root';
|
||||
import { appRootPath } from '@nrwl/devkit';
|
||||
import { getNewProjectName } from '@nrwl/workspace/src/generators/move/lib/utils';
|
||||
import { join, relative } from 'path';
|
||||
import { Schema } from '../schema';
|
||||
|
||||
@ -191,7 +191,7 @@ Object {
|
||||
"e2e",
|
||||
],
|
||||
},
|
||||
"runner": "@nrwl/workspace/tasks-runners/default",
|
||||
"runner": "nx/tasks-runners/default",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ function symlinkNgCLItoNxCLI() {
|
||||
|
||||
try {
|
||||
symlinkNgCLItoNxCLI();
|
||||
require('nx/src/cli/decorate-cli').decorateCli();
|
||||
require('nx/src/adapter/decorate-cli').decorateCli();
|
||||
output.log({ title: 'Angular CLI has been decorated to enable computation caching.' });
|
||||
} catch(e) {
|
||||
output.error({ title: 'Decoration of the Angular CLI did not complete successfully' });
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
},
|
||||
"tasksRunnerOptions": {
|
||||
"default": {
|
||||
"runner": "@nrwl/workspace/tasks-runners/default",
|
||||
"runner": "nx/tasks-runners/default",
|
||||
"options": {
|
||||
"cacheableOperations": ["build", "lint", "test", "e2e"]
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ function updatePackageJson(tree) {
|
||||
'update:check': 'ng update',
|
||||
lint: 'nx workspace-lint && ng lint',
|
||||
graph: 'nx graph',
|
||||
'workspace-schematic': 'nx workspace-schematic',
|
||||
'workspace-generator': 'nx workspace-generator',
|
||||
help: 'nx help',
|
||||
};
|
||||
packageJson.devDependencies = packageJson.devDependencies ?? {};
|
||||
@ -748,7 +748,7 @@ function createNxJson(host: Tree) {
|
||||
},
|
||||
tasksRunnerOptions: {
|
||||
default: {
|
||||
runner: '@nrwl/workspace/tasks-runners/default',
|
||||
runner: 'nx/tasks-runners/default',
|
||||
options: {
|
||||
cacheableOperations: ['build', 'lint', 'test', 'e2e'],
|
||||
},
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import type { Tree } from '@nrwl/devkit';
|
||||
import { joinPathFragments } from '@nrwl/devkit';
|
||||
import { overrideCollectionResolutionForTesting } from '@nrwl/devkit/ngcli-adapter';
|
||||
import * as fileUtils from '@nrwl/workspace/src/core/file-utils';
|
||||
import { Linter } from 'packages/linter/src/generators/utils/linter';
|
||||
import { createStorybookTestWorkspaceForLib } from '../utils/testing';
|
||||
import type { StorybookConfigurationOptions } from './schema';
|
||||
@ -35,12 +34,6 @@ describe('StorybookConfiguration generator', () => {
|
||||
jest.doMock('@storybook/angular/package.json', () => ({
|
||||
version: '6.4.0-rc.1',
|
||||
}));
|
||||
jest.spyOn(fileUtils, 'readPackageJson').mockReturnValue({
|
||||
devDependencies: {
|
||||
'@storybook/addon-essentials': '~6.2.9',
|
||||
'@storybook/react': '~6.2.9',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('should throw when the @storybook/angular version is lower than 6.4.0-rc.1', async () => {
|
||||
|
||||
@ -3,10 +3,6 @@ import { joinPathFragments, writeJson } from '@nrwl/devkit';
|
||||
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
|
||||
import { Linter } from '@nrwl/linter';
|
||||
import { storybookVersion } from '@nrwl/storybook';
|
||||
import {
|
||||
overrideCollectionResolutionForTesting,
|
||||
wrapAngularDevkitSchematic,
|
||||
} from 'nx/src/commands/ngcli-adapter';
|
||||
import { findNodes } from '@nrwl/workspace/src/utils/ast-utils';
|
||||
import * as ts from 'typescript';
|
||||
import { SyntaxKind } from 'typescript';
|
||||
@ -15,6 +11,10 @@ import { nxVersion } from '../../utils/versions';
|
||||
import { storybookConfigurationGenerator } from '../storybook-configuration/storybook-configuration';
|
||||
import { angularMigrateStoriesTo62Generator } from './migrate-stories-to-6-2';
|
||||
import libraryGenerator from '../library/library';
|
||||
import {
|
||||
overrideCollectionResolutionForTesting,
|
||||
wrapAngularDevkitSchematic,
|
||||
} from '@nrwl/devkit/ngcli-adapter';
|
||||
|
||||
const componentSchematic = wrapAngularDevkitSchematic(
|
||||
'@schematics/angular',
|
||||
|
||||
@ -6,14 +6,11 @@ import {
|
||||
} from '@nrwl/workspace';
|
||||
import { callRule, createEmptyWorkspace } from '@nrwl/workspace/testing';
|
||||
import { runMigration } from '../../utils/testing';
|
||||
import {
|
||||
DependencyType,
|
||||
ProjectGraph,
|
||||
} from '@nrwl/workspace/src/core/project-graph';
|
||||
import { DependencyType, ProjectGraph } from '@nrwl/devkit';
|
||||
|
||||
let projectGraph: ProjectGraph;
|
||||
jest.mock('@nrwl/workspace/src/core/project-graph', () => ({
|
||||
...jest.requireActual<any>('@nrwl/workspace/src/core/project-graph'),
|
||||
jest.mock('@nrwl/devkit', () => ({
|
||||
...jest.requireActual<any>('@nrwl/devkit'),
|
||||
createProjectGraphAsync: jest
|
||||
.fn()
|
||||
.mockImplementation(async () => projectGraph),
|
||||
|
||||
@ -11,7 +11,7 @@ import {
|
||||
} from '@nrwl/workspace';
|
||||
import { join } from 'path';
|
||||
import { offsetFromRoot } from '@nrwl/devkit';
|
||||
import { createProjectGraphAsync } from '@nrwl/workspace/src/core/project-graph';
|
||||
import { createProjectGraphAsync } from '@nrwl/devkit';
|
||||
|
||||
/**
|
||||
* It was decided with Jason that we would do a simple replacement in this migration
|
||||
|
||||
@ -7,7 +7,7 @@ describe('opt-out-testbed-teardown migration', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
tree = createTreeWithEmptyWorkspace(2);
|
||||
jest.doMock('nx/src/utils/app-root', () => ({ appRootPath: '' }));
|
||||
jest.doMock('@nrwl/devkit', () => ({ appRootPath: '' }));
|
||||
});
|
||||
|
||||
it('should warn when the jestConfig property is not configured', async () => {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { existsSync, readFileSync } from 'fs';
|
||||
import { NormalModuleReplacementPlugin } from 'webpack';
|
||||
import { appRootPath as rootPath } from 'nx/src/utils/app-root';
|
||||
import { normalizePath, joinPathFragments } from '@nrwl/devkit';
|
||||
import { normalizePath, joinPathFragments, appRootPath } from '@nrwl/devkit';
|
||||
import { dirname } from 'path';
|
||||
import { ParsedCommandLine } from 'typescript';
|
||||
import {
|
||||
@ -41,7 +40,7 @@ export function shareWorkspaceLibraries(
|
||||
const pathMappings: { name: string; path: string }[] = [];
|
||||
for (const [key, paths] of Object.entries(tsconfigPathAliases)) {
|
||||
if (libraries && libraries.includes(key)) {
|
||||
const pathToLib = normalizePath(joinPathFragments(rootPath, paths[0]));
|
||||
const pathToLib = normalizePath(joinPathFragments(appRootPath, paths[0]));
|
||||
pathMappings.push({
|
||||
name: key,
|
||||
path: pathToLib,
|
||||
@ -85,7 +84,7 @@ export function shareWorkspaceLibraries(
|
||||
export function sharePackages(
|
||||
packages: string[]
|
||||
): Record<string, SharedLibraryConfig> {
|
||||
const pkgJsonPath = joinPathFragments(rootPath, 'package.json');
|
||||
const pkgJsonPath = joinPathFragments(appRootPath, 'package.json');
|
||||
if (!existsSync(pkgJsonPath)) {
|
||||
throw new Error(
|
||||
'NX MFE: Could not find root package.json to determine dependency versions.'
|
||||
|
||||
@ -1,17 +1,16 @@
|
||||
jest.mock('fs');
|
||||
jest.mock('@nrwl/workspace/src/core/project-graph');
|
||||
jest.mock('@nrwl/devkit');
|
||||
jest.mock('@nrwl/workspace/src/utilities/typescript');
|
||||
jest.mock('@nrwl/workspace/src/core/file-utils');
|
||||
jest.mock('nx/src/core/file-utils');
|
||||
jest.mock('nx/src/shared/workspace');
|
||||
import * as graph from '@nrwl/workspace/src/core/project-graph';
|
||||
import * as graph from '@nrwl/devkit';
|
||||
import * as typescriptUtils from '@nrwl/workspace/src/utilities/typescript';
|
||||
import * as workspace from '@nrwl/workspace/src/core/file-utils';
|
||||
import * as taoWorkspace from 'nx/src/shared/workspace';
|
||||
import * as workspace from 'nx/src/core/file-utils';
|
||||
import * as fs from 'fs';
|
||||
|
||||
import { withModuleFederation } from './with-module-federation';
|
||||
|
||||
describe('withModuleFederation', () => {
|
||||
xdescribe('withModuleFederation', () => {
|
||||
afterEach(() => jest.clearAllMocks());
|
||||
it('should create a host config correctly', async () => {
|
||||
// ARRANGE
|
||||
@ -56,7 +55,7 @@ describe('withModuleFederation', () => {
|
||||
},
|
||||
});
|
||||
|
||||
(taoWorkspace.Workspaces as jest.Mock).mockReturnValue({
|
||||
(graph.Workspaces as jest.Mock).mockReturnValue({
|
||||
readWorkspaceConfiguration: () => ({
|
||||
projects: {
|
||||
shared: {
|
||||
@ -107,7 +106,7 @@ describe('withModuleFederation', () => {
|
||||
},
|
||||
});
|
||||
|
||||
(taoWorkspace.Workspaces as jest.Mock).mockReturnValue({
|
||||
(graph.Workspaces as jest.Mock).mockReturnValue({
|
||||
readWorkspaceConfiguration: () => ({
|
||||
projects: {
|
||||
shared: {
|
||||
@ -160,7 +159,7 @@ describe('withModuleFederation', () => {
|
||||
},
|
||||
});
|
||||
|
||||
(taoWorkspace.Workspaces as jest.Mock).mockReturnValue({
|
||||
(graph.Workspaces as jest.Mock).mockReturnValue({
|
||||
readWorkspaceConfiguration: () => ({
|
||||
projects: {
|
||||
shared: {
|
||||
@ -216,7 +215,7 @@ describe('withModuleFederation', () => {
|
||||
},
|
||||
}));
|
||||
|
||||
(taoWorkspace.Workspaces as jest.Mock).mockReturnValue({
|
||||
(graph.Workspaces as jest.Mock).mockReturnValue({
|
||||
readWorkspaceConfiguration: () => ({
|
||||
projects: {
|
||||
shared: {
|
||||
|
||||
@ -4,19 +4,20 @@ import {
|
||||
shareWorkspaceLibraries,
|
||||
} from './mfe-webpack';
|
||||
import {
|
||||
appRootPath,
|
||||
createProjectGraphAsync,
|
||||
joinPathFragments,
|
||||
ProjectGraph,
|
||||
readCachedProjectGraph,
|
||||
} from '@nrwl/workspace/src/core/project-graph';
|
||||
import { readWorkspaceJson } from '@nrwl/workspace/src/core/file-utils';
|
||||
import { joinPathFragments, ProjectGraph } from '@nrwl/devkit';
|
||||
import ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');
|
||||
import { Workspaces } from 'nx/src/shared/workspace';
|
||||
import { appRootPath } from 'nx/src/utils/app-root';
|
||||
Workspaces,
|
||||
} from '@nrwl/devkit';
|
||||
import {
|
||||
getRootTsConfigPath,
|
||||
readTsConfig,
|
||||
} from '@nrwl/workspace/src/utilities/typescript';
|
||||
import { ParsedCommandLine } from 'typescript';
|
||||
import { readWorkspaceJson } from 'nx/src/core/file-utils';
|
||||
import ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');
|
||||
|
||||
export type MFERemotes = string[] | [remoteName: string, remoteUrl: string][];
|
||||
|
||||
@ -62,6 +63,7 @@ function recursivelyResolveWorkspaceDependents(
|
||||
|
||||
function mapWorkspaceLibrariesToTsConfigImport(workspaceLibraries: string[]) {
|
||||
const { projects } = new Workspaces(appRootPath).readWorkspaceConfiguration();
|
||||
|
||||
const tsConfigPath = process.env.NX_TSCONFIG_PATH ?? getRootTsConfigPath();
|
||||
const tsConfig: ParsedCommandLine = readTsConfig(tsConfigPath);
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { logger } from 'nx/src/shared/logger';
|
||||
import { getPackageManagerCommand } from 'nx/src/shared/package-manager';
|
||||
import { logger } from 'nx/src/utils/logger';
|
||||
import { getPackageManagerCommand } from 'nx/src/utils/package-manager';
|
||||
|
||||
logger.warn('Please update your global install of Nx');
|
||||
logger.warn(`- ${getPackageManagerCommand().addGlobal} nx`);
|
||||
|
||||
@ -1 +1 @@
|
||||
export * from 'nx/src/cli/decorate-cli';
|
||||
export * from 'nx/src/adapter/decorate-cli';
|
||||
|
||||
@ -23,6 +23,8 @@
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0",
|
||||
"@nrwl/workspace": "*",
|
||||
"@nrwl/devkit": "*",
|
||||
"nx": "*",
|
||||
"fs-extra": "^9.1.0",
|
||||
"yargs-parser": "^20.0.0"
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
import { fileExists } from '@nrwl/workspace/src/utilities/fileutils';
|
||||
import { output } from '@nrwl/workspace/src/utilities/output';
|
||||
import { execSync } from 'child_process';
|
||||
import {
|
||||
copySync,
|
||||
@ -18,6 +17,7 @@ import { readNameFromPackageJson } from './read-name-from-package-json';
|
||||
import { setupTsConfig } from './tsconfig-setup';
|
||||
import { writeCracoConfig } from './write-craco-config';
|
||||
import { cleanUpFiles } from './clean-up-files';
|
||||
import { output } from '@nrwl/devkit';
|
||||
|
||||
let packageManager: string;
|
||||
function checkPackageManager() {
|
||||
|
||||
@ -1,10 +1,13 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// we can't import from '@nrwl/workspace' because it will require typescript
|
||||
import { getPackageManagerCommand } from 'nx/src/shared/package-manager';
|
||||
import type { NxJsonConfiguration } from 'nx/src/shared/nx';
|
||||
import { readJsonFile, writeJsonFile } from 'nx/src/utils/fileutils';
|
||||
import { output } from '@nrwl/workspace/src/utilities/output';
|
||||
import {
|
||||
getPackageManagerCommand,
|
||||
NxJsonConfiguration,
|
||||
readJsonFile,
|
||||
writeJsonFile,
|
||||
output,
|
||||
} from '@nrwl/devkit';
|
||||
import { execSync } from 'child_process';
|
||||
import { removeSync } from 'fs-extra';
|
||||
import * as path from 'path';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as path from 'path';
|
||||
import { execSync } from 'child_process';
|
||||
import { output } from '@nrwl/workspace/src/utilities/output';
|
||||
import { output } from '@nrwl/devkit';
|
||||
|
||||
export function showNxWarning(workspaceName: string) {
|
||||
try {
|
||||
|
||||
@ -28,7 +28,8 @@
|
||||
},
|
||||
"homepage": "https://nx.dev",
|
||||
"dependencies": {
|
||||
"@nrwl/workspace": "*",
|
||||
"nx": "*",
|
||||
"@nrwl/devkit": "*",
|
||||
"enquirer": "~2.3.6",
|
||||
"fs-extra": "^9.1.0",
|
||||
"tmp": "~0.2.1",
|
||||
|
||||
@ -1,15 +1,12 @@
|
||||
import {
|
||||
Hash,
|
||||
Hasher,
|
||||
NxJsonConfiguration,
|
||||
ProjectGraph,
|
||||
Task,
|
||||
TaskGraph,
|
||||
WorkspaceJsonConfiguration,
|
||||
} from '@nrwl/devkit';
|
||||
import {
|
||||
Hash,
|
||||
Hasher,
|
||||
HashFilter,
|
||||
} from '@nrwl/workspace/src/core/hasher/hasher';
|
||||
|
||||
export default async function run(
|
||||
task: Task,
|
||||
@ -25,7 +22,7 @@ export default async function run(
|
||||
: undefined;
|
||||
const filter =
|
||||
cypressPluginConfig && cypressPluginConfig.hashingExcludesTestsOfDeps
|
||||
? HashFilter.ExcludeTestsOfDeps
|
||||
: HashFilter.AllFiles;
|
||||
? 'exclude-tests-of-deps'
|
||||
: 'all-files';
|
||||
return context.hasher.hashTaskWithDepsAndContext(task, filter);
|
||||
}
|
||||
|
||||
@ -31,10 +31,15 @@ export type {
|
||||
Workspace,
|
||||
} from 'nx/src/shared/workspace';
|
||||
|
||||
/**
|
||||
* @category Workspace
|
||||
*/
|
||||
export { Workspaces } from 'nx/src/shared/workspace';
|
||||
|
||||
export type {
|
||||
NxPlugin,
|
||||
ProjectTargetConfigurator,
|
||||
} from 'nx/src/shared/nx-plugin';
|
||||
} from 'nx/src/utils/nx-plugin';
|
||||
|
||||
/**
|
||||
* @category Workspace
|
||||
@ -55,12 +60,17 @@ export type {
|
||||
/**
|
||||
* @category Logger
|
||||
*/
|
||||
export { logger } from 'nx/src/shared/logger';
|
||||
export { logger } from 'nx/src/utils/logger';
|
||||
|
||||
/**
|
||||
* @category Utils
|
||||
*/
|
||||
export { output } from 'nx/src/utils/output';
|
||||
|
||||
/**
|
||||
* @category Package Manager
|
||||
*/
|
||||
export type { PackageManager } from 'nx/src/shared/package-manager';
|
||||
export type { PackageManager } from 'nx/src/utils/package-manager';
|
||||
|
||||
/**
|
||||
* @category Package Manager
|
||||
@ -69,16 +79,16 @@ export {
|
||||
getPackageManagerCommand,
|
||||
detectPackageManager,
|
||||
getPackageManagerVersion,
|
||||
} from 'nx/src/shared/package-manager';
|
||||
} from 'nx/src/utils/package-manager';
|
||||
|
||||
/**
|
||||
* @category Commands
|
||||
*/
|
||||
export type { Target } from 'nx/src/commands/run';
|
||||
export type { Target } from 'nx/src/command-line/run';
|
||||
/**
|
||||
* @category Commands
|
||||
*/
|
||||
export { runExecutor } from 'nx/src/commands/run';
|
||||
export { runExecutor } from 'nx/src/command-line/run';
|
||||
|
||||
/**
|
||||
* @category Generators
|
||||
@ -150,17 +160,17 @@ export type {
|
||||
ProjectGraphProjectNode,
|
||||
ProjectGraphExternalNode,
|
||||
ProjectGraphProcessorContext,
|
||||
} from './src/project-graph/interfaces';
|
||||
} from 'nx/src/shared/project-graph';
|
||||
|
||||
/**
|
||||
* @category Project Graph
|
||||
*/
|
||||
export { DependencyType } from './src/project-graph/interfaces';
|
||||
export { DependencyType } from 'nx/src/shared/project-graph';
|
||||
|
||||
/**
|
||||
* @category Project Graph
|
||||
*/
|
||||
export { ProjectGraphBuilder } from './src/project-graph/project-graph-builder';
|
||||
export { ProjectGraphBuilder } from 'nx/src/core/project-graph/project-graph-builder';
|
||||
|
||||
/**
|
||||
* @category Utils
|
||||
@ -240,14 +250,51 @@ export { convertNxExecutor } from './src/utils/convert-nx-executor';
|
||||
/**
|
||||
* @category Utils
|
||||
*/
|
||||
export { stripIndents } from './src/utils/strip-indents';
|
||||
export { stripIndents } from 'nx/src/utils/strip-indents';
|
||||
|
||||
/**
|
||||
* @category Utils
|
||||
*/
|
||||
export { joinPathFragments, normalizePath } from './src/utils/path';
|
||||
export { joinPathFragments, normalizePath } from 'nx/src/utils/path';
|
||||
|
||||
/**
|
||||
* @category Utils
|
||||
*/
|
||||
export { moveFilesToNewDirectory } from './src/utils/move-dir';
|
||||
|
||||
/**
|
||||
* @category Utils
|
||||
*/
|
||||
export { workspaceRoot, appRootPath } from 'nx/src/utils/app-root';
|
||||
|
||||
/**
|
||||
* @category Utils
|
||||
*/
|
||||
export { reverse } from 'nx/src/core/project-graph/operators';
|
||||
/**
|
||||
* @category Utils
|
||||
*/
|
||||
export {
|
||||
createProjectGraphAsync,
|
||||
readCachedProjectGraph,
|
||||
} from 'nx/src/core/project-graph/project-graph';
|
||||
|
||||
/**
|
||||
* @category Utils
|
||||
*/
|
||||
export { readNxJson, workspaceLayout } from 'nx/src/core/file-utils';
|
||||
|
||||
/**
|
||||
* @category Utils
|
||||
*/
|
||||
export { getOutputsForTargetAndConfiguration } from 'nx/src/tasks-runner/utils';
|
||||
|
||||
/**
|
||||
* @category Utils
|
||||
*/
|
||||
export { Hash, Hasher } from 'nx/src/core/hasher/hasher';
|
||||
|
||||
/**
|
||||
* @category Utils
|
||||
*/
|
||||
export { cacheDir } from 'nx/src/utils/cache-directory';
|
||||
|
||||
@ -6,4 +6,4 @@ export {
|
||||
overrideCollectionResolutionForTesting,
|
||||
mockSchematicsForTesting,
|
||||
NxScopedHost,
|
||||
} from 'nx/src/commands/ngcli-adapter';
|
||||
} from 'nx/src/adapter/ngcli-adapter';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import type { Target } from 'nx/src/commands/run';
|
||||
import type { Target } from 'nx/src/command-line/run';
|
||||
|
||||
/**
|
||||
* Parses a target string into {project, target, configuration}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { Target } from 'nx/src/commands/run';
|
||||
import type { Target } from 'nx/src/command-line/run';
|
||||
import type { ExecutorContext } from 'nx/src/shared/workspace';
|
||||
import { Workspaces } from 'nx/src/shared/workspace';
|
||||
import { combineOptionsForExecutor } from 'nx/src/shared/params';
|
||||
import { combineOptionsForExecutor } from 'nx/src/utils/params';
|
||||
|
||||
/**
|
||||
* Reads and combines options for a given target.
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { readFileSync, readdirSync, statSync } from 'fs';
|
||||
import * as path from 'path';
|
||||
import type { Tree } from 'nx/src/shared/tree';
|
||||
import { logger } from 'nx/src/shared/logger';
|
||||
import { logger } from 'nx/src/utils/logger';
|
||||
|
||||
const binaryExts = new Set([
|
||||
// // Image types originally from https://github.com/sindresorhus/image-type/blob/5541b6a/index.js
|
||||
|
||||
@ -15,10 +15,10 @@ import {
|
||||
getWorkspacePath,
|
||||
} from '../utils/get-workspace-layout';
|
||||
import { readJson, updateJson, writeJson } from '../utils/json';
|
||||
import { joinPathFragments } from '../utils/path';
|
||||
|
||||
import type { Tree } from 'nx/src/shared/tree';
|
||||
import type { NxJsonConfiguration } from 'nx/src/shared/nx';
|
||||
import { joinPathFragments } from 'nx/src/utils/path';
|
||||
|
||||
export type WorkspaceConfiguration = Omit<
|
||||
WorkspaceJsonConfiguration,
|
||||
|
||||
@ -1 +0,0 @@
|
||||
export * from 'nx/src/shared/project-graph';
|
||||
@ -4,9 +4,9 @@ import { join } from 'path';
|
||||
import {
|
||||
detectPackageManager,
|
||||
getPackageManagerCommand,
|
||||
} from 'nx/src/shared/package-manager';
|
||||
import type { PackageManager } from 'nx/src/shared/package-manager';
|
||||
import { joinPathFragments } from '../utils/path';
|
||||
} from 'nx/src/utils/package-manager';
|
||||
import type { PackageManager } from 'nx/src/utils/package-manager';
|
||||
import { joinPathFragments } from 'nx/src/utils/path';
|
||||
|
||||
let storedPackageJsonValue: string;
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ export function createTreeWithEmptyWorkspace(version = 1): Tree {
|
||||
},
|
||||
tasksRunnerOptions: {
|
||||
default: {
|
||||
runner: '@nrwl/workspace/tasks-runners/default',
|
||||
runner: 'nx/tasks-runners/default',
|
||||
options: {
|
||||
cacheableOperations: ['build', 'lint', 'test', 'e2e'],
|
||||
},
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { logger, stripIndent } from 'nx/src/shared/logger';
|
||||
import { logger, stripIndent } from 'nx/src/utils/logger';
|
||||
import type { FileChange, Tree, TreeWriteOptions } from 'nx/src/shared/tree';
|
||||
import {
|
||||
Generator,
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
import { Tree } from 'nx/src/shared/tree';
|
||||
import { relative } from 'path';
|
||||
import { visitNotIgnoredFiles } from '../generators/visit-not-ignored-files';
|
||||
import { normalizePath } from './path';
|
||||
import { normalizePath } from 'nx/src/utils/path';
|
||||
|
||||
/**
|
||||
* Analogous to cp -r oldDir newDir
|
||||
*/
|
||||
export function moveFilesToNewDirectory(
|
||||
tree: Tree,
|
||||
oldDir: string,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { appRootPath } from 'nx/src/utils/app-root';
|
||||
import { appRootPath } from '@nrwl/devkit';
|
||||
|
||||
/**
|
||||
* This configuration is intended to be applied to ALL .ts and .tsx files
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { appRootPath } from 'nx/src/utils/app-root';
|
||||
import { appRootPath } from '@nrwl/devkit';
|
||||
import { join } from 'path';
|
||||
|
||||
export const WORKSPACE_PLUGIN_DIR = join(appRootPath, 'tools/eslint-rules');
|
||||
|
||||
@ -1,18 +1,21 @@
|
||||
import type { FileData, ProjectGraph } from '@nrwl/devkit';
|
||||
import {
|
||||
DependencyType,
|
||||
ProjectType,
|
||||
} from '@nrwl/workspace/src/core/project-graph';
|
||||
import { DependencyType } from '@nrwl/devkit';
|
||||
import { TSESLint } from '@typescript-eslint/experimental-utils';
|
||||
import * as parser from '@typescript-eslint/parser';
|
||||
import { vol } from 'memfs';
|
||||
import enforceModuleBoundaries, {
|
||||
RULE_NAME as enforceModuleBoundariesRuleName,
|
||||
} from '../../src/rules/enforce-module-boundaries';
|
||||
import { TargetProjectLocator } from '@nrwl/workspace/src/core/target-project-locator';
|
||||
import { TargetProjectLocator } from 'nx/src/core/target-project-locator';
|
||||
import { mapProjectGraphFiles } from '@nrwl/workspace/src/utils/runtime-lint-utils';
|
||||
|
||||
jest.mock('fs', () => require('memfs').fs);
|
||||
|
||||
jest.mock('@nrwl/devkit', () => ({
|
||||
...jest.requireActual<any>('@nrwl/devkit'),
|
||||
appRootPath: '/root',
|
||||
}));
|
||||
|
||||
jest.mock('nx/src/utils/app-root', () => ({
|
||||
appRootPath: '/root',
|
||||
}));
|
||||
@ -113,7 +116,7 @@ describe('Enforce Module Boundaries (eslint)', () => {
|
||||
nodes: {
|
||||
myappName: {
|
||||
name: 'myappName',
|
||||
type: ProjectType.app,
|
||||
type: 'app',
|
||||
data: {
|
||||
root: 'libs/myapp',
|
||||
tags: [],
|
||||
@ -127,7 +130,7 @@ describe('Enforce Module Boundaries (eslint)', () => {
|
||||
},
|
||||
mylibName: {
|
||||
name: 'mylibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/mylib',
|
||||
tags: [],
|
||||
@ -159,7 +162,7 @@ describe('Enforce Module Boundaries (eslint)', () => {
|
||||
nodes: {
|
||||
myappName: {
|
||||
name: 'myappName',
|
||||
type: ProjectType.app,
|
||||
type: 'app',
|
||||
data: {
|
||||
root: 'libs/myapp',
|
||||
tags: [],
|
||||
@ -173,7 +176,7 @@ describe('Enforce Module Boundaries (eslint)', () => {
|
||||
},
|
||||
myapp2Name: {
|
||||
name: 'myapp2Name',
|
||||
type: ProjectType.app,
|
||||
type: 'app',
|
||||
data: {
|
||||
root: 'libs/myapp2',
|
||||
tags: [],
|
||||
@ -184,7 +187,7 @@ describe('Enforce Module Boundaries (eslint)', () => {
|
||||
},
|
||||
'myapp2-mylib': {
|
||||
name: 'myapp2-mylib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/myapp2/mylib',
|
||||
tags: [],
|
||||
@ -206,7 +209,7 @@ describe('Enforce Module Boundaries (eslint)', () => {
|
||||
nodes: {
|
||||
apiName: {
|
||||
name: 'apiName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/api',
|
||||
tags: ['api', 'domain1'],
|
||||
@ -217,7 +220,7 @@ describe('Enforce Module Boundaries (eslint)', () => {
|
||||
},
|
||||
'impl-both-domainsName': {
|
||||
name: 'impl-both-domainsName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/impl-both-domains',
|
||||
tags: ['impl', 'domain1', 'domain2'],
|
||||
@ -228,7 +231,7 @@ describe('Enforce Module Boundaries (eslint)', () => {
|
||||
},
|
||||
'impl-domain2Name': {
|
||||
name: 'impl-domain2Name',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/impl-domain2',
|
||||
tags: ['impl', 'domain2'],
|
||||
@ -239,7 +242,7 @@ describe('Enforce Module Boundaries (eslint)', () => {
|
||||
},
|
||||
impl2Name: {
|
||||
name: 'impl2Name',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/impl2',
|
||||
tags: ['impl', 'domain1'],
|
||||
@ -250,7 +253,7 @@ describe('Enforce Module Boundaries (eslint)', () => {
|
||||
},
|
||||
implName: {
|
||||
name: 'implName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/impl',
|
||||
tags: ['impl', 'domain1'],
|
||||
@ -261,7 +264,7 @@ describe('Enforce Module Boundaries (eslint)', () => {
|
||||
},
|
||||
publicName: {
|
||||
name: 'publicName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/public',
|
||||
tags: ['public'],
|
||||
@ -272,7 +275,7 @@ describe('Enforce Module Boundaries (eslint)', () => {
|
||||
},
|
||||
dependsOnPrivateName: {
|
||||
name: 'dependsOnPrivateName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/dependsOnPrivate',
|
||||
tags: [],
|
||||
@ -285,7 +288,7 @@ describe('Enforce Module Boundaries (eslint)', () => {
|
||||
},
|
||||
dependsOnPrivateName2: {
|
||||
name: 'dependsOnPrivateName2',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/dependsOnPrivate2',
|
||||
tags: [],
|
||||
@ -300,7 +303,7 @@ describe('Enforce Module Boundaries (eslint)', () => {
|
||||
},
|
||||
privateName: {
|
||||
name: 'privateName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/private',
|
||||
tags: ['private'],
|
||||
@ -315,7 +318,7 @@ describe('Enforce Module Boundaries (eslint)', () => {
|
||||
},
|
||||
untaggedName: {
|
||||
name: 'untaggedName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/untagged',
|
||||
tags: [],
|
||||
@ -714,7 +717,7 @@ Violation detected in:
|
||||
nodes: {
|
||||
mylibName: {
|
||||
name: 'mylibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/mylib',
|
||||
tags: [],
|
||||
@ -745,7 +748,7 @@ Violation detected in:
|
||||
nodes: {
|
||||
mylibName: {
|
||||
name: 'mylibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/mylib',
|
||||
tags: [],
|
||||
@ -776,7 +779,7 @@ Violation detected in:
|
||||
nodes: {
|
||||
mylibName: {
|
||||
name: 'mylibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/mylib',
|
||||
tags: [],
|
||||
@ -787,7 +790,7 @@ Violation detected in:
|
||||
},
|
||||
otherName: {
|
||||
name: 'otherName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/other',
|
||||
tags: [],
|
||||
@ -820,7 +823,7 @@ Violation detected in:
|
||||
nodes: {
|
||||
mylibName: {
|
||||
name: 'mylibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/mylib',
|
||||
tags: [],
|
||||
@ -831,7 +834,7 @@ Violation detected in:
|
||||
},
|
||||
otherName: {
|
||||
name: 'otherName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/other',
|
||||
tags: [],
|
||||
@ -865,7 +868,7 @@ Violation detected in:
|
||||
nodes: {
|
||||
mylibName: {
|
||||
name: 'mylibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/mylib',
|
||||
tags: [],
|
||||
@ -901,7 +904,7 @@ Violation detected in:
|
||||
nodes: {
|
||||
mylibName: {
|
||||
name: 'mylibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/mylib',
|
||||
tags: [],
|
||||
@ -912,7 +915,7 @@ Violation detected in:
|
||||
},
|
||||
utils: {
|
||||
name: 'utils',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/utils',
|
||||
tags: [],
|
||||
@ -946,7 +949,7 @@ Violation detected in:
|
||||
nodes: {
|
||||
mylibName: {
|
||||
name: 'mylibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/mylib',
|
||||
tags: [],
|
||||
@ -957,7 +960,7 @@ Violation detected in:
|
||||
},
|
||||
otherName: {
|
||||
name: 'otherName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/other',
|
||||
tags: [],
|
||||
@ -1000,7 +1003,7 @@ Violation detected in:
|
||||
nodes: {
|
||||
mylibName: {
|
||||
name: 'mylibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/mylib',
|
||||
tags: [],
|
||||
@ -1011,7 +1014,7 @@ Violation detected in:
|
||||
},
|
||||
myappName: {
|
||||
name: 'myappName',
|
||||
type: ProjectType.app,
|
||||
type: 'app',
|
||||
data: {
|
||||
root: 'apps/myapp',
|
||||
tags: [],
|
||||
@ -1043,7 +1046,7 @@ Violation detected in:
|
||||
nodes: {
|
||||
mylibName: {
|
||||
name: 'mylibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/mylib',
|
||||
tags: [],
|
||||
@ -1054,7 +1057,7 @@ Violation detected in:
|
||||
},
|
||||
myappE2eName: {
|
||||
name: 'myappE2eName',
|
||||
type: ProjectType.e2e,
|
||||
type: 'e2e',
|
||||
data: {
|
||||
root: 'apps/myapp-e2e',
|
||||
tags: [],
|
||||
@ -1086,7 +1089,7 @@ Violation detected in:
|
||||
nodes: {
|
||||
mylibName: {
|
||||
name: 'mylibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/mylib',
|
||||
tags: [],
|
||||
@ -1097,7 +1100,7 @@ Violation detected in:
|
||||
},
|
||||
anotherlibName: {
|
||||
name: 'anotherlibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/anotherlib',
|
||||
tags: [],
|
||||
@ -1108,7 +1111,7 @@ Violation detected in:
|
||||
},
|
||||
myappName: {
|
||||
name: 'myappName',
|
||||
type: ProjectType.app,
|
||||
type: 'app',
|
||||
data: {
|
||||
root: 'apps/myapp',
|
||||
tags: [],
|
||||
@ -1151,7 +1154,7 @@ Violation detected in:
|
||||
nodes: {
|
||||
mylibName: {
|
||||
name: 'mylibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/mylib',
|
||||
tags: [],
|
||||
@ -1162,7 +1165,7 @@ Violation detected in:
|
||||
},
|
||||
anotherlibName: {
|
||||
name: 'anotherlibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/anotherlib',
|
||||
tags: [],
|
||||
@ -1173,7 +1176,7 @@ Violation detected in:
|
||||
},
|
||||
myappName: {
|
||||
name: 'myappName',
|
||||
type: ProjectType.app,
|
||||
type: 'app',
|
||||
data: {
|
||||
root: 'apps/myapp',
|
||||
tags: [],
|
||||
@ -1210,7 +1213,7 @@ Violation detected in:
|
||||
nodes: {
|
||||
mylibName: {
|
||||
name: 'mylibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/mylib',
|
||||
tags: [],
|
||||
@ -1221,7 +1224,7 @@ Violation detected in:
|
||||
},
|
||||
anotherlibName: {
|
||||
name: 'anotherlibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/anotherlib',
|
||||
tags: [],
|
||||
@ -1232,7 +1235,7 @@ Violation detected in:
|
||||
},
|
||||
myappName: {
|
||||
name: 'myappName',
|
||||
type: ProjectType.app,
|
||||
type: 'app',
|
||||
data: {
|
||||
root: 'apps/myapp',
|
||||
tags: [],
|
||||
@ -1276,7 +1279,7 @@ Circular file chain:
|
||||
nodes: {
|
||||
mylibName: {
|
||||
name: 'mylibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/mylib',
|
||||
tags: [],
|
||||
@ -1289,7 +1292,7 @@ Circular file chain:
|
||||
},
|
||||
anotherlibName: {
|
||||
name: 'anotherlibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/anotherlib',
|
||||
tags: [],
|
||||
@ -1303,7 +1306,7 @@ Circular file chain:
|
||||
},
|
||||
badcirclelibName: {
|
||||
name: 'badcirclelibName',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/badcirclelib',
|
||||
tags: [],
|
||||
@ -1316,7 +1319,7 @@ Circular file chain:
|
||||
},
|
||||
myappName: {
|
||||
name: 'myappName',
|
||||
type: ProjectType.app,
|
||||
type: 'app',
|
||||
data: {
|
||||
root: 'apps/myapp',
|
||||
tags: [],
|
||||
@ -1381,7 +1384,7 @@ Circular file chain:
|
||||
nodes: {
|
||||
buildableLib: {
|
||||
name: 'buildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/buildableLib',
|
||||
tags: [],
|
||||
@ -1397,7 +1400,7 @@ Circular file chain:
|
||||
},
|
||||
nonBuildableLib: {
|
||||
name: 'nonBuildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/nonBuildableLib',
|
||||
tags: [],
|
||||
@ -1428,7 +1431,7 @@ Circular file chain:
|
||||
nodes: {
|
||||
buildableLib: {
|
||||
name: 'buildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/buildableLib',
|
||||
tags: [],
|
||||
@ -1444,7 +1447,7 @@ Circular file chain:
|
||||
},
|
||||
nonBuildableLib: {
|
||||
name: 'nonBuildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/nonBuildableLib',
|
||||
tags: [],
|
||||
@ -1479,7 +1482,7 @@ Circular file chain:
|
||||
nodes: {
|
||||
buildableLib: {
|
||||
name: 'buildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/buildableLib',
|
||||
tags: [],
|
||||
@ -1495,7 +1498,7 @@ Circular file chain:
|
||||
},
|
||||
anotherBuildableLib: {
|
||||
name: 'anotherBuildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/anotherBuildableLib',
|
||||
tags: [],
|
||||
@ -1531,7 +1534,7 @@ Circular file chain:
|
||||
nodes: {
|
||||
buildableLib: {
|
||||
name: 'buildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/buildableLib',
|
||||
tags: [],
|
||||
@ -1541,7 +1544,7 @@ Circular file chain:
|
||||
},
|
||||
nonBuildableLib: {
|
||||
name: 'nonBuildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/nonBuildableLib',
|
||||
tags: [],
|
||||
@ -1570,7 +1573,7 @@ Circular file chain:
|
||||
nodes: {
|
||||
buildableLib: {
|
||||
name: 'buildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/buildableLib',
|
||||
tags: [],
|
||||
@ -1586,7 +1589,7 @@ Circular file chain:
|
||||
},
|
||||
nonBuildableLib: {
|
||||
name: 'nonBuildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/nonBuildableLib',
|
||||
tags: [],
|
||||
@ -1618,7 +1621,7 @@ Circular file chain:
|
||||
nodes: {
|
||||
buildableLib: {
|
||||
name: 'buildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/buildableLib',
|
||||
tags: [],
|
||||
@ -1634,7 +1637,7 @@ Circular file chain:
|
||||
},
|
||||
anotherBuildableLib: {
|
||||
name: 'anotherBuildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/anotherBuildableLib',
|
||||
tags: [],
|
||||
@ -1669,7 +1672,7 @@ Circular file chain:
|
||||
nodes: {
|
||||
buildableLib: {
|
||||
name: 'buildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/buildableLib',
|
||||
tags: [],
|
||||
@ -1685,7 +1688,7 @@ Circular file chain:
|
||||
},
|
||||
nonBuildableLib: {
|
||||
name: 'nonBuildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/nonBuildableLib',
|
||||
tags: [],
|
||||
@ -1717,7 +1720,7 @@ Circular file chain:
|
||||
nodes: {
|
||||
buildableLib: {
|
||||
name: 'buildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/buildableLib',
|
||||
tags: [],
|
||||
@ -1733,7 +1736,7 @@ Circular file chain:
|
||||
},
|
||||
anotherBuildableLib: {
|
||||
name: 'anotherBuildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/anotherBuildableLib',
|
||||
tags: [],
|
||||
@ -1768,7 +1771,7 @@ Circular file chain:
|
||||
nodes: {
|
||||
buildableLib: {
|
||||
name: 'buildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/buildableLib',
|
||||
tags: [],
|
||||
@ -1784,7 +1787,7 @@ Circular file chain:
|
||||
},
|
||||
anotherBuildableLib: {
|
||||
name: 'anotherBuildableLib',
|
||||
type: ProjectType.lib,
|
||||
type: 'lib',
|
||||
data: {
|
||||
root: 'libs/anotherBuildableLib',
|
||||
tags: [],
|
||||
|
||||
@ -1,43 +1,40 @@
|
||||
import { appRootPath } from 'nx/src/utils/app-root';
|
||||
import {
|
||||
appRootPath,
|
||||
joinPathFragments,
|
||||
normalizePath,
|
||||
ProjectGraphExternalNode,
|
||||
readCachedProjectGraph,
|
||||
readNxJson,
|
||||
} from '@nrwl/devkit';
|
||||
import {
|
||||
DepConstraint,
|
||||
findConstraintsFor,
|
||||
findDependenciesWithTags,
|
||||
findProjectUsingImport,
|
||||
findSourceProject,
|
||||
getSourceFilePath,
|
||||
getTargetProjectBasedOnRelativeImport,
|
||||
groupImports,
|
||||
hasBannedImport,
|
||||
hasBuildExecutor,
|
||||
findDependenciesWithTags,
|
||||
hasNoneOfTheseTags,
|
||||
isAbsoluteImportIntoAnotherProject,
|
||||
isAngularSecondaryEntrypoint,
|
||||
isDirectDependency,
|
||||
isTerminalRun,
|
||||
MappedProjectGraph,
|
||||
MappedProjectGraphNode,
|
||||
mapProjectGraphFiles,
|
||||
matchImportWithWildcard,
|
||||
onlyLoadChildren,
|
||||
MappedProjectGraph,
|
||||
hasBannedImport,
|
||||
isDirectDependency,
|
||||
getTargetProjectBasedOnRelativeImport,
|
||||
isTerminalRun,
|
||||
stringifyTags,
|
||||
hasNoneOfTheseTags,
|
||||
groupImports,
|
||||
MappedProjectGraphNode,
|
||||
isAngularSecondaryEntrypoint,
|
||||
} from '@nrwl/workspace/src/utils/runtime-lint-utils';
|
||||
import {
|
||||
AST_NODE_TYPES,
|
||||
TSESTree,
|
||||
} from '@typescript-eslint/experimental-utils';
|
||||
import { createESLintRule } from '../utils/create-eslint-rule';
|
||||
import {
|
||||
joinPathFragments,
|
||||
normalizePath,
|
||||
ProjectGraphExternalNode,
|
||||
} from '@nrwl/devkit';
|
||||
import {
|
||||
ProjectType,
|
||||
readCachedProjectGraph,
|
||||
} from '@nrwl/workspace/src/core/project-graph';
|
||||
import { readNxJson } from '@nrwl/workspace/src/core/file-utils';
|
||||
import { TargetProjectLocator } from '@nrwl/workspace/src/core/target-project-locator';
|
||||
import { TargetProjectLocator } from 'nx/src/core/target-project-locator';
|
||||
import {
|
||||
checkCircularPath,
|
||||
findFilesInCircularPath,
|
||||
@ -454,7 +451,7 @@ export default createESLintRule<Options, MessageIds>({
|
||||
}
|
||||
|
||||
// cannot import apps
|
||||
if (targetProject.type === ProjectType.app) {
|
||||
if (targetProject.type === 'app') {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'noImportsOfApps',
|
||||
@ -463,7 +460,7 @@ export default createESLintRule<Options, MessageIds>({
|
||||
}
|
||||
|
||||
// cannot import e2e projects
|
||||
if (targetProject.type === ProjectType.e2e) {
|
||||
if (targetProject.type === 'e2e') {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'noImportsOfE2e',
|
||||
@ -474,8 +471,8 @@ export default createESLintRule<Options, MessageIds>({
|
||||
// buildable-lib is not allowed to import non-buildable-lib
|
||||
if (
|
||||
enforceBuildableLibDependency === true &&
|
||||
sourceProject.type === ProjectType.lib &&
|
||||
targetProject.type === ProjectType.lib
|
||||
sourceProject.type === 'lib' &&
|
||||
targetProject.type === 'lib'
|
||||
) {
|
||||
if (
|
||||
hasBuildExecutor(sourceProject) &&
|
||||
|
||||
@ -5,7 +5,7 @@ import { existsSync, readFileSync } from 'fs';
|
||||
import { dirname } from 'path';
|
||||
import ts = require('typescript');
|
||||
import { logger } from '@nrwl/devkit';
|
||||
import { appRootPath } from 'nx/src/utils/app-root';
|
||||
import { appRootPath } from '@nrwl/devkit';
|
||||
|
||||
function tryReadBaseJson() {
|
||||
try {
|
||||
|
||||
@ -4,12 +4,9 @@ import {
|
||||
Task,
|
||||
TaskGraph,
|
||||
WorkspaceJsonConfiguration,
|
||||
} from '@nrwl/devkit';
|
||||
import {
|
||||
Hash,
|
||||
Hasher,
|
||||
HashFilter,
|
||||
} from '@nrwl/workspace/src/core/hasher/hasher';
|
||||
Hash,
|
||||
} from '@nrwl/devkit';
|
||||
|
||||
export default async function run(
|
||||
task: Task,
|
||||
@ -25,7 +22,7 @@ export default async function run(
|
||||
: undefined;
|
||||
const filter =
|
||||
jestPluginConfig && jestPluginConfig.hashingExcludesTestsOfDeps
|
||||
? HashFilter.ExcludeTestsOfDeps
|
||||
: HashFilter.AllFiles;
|
||||
? 'exclude-tests-of-deps'
|
||||
: 'all-files';
|
||||
return context.hasher.hashTaskWithDepsAndContext(task, filter);
|
||||
}
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
import { ExecutorContext } from 'nx/src/shared/workspace';
|
||||
|
||||
let runCLI = jest.fn();
|
||||
let readConfig = jest.fn(() =>
|
||||
Promise.resolve({
|
||||
@ -17,6 +15,7 @@ jest.mock('jest-config', () => ({
|
||||
readConfig,
|
||||
}));
|
||||
|
||||
import { ExecutorContext } from '@nrwl/devkit';
|
||||
import { jestExecutor } from './jest.impl';
|
||||
import { JestExecutorOptions } from './schema';
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { getJestProjects } from './get-jest-projects';
|
||||
import * as Workspace from '@nrwl/workspace/src/core/file-utils';
|
||||
import * as Workspace from 'nx/src/core/file-utils';
|
||||
import type { WorkspaceJsonConfiguration } from '@nrwl/devkit';
|
||||
|
||||
describe('getJestProjects', () => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { readWorkspaceConfig } from '@nrwl/workspace/src/core/file-utils';
|
||||
import { dirname, join } from 'path';
|
||||
import type { WorkspaceJsonConfiguration } from '@nrwl/devkit';
|
||||
import { readWorkspaceConfig } from 'nx/src/core/file-utils';
|
||||
|
||||
const JEST_RUNNER_TOKEN = '@nrwl/jest:jest';
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ExecutorContext, ProjectGraphProjectNode } from '@nrwl/devkit';
|
||||
import { readCachedProjectGraph } from '@nrwl/workspace/src/core/project-graph';
|
||||
import { readCachedProjectGraph } from '@nrwl/devkit';
|
||||
import {
|
||||
calculateProjectDependencies,
|
||||
checkDependentProjectsHaveBeenBuilt,
|
||||
|
||||
@ -5,7 +5,7 @@ import * as fse from 'fs-extra';
|
||||
import ignore, { Ignore } from 'ignore';
|
||||
import * as fg from 'fast-glob';
|
||||
import { AssetGlob } from '@nrwl/workspace/src/utilities/assets';
|
||||
import { logger } from 'nx/src/shared/logger';
|
||||
import { logger } from '@nrwl/devkit';
|
||||
|
||||
export type FileEventType = 'create' | 'update' | 'delete';
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { ExecutorContext, logger } from '@nrwl/devkit';
|
||||
import { cacheDir } from '@nrwl/workspace/src/utilities/cache-directory';
|
||||
import { exec, execSync } from 'child_process';
|
||||
import { cacheDir } from '@nrwl/devkit';
|
||||
import { createAsyncIterable } from '../create-async-iterable/create-async-iteratable';
|
||||
import { NormalizedSwcExecutorOptions, SwcCliOptions } from '../schema';
|
||||
import { printDiagnostics } from '../typescript/print-diagnostics';
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
import { ExecutorContext, getPackageManagerCommand } from '@nrwl/devkit';
|
||||
import { readCachedProjectGraph } from '@nrwl/workspace/src/core/project-graph';
|
||||
import {
|
||||
ExecutorContext,
|
||||
getPackageManagerCommand,
|
||||
readCachedProjectGraph,
|
||||
} from '@nrwl/devkit';
|
||||
import { DependentBuildableProjectNode } from '@nrwl/workspace/src/utilities/buildable-libs-utils';
|
||||
import { readTsConfig } from '@nrwl/workspace/src/utilities/typescript';
|
||||
import { NormalizedExecutorOptions } from './schema';
|
||||
|
||||
@ -2,8 +2,9 @@ import {
|
||||
ExecutorContext,
|
||||
normalizePath,
|
||||
ProjectGraphProjectNode,
|
||||
readJsonFile,
|
||||
writeJsonFile,
|
||||
} from '@nrwl/devkit';
|
||||
import { readJsonFile, writeJsonFile } from 'nx/src/utils/fileutils';
|
||||
import {
|
||||
DependentBuildableProjectNode,
|
||||
updateBuildableProjectPackageJsonDependencies,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { logger } from 'nx/src/shared/logger';
|
||||
import { logger } from '@nrwl/devkit';
|
||||
import { join } from 'path';
|
||||
|
||||
export async function watchForSingleFileChanges(
|
||||
|
||||
@ -3,8 +3,9 @@ import {
|
||||
Task,
|
||||
TaskGraph,
|
||||
WorkspaceJsonConfiguration,
|
||||
Hasher,
|
||||
Hash,
|
||||
} from '@nrwl/devkit';
|
||||
import { Hash, Hasher } from '@nrwl/workspace/src/core/hasher/hasher';
|
||||
|
||||
export default async function run(
|
||||
task: Task,
|
||||
|
||||
@ -80,7 +80,7 @@ Object {
|
||||
"e2e",
|
||||
],
|
||||
},
|
||||
"runner": "@nrwl/workspace/tasks-runners/default",
|
||||
"runner": "nx/tasks-runners/default",
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -141,7 +141,7 @@ Object {
|
||||
"e2e",
|
||||
],
|
||||
},
|
||||
"runner": "@nrwl/workspace/tasks-runners/default",
|
||||
"runner": "nx/tasks-runners/default",
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -197,7 +197,7 @@ Object {
|
||||
"e2e",
|
||||
],
|
||||
},
|
||||
"runner": "@nrwl/workspace/tasks-runners/default",
|
||||
"runner": "nx/tasks-runners/default",
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -219,7 +219,7 @@ Object {
|
||||
"e2e",
|
||||
],
|
||||
},
|
||||
"runner": "@nrwl/workspace/tasks-runners/default",
|
||||
"runner": "nx/tasks-runners/default",
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -251,7 +251,7 @@ Object {
|
||||
"e2e",
|
||||
],
|
||||
},
|
||||
"runner": "@nrwl/workspace/tasks-runners/default",
|
||||
"runner": "nx/tasks-runners/default",
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -287,7 +287,7 @@ Object {
|
||||
"e2e",
|
||||
],
|
||||
},
|
||||
"runner": "@nrwl/workspace/tasks-runners/default",
|
||||
"runner": "nx/tasks-runners/default",
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -323,7 +323,7 @@ Object {
|
||||
"e2e",
|
||||
],
|
||||
},
|
||||
"runner": "@nrwl/workspace/tasks-runners/default",
|
||||
"runner": "nx/tasks-runners/default",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { output } from '@nrwl/workspace/src/utilities/output';
|
||||
import { output } from '@nrwl/devkit';
|
||||
import { determineMigration, migrateWorkspace } from './migration';
|
||||
import { initNxCloud, promptForNxCloud } from './nx-cloud';
|
||||
import { installDependencies } from './package-manager';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user