Skip to content

Commit

Permalink
feat(core): warn when falling back to angular cli for misc commands
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Oct 4, 2022
1 parent 14a3d6e commit ab8650d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/nx/bin/init-local.ts
Expand Up @@ -5,6 +5,7 @@ import { execSync } from 'child_process';

import { commandsObject } from '../src/command-line/nx-commands';
import { WorkspaceTypeAndRoot } from '../src/utils/find-workspace-root';
import { logger, NX_PREFIX } from 'nx/src/utils/logger';

/**
* Nx is being run inside a workspace.
Expand Down Expand Up @@ -83,7 +84,6 @@ function shouldDelegateToAngularCLI() {
const commands = [
'add',
'analytics',
'deploy',
'config',
'doc',
'update',
Expand Down Expand Up @@ -143,6 +143,20 @@ function handleAngularCLIFallbacks(workspace: WorkspaceTypeAndRoot) {
Instead, you could try an Nx Editor Plugin for a visual tool to run Nx commands. If you're using VSCode, you can use the Nx Console plugin, or if you're using WebStorm, you could use one of the available community plugins.
For more information, see https://nx.dev/using-nx/console`);
} else {
const [, , command, project, ...args] = process.argv;
logger.warn(
`${NX_PREFIX} Falling back to \`ng ${command} ${project} ${args.join(
' '
)}\``
);
logger.warn(
`${NX_PREFIX} When running commands through angular CLI, targetDefaults and similar options are not obeyed.`
);
logger.warn(
`${NX_PREFIX} If this is not the desired behaviour, try: \`nx run ${project}:${command} ${args.join(
' '
)}`
);
require('nx/src/adapter/compat');
try {
const cli = require.resolve('@angular/cli/lib/init.js', {
Expand Down

0 comments on commit ab8650d

Please sign in to comment.