fix(react): fix windows style paths when generating with --directory (#16961)
This commit is contained in:
parent
cf0aa591a1
commit
539ed5f49e
@ -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 () => {
|
it('should generate files', async () => {
|
||||||
const hasJsonValue = ({ path, expectedValue, lookupFn }) => {
|
const hasJsonValue = ({ path, expectedValue, lookupFn }) => {
|
||||||
const config = readJson(appTree, path);
|
const config = readJson(appTree, path);
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import {
|
|||||||
import { findFreePort } from './find-free-port';
|
import { findFreePort } from './find-free-port';
|
||||||
|
|
||||||
export function normalizeDirectory(options: Schema) {
|
export function normalizeDirectory(options: Schema) {
|
||||||
|
options.directory = options.directory?.replace(/\\{1,2}/g, '/');
|
||||||
const { projectDirectory } = extractLayoutDirectory(options.directory);
|
const { projectDirectory } = extractLayoutDirectory(options.directory);
|
||||||
return projectDirectory
|
return projectDirectory
|
||||||
? `${names(projectDirectory).fileName}/${names(options.name).fileName}`
|
? `${names(projectDirectory).fileName}/${names(options.name).fileName}`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user