Skip to content

Commit f0d67b5

Browse files
committed
fix(core): special case projects for lerna users
1 parent 8f267ed commit f0d67b5

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

packages/nx/src/utils/command-line-utils.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,24 @@ describe('splitArgs', () => {
161161
});
162162
});
163163

164+
it('should split projects when it is a string', () => {
165+
expect(
166+
splitArgsIntoNxArgsAndOverrides(
167+
{
168+
projects: 'aaa,bbb',
169+
__overrides_unparsed__: [],
170+
$0: '',
171+
},
172+
'run-many',
173+
{} as any,
174+
{} as any
175+
).nxArgs
176+
).toEqual({
177+
projects: ['aaa', 'bbb'],
178+
skipNxCache: false,
179+
});
180+
});
181+
164182
it('should set base and head based on environment variables in affected mode, if they are not provided directly on the command', () => {
165183
const originalNxBase = process.env.NX_BASE;
166184
process.env.NX_BASE = 'envVarSha1';

packages/nx/src/utils/command-line-utils.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,11 @@ export function splitArgsIntoNxArgsAndOverrides(
8181
delete (nxArgs as any).__overrides_unparsed__;
8282

8383
if (mode === 'run-many') {
84-
if (!nxArgs.projects) {
85-
nxArgs.projects = [];
84+
const args = nxArgs as any;
85+
if (!args.projects) {
86+
args.projects = [];
87+
} else if (typeof args.projects === 'string') {
88+
args.projects = args.projects.split(',');
8689
}
8790
}
8891

0 commit comments

Comments
 (0)