Skip to content

Commit

Permalink
fix(react): fix windows style paths when generating with --directory (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ndcunningham committed May 11, 2023
1 parent cf0aa59 commit 539ed5f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/react/src/generators/application/application.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,22 @@ describe('app', () => {
});
});

it("should generate correct directory for window's style paths", async () => {
await applicationGenerator(appTree, {
...schema,
directory: 'myOuterDir\\myInnerDir',
});

const projectsConfigurations = getProjects(appTree);

expect(
projectsConfigurations.get('my-outer-dir-my-inner-dir-my-app').root
).toEqual('apps/my-outer-dir/my-inner-dir/my-app');
expect(
projectsConfigurations.get('my-outer-dir-my-inner-dir-my-app-e2e').root
).toEqual('apps/my-outer-dir/my-inner-dir/my-app-e2e');
});

it('should generate files', async () => {
const hasJsonValue = ({ path, expectedValue, lookupFn }) => {
const config = readJson(appTree, path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import { findFreePort } from './find-free-port';

export function normalizeDirectory(options: Schema) {
options.directory = options.directory?.replace(/\\{1,2}/g, '/');
const { projectDirectory } = extractLayoutDirectory(options.directory);
return projectDirectory
? `${names(projectDirectory).fileName}/${names(options.name).fileName}`
Expand Down

1 comment on commit 539ed5f

@vercel
Copy link

@vercel vercel bot commented on 539ed5f May 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx-five.vercel.app
nx.dev

Please sign in to comment.