Skip to content

Commit

Permalink
fix(core): workspace-generator signature
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav committed Oct 11, 2022
1 parent a250b61 commit 5c8369a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
4 changes: 1 addition & 3 deletions e2e/nx-misc/src/workspace.test.ts
Expand Up @@ -24,9 +24,7 @@ describe('Workspace Tests', () => {
proj = newProject();
});

afterAll(() => {
cleanupProject();
});
afterAll(() => cleanupProject());

describe('@nrwl/workspace:library', () => {
it('should create a library that can be tested and linted', async () => {
Expand Down
30 changes: 17 additions & 13 deletions packages/nx/src/command-line/nx-commands.ts
Expand Up @@ -259,12 +259,7 @@ export const commandsObject = yargs
await withWorkspaceGeneratorOptions(yargs, process.argv.slice(3)),
'workspace-generator'
),
handler: async () => {
await (
await import('./workspace-generators')
).workspaceGenerators(process.argv.slice(3));
process.exit(0);
},
handler: workspaceGeneratorHandler,
})
.command({
command: 'migrate [packageAndVersion]',
Expand Down Expand Up @@ -847,23 +842,32 @@ async function withCustomGeneratorOptions(
command += ' [options]';
}

yargs.wrap(yargs.terminalWidth()).command(
yargs.command({
// this is the default and only command
command,
schema.description || '',
(yargs) => {
describe: schema.description || '',
builder: (y) => {
options.forEach(({ name, definition }) => {
yargs.option(name, definition);
y.option(name, definition);
});
positionals.forEach(({ name, definition }) => {
yargs.positional(name, definition);
y.positional(name, definition);
});
}
);
return linkToNxDevAndExamples(y, 'workspace-generator');
},
handler: workspaceGeneratorHandler,
});

return yargs;
}

async function workspaceGeneratorHandler() {
await (
await import('./workspace-generators')
).workspaceGenerators(process.argv.slice(3));
process.exit(0);
}

function withMigrationOptions(yargs: yargs.Argv) {
const defaultCommitPrefix = 'chore: [nx migration] ';

Expand Down

0 comments on commit 5c8369a

Please sign in to comment.