Skip to content

Commit

Permalink
fix(core): handle spaces in workspace path
Browse files Browse the repository at this point in the history
Closes nrwl#3919
  • Loading branch information
bekos authored and Doginal committed Nov 25, 2020
1 parent 5d73ba5 commit 7a45b68
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
21 changes: 20 additions & 1 deletion e2e/workspace/src/create-nx-workspace.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { forEachCli, runCreateWorkspace, uniq } from '@nrwl/e2e/utils';
import { cli, forEachCli, runCreateWorkspace, uniq } from '@nrwl/e2e/utils';
import { existsSync, mkdirSync } from 'fs-extra';
import { execSync } from 'child_process';

forEachCli(() => {
describe('create-nx-workspace', () => {
Expand Down Expand Up @@ -92,5 +94,22 @@ forEachCli(() => {
appName,
});
});

it('should handle spaces in workspace path', () => {
const wsName = uniq('empty');

const tmpDir = `./tmp/${cli}/with space`;

mkdirSync(tmpDir);

const command = `npx create-nx-workspace@${process.env.PUBLISHED_VERSION} ${wsName} --cli=${cli} --preset=empty --no-nxCloud --no-interactive`;
execSync(command, {
cwd: tmpDir,
stdio: [0, 1, 2],
env: process.env,
});

expect(existsSync(`${tmpDir}/${wsName}/package.json`)).toBeTruthy();
});
});
});
2 changes: 1 addition & 1 deletion packages/create-nx-plugin/bin/create-nx-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function createWorkspace(
`${packageExec} tao ${command.replace(
'--collection=@nrwl/workspace',
`--collection=${collectionJsonPath}`
)} --nxWorkspaceRoot=${process.cwd()}`,
)} --nxWorkspaceRoot="${process.cwd()}"`,
{
stdio: [0, 1, 2],
cwd: tmpDir,
Expand Down
2 changes: 1 addition & 1 deletion packages/create-nx-workspace/bin/create-nx-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ function createApp(
`${packageExec} tao ${command.replace(
'--collection=@nrwl/workspace',
`--collection=${collectionJsonPath}`
)} --cli=${cli.command} --nxWorkspaceRoot=${process.cwd()}`,
)} --cli=${cli.command} --nxWorkspaceRoot="${process.cwd()}"`,
{
stdio: [0, 1, 2],
cwd: tmpDir,
Expand Down

0 comments on commit 7a45b68

Please sign in to comment.