feat(core): remove unused CLI option from CNW (#14865)
This commit is contained in:
parent
066c3b1e71
commit
762b9f336c
@ -45,14 +45,6 @@ Choices: [github, circleci, azure, bitbucket-pipelines, gitlab]
|
||||
|
||||
Generate a CI workflow file
|
||||
|
||||
### cli
|
||||
|
||||
Type: `string`
|
||||
|
||||
Choices: [nx, angular]
|
||||
|
||||
CLI to power the Nx workspace
|
||||
|
||||
### commit.email
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -45,14 +45,6 @@ Choices: [github, circleci, azure, bitbucket-pipelines, gitlab]
|
||||
|
||||
Generate a CI workflow file
|
||||
|
||||
### cli
|
||||
|
||||
Type: `string`
|
||||
|
||||
Choices: [nx, angular]
|
||||
|
||||
CLI to power the Nx workspace
|
||||
|
||||
### commit.email
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -15,12 +15,6 @@
|
||||
"$default": { "$source": "argv", "index": 0 },
|
||||
"x-prompt": "What name would you like to use for the workspace?"
|
||||
},
|
||||
"cli": {
|
||||
"description": "CLI used for generating code and running tasks.",
|
||||
"type": "string",
|
||||
"enum": ["nx", "angular"],
|
||||
"default": "nx"
|
||||
},
|
||||
"style": {
|
||||
"description": "The file extension to be used for style files.",
|
||||
"type": "string",
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
"description": "Npm scope for importing libs.",
|
||||
"type": "string"
|
||||
},
|
||||
"cli": { "description": "CLI powering the workspace.", "type": "string" },
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
|
||||
@ -14,9 +14,6 @@ describe('Angular Config', () => {
|
||||
afterAll(() => cleanupProject());
|
||||
|
||||
it('should upgrade the config correctly', async () => {
|
||||
const previousCI = process.env.SELECTED_CLI;
|
||||
process.env.SELECTED_CLI = 'angular';
|
||||
|
||||
const myapp = uniq('myapp');
|
||||
runCLI(`generate @nrwl/angular:app ${myapp} --no-interactive`);
|
||||
|
||||
@ -34,8 +31,6 @@ describe('Angular Config', () => {
|
||||
const myapp2 = uniq('myapp');
|
||||
runCLI(`generate @nrwl/angular:app ${myapp2} --no-interactive`);
|
||||
expectTestsPass(await runCLIAsync(`test ${myapp2} --no-watch`));
|
||||
|
||||
process.env.SELECTED_CLI = previousCI;
|
||||
}, 1000000);
|
||||
});
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
process.env.SELECTED_CLI = 'angular';
|
||||
|
||||
import {
|
||||
checkFilesDoNotExist,
|
||||
checkFilesExist,
|
||||
@ -56,6 +54,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
|
||||
runNgAdd('@cypress/schematic', '--e2e-update', '1.7.0');
|
||||
packageInstall('cypress', null, '^9.0.0');
|
||||
}
|
||||
|
||||
function addCypress10() {
|
||||
runNgAdd('@cypress/schematic', '--e2e', 'latest');
|
||||
}
|
||||
|
||||
@ -13,8 +13,6 @@ import {
|
||||
import { PackageManager } from 'nx/src/utils/package-manager';
|
||||
import { removeSync } from 'fs-extra';
|
||||
|
||||
process.env.SELECTED_CLI = 'angular';
|
||||
|
||||
describe('using Nx executors and generators with Angular CLI', () => {
|
||||
let project: string;
|
||||
let packageManager: PackageManager;
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
process.env.SELECTED_CLI = 'angular';
|
||||
|
||||
import {
|
||||
cleanupProject,
|
||||
listFiles,
|
||||
|
||||
@ -1,19 +1,17 @@
|
||||
process.env.SELECTED_CLI = 'angular';
|
||||
|
||||
import {
|
||||
checkFilesExist,
|
||||
cleanupProject,
|
||||
getPackageManagerCommand,
|
||||
isNotWindows,
|
||||
killPorts,
|
||||
newProject,
|
||||
readFile,
|
||||
cleanupProject,
|
||||
runCLI,
|
||||
runCommand,
|
||||
runCypressTests,
|
||||
tmpProjPath,
|
||||
uniq,
|
||||
getPackageManagerCommand,
|
||||
updateJson,
|
||||
runCommand,
|
||||
} from '@nrwl/e2e/utils';
|
||||
import { writeFileSync } from 'fs';
|
||||
|
||||
|
||||
@ -67,10 +67,6 @@ interface RunCmdOpts {
|
||||
silent?: boolean;
|
||||
}
|
||||
|
||||
export function currentCli() {
|
||||
return process.env.SELECTED_CLI || 'nx';
|
||||
}
|
||||
|
||||
export const e2eRoot = isCI
|
||||
? dirSync({ prefix: 'nx-e2e-' }).name
|
||||
: '/tmp/nx-e2e';
|
||||
@ -82,7 +78,7 @@ export function isVerbose() {
|
||||
);
|
||||
}
|
||||
|
||||
export const e2eCwd = `${e2eRoot}/${currentCli()}`;
|
||||
export const e2eCwd = `${e2eRoot}/nx`;
|
||||
ensureDirSync(e2eCwd);
|
||||
|
||||
let projName: string;
|
||||
@ -137,7 +133,6 @@ export function runCreateWorkspace(
|
||||
style,
|
||||
base,
|
||||
packageManager,
|
||||
cli,
|
||||
extraArgs,
|
||||
ci,
|
||||
useDetectedPm = false,
|
||||
@ -149,7 +144,6 @@ export function runCreateWorkspace(
|
||||
style?: string;
|
||||
base?: string;
|
||||
packageManager?: 'npm' | 'yarn' | 'pnpm';
|
||||
cli?: string;
|
||||
extraArgs?: string;
|
||||
ci?: 'azure' | 'github' | 'circleci';
|
||||
useDetectedPm?: boolean;
|
||||
@ -161,9 +155,7 @@ export function runCreateWorkspace(
|
||||
|
||||
const pm = getPackageManagerCommand({ packageManager });
|
||||
|
||||
let command = `${pm.createWorkspace} ${name} --cli=${
|
||||
cli || currentCli()
|
||||
} --preset=${preset} --no-nxCloud --no-interactive`;
|
||||
let command = `${pm.createWorkspace} ${name} --preset=${preset} --no-nxCloud --no-interactive`;
|
||||
if (appName) {
|
||||
command += ` --appName=${appName}`;
|
||||
}
|
||||
|
||||
@ -293,7 +293,6 @@ describe('create-nx-workspace', () => {
|
||||
appName,
|
||||
style: 'css',
|
||||
packageManager: 'npm',
|
||||
cli: 'angular',
|
||||
});
|
||||
|
||||
checkFilesDoNotExist('yarn.lock');
|
||||
|
||||
@ -29,7 +29,6 @@ type Arguments = {
|
||||
name: string;
|
||||
preset: string;
|
||||
appName: string;
|
||||
cli: string;
|
||||
style: string;
|
||||
framework: string;
|
||||
docker: boolean;
|
||||
@ -140,11 +139,6 @@ export const commandsObject: yargs.Argv<Arguments> = yargs
|
||||
describe: chalk.dim`Enable interactive mode with presets`,
|
||||
type: 'boolean',
|
||||
})
|
||||
.option('cli', {
|
||||
describe: chalk.dim`CLI to power the Nx workspace`,
|
||||
choices: ['nx', 'angular'],
|
||||
type: 'string',
|
||||
})
|
||||
.option('style', {
|
||||
describe: chalk.dim`Style option to be used when a preset with pregenerated app is selected`,
|
||||
type: 'string',
|
||||
@ -230,7 +224,6 @@ export const commandsObject: yargs.Argv<Arguments> = yargs
|
||||
async function main(parsedArgs: yargs.Arguments<Arguments>) {
|
||||
const {
|
||||
name,
|
||||
cli,
|
||||
preset,
|
||||
appName,
|
||||
style,
|
||||
@ -261,7 +254,6 @@ async function main(parsedArgs: yargs.Arguments<Arguments>) {
|
||||
packageManager as PackageManager,
|
||||
{
|
||||
...parsedArgs,
|
||||
cli,
|
||||
preset,
|
||||
appName,
|
||||
style,
|
||||
@ -384,7 +376,6 @@ async function getConfiguration(
|
||||
style = await determineStyle(preset, argv);
|
||||
}
|
||||
|
||||
const cli = await determineCli(preset, argv);
|
||||
const packageManager = await determinePackageManager(argv);
|
||||
const defaultBase = await determineDefaultBase(argv);
|
||||
const nxCloud = await determineNxCloud(argv);
|
||||
@ -396,7 +387,6 @@ async function getConfiguration(
|
||||
appName,
|
||||
style,
|
||||
framework,
|
||||
cli,
|
||||
nxCloud,
|
||||
packageManager,
|
||||
defaultBase,
|
||||
@ -768,35 +758,6 @@ async function determineDockerfile(
|
||||
}
|
||||
}
|
||||
|
||||
function isValidCli(cli: string): cli is 'angular' | 'nx' {
|
||||
return ['nx', 'angular'].indexOf(cli) !== -1;
|
||||
}
|
||||
|
||||
async function determineCli(
|
||||
preset: Preset,
|
||||
parsedArgs: yargs.Arguments<Arguments>
|
||||
): Promise<'nx' | 'angular'> {
|
||||
if (parsedArgs.cli) {
|
||||
if (!isValidCli(parsedArgs.cli)) {
|
||||
output.error({
|
||||
title: 'Invalid cli',
|
||||
bodyLines: [`It must be one of the following:`, '', 'nx', 'angular'],
|
||||
});
|
||||
process.exit(1);
|
||||
}
|
||||
return Promise.resolve(parsedArgs.cli);
|
||||
}
|
||||
|
||||
switch (preset) {
|
||||
case Preset.AngularMonorepo: {
|
||||
return Promise.resolve('angular');
|
||||
}
|
||||
default: {
|
||||
return Promise.resolve('nx');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function determineStyle(
|
||||
preset: Preset,
|
||||
parsedArgs: yargs.Arguments<Arguments>
|
||||
@ -1064,7 +1025,7 @@ async function createApp(
|
||||
packageManager: PackageManager,
|
||||
parsedArgs: any
|
||||
): Promise<string> {
|
||||
const { _, cli, ...restArgs } = parsedArgs;
|
||||
const { _, ...restArgs } = parsedArgs;
|
||||
|
||||
// Ensure to use packageManager for args
|
||||
// if it's not already passed in from previous process
|
||||
@ -1122,17 +1083,8 @@ async function createPreset(
|
||||
packageManager: PackageManager,
|
||||
directory: string
|
||||
): Promise<void> {
|
||||
const {
|
||||
_,
|
||||
cli,
|
||||
skipGit,
|
||||
ci,
|
||||
commit,
|
||||
allPrompts,
|
||||
nxCloud,
|
||||
preset,
|
||||
...restArgs
|
||||
} = parsedArgs;
|
||||
const { _, skipGit, ci, commit, allPrompts, nxCloud, preset, ...restArgs } =
|
||||
parsedArgs;
|
||||
|
||||
const args = unparse(restArgs).join(' ');
|
||||
|
||||
|
||||
@ -15,12 +15,6 @@
|
||||
},
|
||||
"x-prompt": "What name would you like to use for the workspace?"
|
||||
},
|
||||
"cli": {
|
||||
"description": "CLI used for generating code and running tasks.",
|
||||
"type": "string",
|
||||
"enum": ["nx", "angular"],
|
||||
"default": "nx"
|
||||
},
|
||||
"style": {
|
||||
"description": "The file extension to be used for style files.",
|
||||
"type": "string",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Tree, readJson, readProjectConfiguration } from '@nrwl/devkit';
|
||||
import { readProjectConfiguration, Tree } from '@nrwl/devkit';
|
||||
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
|
||||
import { overrideCollectionResolutionForTesting } from '@nrwl/devkit/ngcli-adapter';
|
||||
import { presetGenerator } from './preset';
|
||||
@ -45,7 +45,6 @@ describe('preset', () => {
|
||||
await presetGenerator(tree, {
|
||||
name: 'proj',
|
||||
preset: Preset.AngularMonorepo,
|
||||
cli: 'nx',
|
||||
style: 'css',
|
||||
linter: 'eslint',
|
||||
});
|
||||
@ -58,7 +57,6 @@ describe('preset', () => {
|
||||
await presetGenerator(tree, {
|
||||
name: 'proj',
|
||||
preset: Preset.WebComponents,
|
||||
cli: 'nx',
|
||||
});
|
||||
expect(tree.exists('/apps/proj/src/main.ts')).toBe(true);
|
||||
});
|
||||
@ -69,7 +67,6 @@ describe('preset', () => {
|
||||
preset: Preset.ReactMonorepo,
|
||||
style: 'css',
|
||||
linter: 'eslint',
|
||||
cli: 'nx',
|
||||
});
|
||||
expect(tree.exists('/apps/proj/src/main.tsx')).toBe(true);
|
||||
expect(readProjectConfiguration(tree, 'proj').targets.serve).toBeDefined();
|
||||
@ -81,7 +78,6 @@ describe('preset', () => {
|
||||
preset: Preset.NextJs,
|
||||
style: 'css',
|
||||
linter: 'eslint',
|
||||
cli: 'nx',
|
||||
});
|
||||
expect(tree.exists('/apps/proj/pages/index.tsx')).toBe(true);
|
||||
});
|
||||
@ -91,7 +87,6 @@ describe('preset', () => {
|
||||
name: 'proj',
|
||||
preset: Preset.Express,
|
||||
linter: 'eslint',
|
||||
cli: 'nx',
|
||||
});
|
||||
|
||||
expect(tree.exists('apps/proj/src/main.ts')).toBe(true);
|
||||
@ -103,7 +98,6 @@ describe('preset', () => {
|
||||
name: 'proj',
|
||||
preset: Preset.ReactNative,
|
||||
linter: 'eslint',
|
||||
cli: 'nx',
|
||||
});
|
||||
|
||||
expect(tree.exists('/apps/proj/src/app/App.tsx')).toBe(true);
|
||||
@ -115,7 +109,6 @@ describe('preset', () => {
|
||||
preset: Preset.ReactStandalone,
|
||||
style: 'css',
|
||||
linter: 'eslint',
|
||||
cli: 'nx',
|
||||
bundler: 'webpack',
|
||||
});
|
||||
expect(tree.exists('webpack.config.js')).toBe(true);
|
||||
@ -130,7 +123,6 @@ describe('preset', () => {
|
||||
preset: Preset.ReactStandalone,
|
||||
style: 'css',
|
||||
linter: 'eslint',
|
||||
cli: 'nx',
|
||||
bundler: 'vite',
|
||||
});
|
||||
expect(tree.exists('vite.config.ts')).toBe(true);
|
||||
|
||||
@ -5,7 +5,6 @@ export interface Schema {
|
||||
name: string;
|
||||
npmScope?: string;
|
||||
style?: string;
|
||||
cli: string;
|
||||
linter?: string;
|
||||
preset: Preset;
|
||||
standaloneConfig?: boolean;
|
||||
|
||||
@ -18,10 +18,6 @@
|
||||
"description": "Npm scope for importing libs.",
|
||||
"type": "string"
|
||||
},
|
||||
"cli": {
|
||||
"description": "CLI powering the workspace.",
|
||||
"type": "string"
|
||||
},
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user