Skip to content

Commit

Permalink
cleanup(core): remove the level of indirection left after inlining ta…
Browse files Browse the repository at this point in the history
…o into nx
  • Loading branch information
vsavkin committed Mar 22, 2022
1 parent 6f5a803 commit 2f46802
Show file tree
Hide file tree
Showing 315 changed files with 3,209 additions and 3,556 deletions.
2 changes: 1 addition & 1 deletion dep-graph/client/src/app/fetch-project-graph-service.ts
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion dep-graph/client/src/app/hooks/use-environment-config.ts
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion dep-graph/client/src/app/interfaces.ts
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion dep-graph/client/src/app/local-project-graph-service.ts
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion dep-graph/client/src/app/mock-project-graph-service.ts
Expand Up @@ -3,7 +3,7 @@ import type {
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 {
Expand Down
2 changes: 1 addition & 1 deletion dep-graph/client/src/app/shell.tsx
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion dep-graph/client/src/globals.d.ts
@@ -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 {
Expand Down
28 changes: 7 additions & 21 deletions e2e/angular-core/src/ng-add.test.ts
@@ -1,3 +1,5 @@
import { PackageManager } from 'nx/src/utils/package-manager';

process.env.SELECTED_CLI = 'angular';

import {
Expand All @@ -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;
Expand Down Expand Up @@ -156,27 +157,12 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
npmScope: 'projscope',
affected: { defaultBase: 'main' },
implicitDependencies: {
'package.json': {
dependencies: '*',
devDependencies: '*',
},
'angular.json': '*',
'package.json': '*',
'tslint.json': '*',
'.eslintrc.json': '*',
},
tasksRunnerOptions: {
default: {
runner: '@nrwl/workspace/tasks-runners/default',
options: {
cacheableOperations: ['build', 'lint', 'test', 'e2e'],
},
},
},
targetDependencies: {
build: [
{
target: 'build',
projects: 'dependencies',
},
],
'tsconfig.base.json': '*',
'nx.json': '*',
},
cli: { defaultCollection: '@nrwl/angular', packageManager },
defaultProject: project,
Expand Down
6 changes: 3 additions & 3 deletions e2e/cli/src/cli.test.ts
@@ -1,4 +1,3 @@
import { packagesWeCareAbout } from '@nrwl/workspace/src/command-line/report';
import { renameSync } from 'fs';
import {
newProject,
Expand All @@ -11,6 +10,7 @@ import {
updateFile,
updateProjectConfig,
} from '@nrwl/e2e/utils';
import { packagesWeCareAbout } from 'nx/src/command-line/report';

describe('Cli', () => {
beforeEach(() => newProject());
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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');

Expand Down
73 changes: 0 additions & 73 deletions karma.conf.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/angular/scripts/nx-cli-warning.js
Expand Up @@ -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: [
Expand Down
Expand Up @@ -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,
Expand Down
Expand Up @@ -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';
Expand Down
@@ -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';
Expand Down
Expand Up @@ -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,
Expand Down
@@ -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');
Expand Down
@@ -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');
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/src/executors/package/package.impl.ts
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/src/executors/utilities/tailwindcss.ts
@@ -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';
Expand Down
47 changes: 23 additions & 24 deletions packages/angular/src/generators/library/library.spec.ts
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 () => {
Expand Down
@@ -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';
Expand Down
@@ -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';
Expand Down Expand Up @@ -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 () => {
Expand Down
Expand Up @@ -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';
Expand All @@ -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',
Expand Down

0 comments on commit 2f46802

Please sign in to comment.