Skip to content

Commit

Permalink
feat(core): remove deprecated defaultCollection and npmScope nx.json …
Browse files Browse the repository at this point in the history
…properties
  • Loading branch information
FrozenPandaz committed Oct 18, 2023
1 parent 80ade93 commit d61297b
Show file tree
Hide file tree
Showing 60 changed files with 234 additions and 587 deletions.
21 changes: 4 additions & 17 deletions docs/generated/devkit/NxJsonConfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Nx.json configuration
- [implicitDependencies](../../devkit/documents/NxJsonConfiguration#implicitdependencies): ImplicitDependencyEntry<T>
- [installation](../../devkit/documents/NxJsonConfiguration#installation): NxInstallationConfiguration
- [namedInputs](../../devkit/documents/NxJsonConfiguration#namedinputs): Object
- [npmScope](../../devkit/documents/NxJsonConfiguration#npmscope): string
- [nxCloudAccessToken](../../devkit/documents/NxJsonConfiguration#nxcloudaccesstoken): string
- [nxCloudEncryptionKey](../../devkit/documents/NxJsonConfiguration#nxcloudencryptionkey): string
- [nxCloudUrl](../../devkit/documents/NxJsonConfiguration#nxcloudurl): string
Expand Down Expand Up @@ -66,11 +65,10 @@ Default generator collection. It is used when no collection is provided.

#### Type declaration

| Name | Type | Description |
| :-------------------- | :-------------------------------------------------------- | :--------------------------------------------------------------------- |
| `defaultCollection?` | `string` | **`Deprecated`** - defaultCollection is deprecated and will be removed |
| `defaultProjectName?` | `string` | - |
| `packageManager?` | [`PackageManager`](../../devkit/documents/PackageManager) | - |
| Name | Type |
| :-------------------- | :-------------------------------------------------------- |
| `defaultProjectName?` | `string` |
| `packageManager?` | [`PackageManager`](../../devkit/documents/PackageManager) |

---

Expand Down Expand Up @@ -151,17 +149,6 @@ Named inputs targets can refer to reduce duplication

---

### npmScope

`Optional` **npmScope**: `string`

**`Deprecated`**

This is inferred from the package.json in the workspace root. Please use getNpmScope instead.
NPM Scope that the workspace uses

---

### nxCloudAccessToken

`Optional` **nxCloudAccessToken**: `string`
Expand Down
5 changes: 0 additions & 5 deletions docs/generated/devkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ It only uses language primitives and immutable objects
- [StringChange](../../devkit/documents/StringChange)
- [TargetDefaults](../../devkit/documents/TargetDefaults)
- [TaskGraphExecutor](../../devkit/documents/TaskGraphExecutor)
- [WorkspaceConfiguration](../../devkit/documents/WorkspaceConfiguration)
- [WorkspaceJsonConfiguration](../../devkit/documents/WorkspaceJsonConfiguration)

### Variables
Expand Down Expand Up @@ -117,11 +116,9 @@ It only uses language primitives and immutable objects
- [getPackageManagerVersion](../../devkit/documents/getPackageManagerVersion)
- [getProjects](../../devkit/documents/getProjects)
- [getWorkspaceLayout](../../devkit/documents/getWorkspaceLayout)
- [getWorkspacePath](../../devkit/documents/getWorkspacePath)
- [glob](../../devkit/documents/glob)
- [hashArray](../../devkit/documents/hashArray)
- [installPackagesTask](../../devkit/documents/installPackagesTask)
- [isStandaloneProject](../../devkit/documents/isStandaloneProject)
- [joinPathFragments](../../devkit/documents/joinPathFragments)
- [moveFilesToNewDirectory](../../devkit/documents/moveFilesToNewDirectory)
- [names](../../devkit/documents/names)
Expand All @@ -136,7 +133,6 @@ It only uses language primitives and immutable objects
- [readProjectConfiguration](../../devkit/documents/readProjectConfiguration)
- [readProjectsConfigurationFromProjectGraph](../../devkit/documents/readProjectsConfigurationFromProjectGraph)
- [readTargetOptions](../../devkit/documents/readTargetOptions)
- [readWorkspaceConfiguration](../../devkit/documents/readWorkspaceConfiguration)
- [removeDependenciesFromPackageJson](../../devkit/documents/removeDependenciesFromPackageJson)
- [removeProjectConfiguration](../../devkit/documents/removeProjectConfiguration)
- [reverse](../../devkit/documents/reverse)
Expand All @@ -151,7 +147,6 @@ It only uses language primitives and immutable objects
- [updateNxJson](../../devkit/documents/updateNxJson)
- [updateProjectConfiguration](../../devkit/documents/updateProjectConfiguration)
- [updateTsConfigsToJs](../../devkit/documents/updateTsConfigsToJs)
- [updateWorkspaceConfiguration](../../devkit/documents/updateWorkspaceConfiguration)
- [validateDependency](../../devkit/documents/validateDependency)
- [visitNotIgnoredFiles](../../devkit/documents/visitNotIgnoredFiles)
- [workspaceLayout](../../devkit/documents/workspaceLayout)
Expand Down
25 changes: 4 additions & 21 deletions docs/generated/devkit/Workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use ProjectsConfigurations or NxJsonConfiguration
- [implicitDependencies](../../devkit/documents/Workspace#implicitdependencies): ImplicitDependencyEntry<string[] | "\*">
- [installation](../../devkit/documents/Workspace#installation): NxInstallationConfiguration
- [namedInputs](../../devkit/documents/Workspace#namedinputs): Object
- [npmScope](../../devkit/documents/Workspace#npmscope): string
- [nxCloudAccessToken](../../devkit/documents/Workspace#nxcloudaccesstoken): string
- [nxCloudEncryptionKey](../../devkit/documents/Workspace#nxcloudencryptionkey): string
- [nxCloudUrl](../../devkit/documents/Workspace#nxcloudurl): string
Expand Down Expand Up @@ -74,11 +73,10 @@ Default generator collection. It is used when no collection is provided.

#### Type declaration

| Name | Type | Description |
| :-------------------- | :-------------------------------------------------------- | :--------------------------------------------------------------------- |
| `defaultCollection?` | `string` | **`Deprecated`** - defaultCollection is deprecated and will be removed |
| `defaultProjectName?` | `string` | - |
| `packageManager?` | [`PackageManager`](../../devkit/documents/PackageManager) | - |
| Name | Type |
| :-------------------- | :-------------------------------------------------------- |
| `defaultProjectName?` | `string` |
| `packageManager?` | [`PackageManager`](../../devkit/documents/PackageManager) |

#### Inherited from

Expand Down Expand Up @@ -187,21 +185,6 @@ Named inputs targets can refer to reduce duplication

---

### npmScope

`Optional` **npmScope**: `string`

**`Deprecated`**

This is inferred from the package.json in the workspace root. Please use getNpmScope instead.
NPM Scope that the workspace uses

#### Inherited from

[NxJsonConfiguration](../../devkit/documents/NxJsonConfiguration).[npmScope](../../devkit/documents/NxJsonConfiguration#npmscope)

---

### nxCloudAccessToken

`Optional` **nxCloudAccessToken**: `string`
Expand Down
7 changes: 0 additions & 7 deletions docs/generated/devkit/WorkspaceConfiguration.md

This file was deleted.

13 changes: 6 additions & 7 deletions docs/generated/devkit/getWorkspaceLayout.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ and the default scope.
Example:

```typescript
{ appsDir: 'apps', libsDir: 'libs', npmScope: 'myorg' }
{ appsDir: 'apps', libsDir: 'libs' }
```

#### Parameters
Expand All @@ -21,9 +21,8 @@ Example:

`Object`

| Name | Type | Description |
| :-------------------- | :-------- | :----------------------------------------------------------------------- |
| `appsDir` | `string` | - |
| `libsDir` | `string` | - |
| `npmScope` | `string` | **`Deprecated`** This will be removed in Nx 17. Use getNpmScope instead. |
| `standaloneAsDefault` | `boolean` | - |
| Name | Type |
| :-------------------- | :-------- |
| `appsDir` | `string` |
| `libsDir` | `string` |
| `standaloneAsDefault` | `boolean` |
17 changes: 0 additions & 17 deletions docs/generated/devkit/getWorkspacePath.md

This file was deleted.

20 changes: 0 additions & 20 deletions docs/generated/devkit/isStandaloneProject.md

This file was deleted.

21 changes: 0 additions & 21 deletions docs/generated/devkit/readWorkspaceConfiguration.md

This file was deleted.

22 changes: 0 additions & 22 deletions docs/generated/devkit/updateWorkspaceConfiguration.md

This file was deleted.

5 changes: 0 additions & 5 deletions docs/generated/packages/angular/generators/ng-add.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
"description": "Migrates an Angular CLI workspace to Nx or adds the Angular plugin to an Nx workspace. NOTE: Does not work in the `--dry-run` mode.",
"type": "object",
"properties": {
"npmScope": {
"type": "string",
"description": "Npm scope for importing libs. NOTE: only used if running the generator in an Angular CLI workspace.",
"x-deprecated": "This will be inferred from your root package.json"
},
"defaultBase": {
"type": "string",
"description": "Default base branch for affected. NOTE: only used if running the generator in an Angular CLI workspace.",
Expand Down
5 changes: 0 additions & 5 deletions docs/generated/packages/devkit/documents/nx_devkit.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ It only uses language primitives and immutable objects
- [StringChange](../../devkit/documents/StringChange)
- [TargetDefaults](../../devkit/documents/TargetDefaults)
- [TaskGraphExecutor](../../devkit/documents/TaskGraphExecutor)
- [WorkspaceConfiguration](../../devkit/documents/WorkspaceConfiguration)
- [WorkspaceJsonConfiguration](../../devkit/documents/WorkspaceJsonConfiguration)

### Variables
Expand Down Expand Up @@ -117,11 +116,9 @@ It only uses language primitives and immutable objects
- [getPackageManagerVersion](../../devkit/documents/getPackageManagerVersion)
- [getProjects](../../devkit/documents/getProjects)
- [getWorkspaceLayout](../../devkit/documents/getWorkspaceLayout)
- [getWorkspacePath](../../devkit/documents/getWorkspacePath)
- [glob](../../devkit/documents/glob)
- [hashArray](../../devkit/documents/hashArray)
- [installPackagesTask](../../devkit/documents/installPackagesTask)
- [isStandaloneProject](../../devkit/documents/isStandaloneProject)
- [joinPathFragments](../../devkit/documents/joinPathFragments)
- [moveFilesToNewDirectory](../../devkit/documents/moveFilesToNewDirectory)
- [names](../../devkit/documents/names)
Expand All @@ -136,7 +133,6 @@ It only uses language primitives and immutable objects
- [readProjectConfiguration](../../devkit/documents/readProjectConfiguration)
- [readProjectsConfigurationFromProjectGraph](../../devkit/documents/readProjectsConfigurationFromProjectGraph)
- [readTargetOptions](../../devkit/documents/readTargetOptions)
- [readWorkspaceConfiguration](../../devkit/documents/readWorkspaceConfiguration)
- [removeDependenciesFromPackageJson](../../devkit/documents/removeDependenciesFromPackageJson)
- [removeProjectConfiguration](../../devkit/documents/removeProjectConfiguration)
- [reverse](../../devkit/documents/reverse)
Expand All @@ -151,7 +147,6 @@ It only uses language primitives and immutable objects
- [updateNxJson](../../devkit/documents/updateNxJson)
- [updateProjectConfiguration](../../devkit/documents/updateProjectConfiguration)
- [updateTsConfigsToJs](../../devkit/documents/updateTsConfigsToJs)
- [updateWorkspaceConfiguration](../../devkit/documents/updateWorkspaceConfiguration)
- [validateDependency](../../devkit/documents/validateDependency)
- [visitNotIgnoredFiles](../../devkit/documents/visitNotIgnoredFiles)
- [workspaceLayout](../../devkit/documents/workspaceLayout)
Expand Down
4 changes: 4 additions & 0 deletions docs/shared/deprecated/default-collection.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# defaultCollection

{% callout type="caution" title="Experimental" %}
Configuring `defaultCollection` will no longer have any effect in Nx 17+
{% /callout %}

In the `nx.json` you can set a `defaultCollection` property like this:

```jsonc
Expand Down
2 changes: 1 addition & 1 deletion docs/shared/reference/nx-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The `npmScope` property of the `nx.json` file is deprecated as of version 16.2.0

In Nx 16, if the `npmScope` property is present, it will be used as a prefix. If the `npmScope` property is not present, the `name` property of the root `package.json` file will be used to infer the prefix.

In Nx 17, the `npmScope` property will be ignored.
In Nx 17, the `npmScope` property is ignored.

### Affected

Expand Down
16 changes: 9 additions & 7 deletions e2e/plugin/src/nx-plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import {
import { join } from 'path';

describe('Nx Plugin', () => {
let npmScope: string;
let workspaceName: string;

beforeAll(() => {
npmScope = newProject();
workspaceName = newProject();
});

afterAll(() => cleanupProject());
Expand Down Expand Up @@ -292,7 +292,7 @@ describe('Nx Plugin', () => {
// Register plugin in nx.json (required for inference)
updateFile(`nx.json`, (nxJson) => {
const nx = JSON.parse(nxJson);
nx.plugins = [`@${npmScope}/${plugin}`];
nx.plugins = [`@${workspaceName}/${plugin}`];
return JSON.stringify(nx, null, 2);
});

Expand All @@ -315,7 +315,7 @@ describe('Nx Plugin', () => {
const nx = JSON.parse(nxJson);
nx.plugins = [
{
plugin: `@${npmScope}/${plugin}`,
plugin: `@${workspaceName}/${plugin}`,
options: { inferredTags: ['my-tag'] },
},
];
Expand Down Expand Up @@ -351,13 +351,13 @@ describe('Nx Plugin', () => {
);

runCLI(
`generate @${npmScope}/${plugin}:${generator} --name ${generatedProject}`
`generate @${workspaceName}/${plugin}:${generator} --name ${generatedProject}`
);

updateFile(`libs/${generatedProject}/project.json`, (f) => {
const project: ProjectConfiguration = JSON.parse(f);
project.targets['execute'] = {
executor: `@${npmScope}/${plugin}:${executor}`,
executor: `@${workspaceName}/${plugin}:${executor}`,
};
return JSON.stringify(project, null, 2);
});
Expand All @@ -383,7 +383,9 @@ describe('Nx Plugin', () => {
);

runCLI(
`generate @${npmScope}/${plugin}:${generator} --name ${uniq('test')}`
`generate @${workspaceName}/${plugin}:${generator} --name ${uniq(
'test'
)}`
);
}).not.toThrow();
updateFile('package.json', JSON.stringify(oldPackageJson, null, 2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,6 @@ describe('workspace', () => {
expect(tree.exists('angular.json')).toBe(false);
});

it('should set the default collection to @nx/angular', async () => {
await migrateFromAngularCli(tree, {});
expect(
readJson(tree, 'nx.json').cli?.defaultCollection
).not.toBeDefined();
});

it('should set the default project correctly', async () => {
await migrateFromAngularCli(tree, {});
expect(readJson(tree, 'nx.json').defaultProject).toBe('myApp');
Expand Down
4 changes: 0 additions & 4 deletions packages/angular/src/generators/ng-add/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners';
import type { Styles } from '../utils/types';

export interface GeneratorOptions {
/**
* @deprecated This should be inferred with {@link getNpmScope}
*/
npmScope?: string;
defaultBase?: string;

unitTestRunner?: UnitTestRunner;
Expand Down
Loading

0 comments on commit d61297b

Please sign in to comment.