Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(misc): create workspaces and default app with the name as provided #23196

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/create-nx-workspace/src/create-empty-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
getPackageManagerVersion,
PackageManager,
} from './utils/package-manager';
import { getFileName } from './utils/string-utils';
import { unparse } from './utils/unparse';

/**
Expand All @@ -32,7 +31,6 @@ export async function createEmptyWorkspace<T extends CreateWorkspaceOptions>(
options.packageManager = packageManager;
}

options.name = getFileName(name);
const directory = options.name;

const args = unparse({
Expand Down
11 changes: 0 additions & 11 deletions packages/create-nx-workspace/src/utils/string-utils.spec.ts

This file was deleted.

7 changes: 0 additions & 7 deletions packages/create-nx-workspace/src/utils/string-utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
export function stringifyCollection(items: string[]): string {
return items.map((item) => `"${item}"`).join(', ');
}

export function getFileName(name: string) {
return name
.replace(/([a-z\d])([A-Z])/g, '$1_$2')
.toLowerCase()
.replace(/[ _]/g, '-');
}
2 changes: 0 additions & 2 deletions packages/workspace/src/generators/new/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
getPackageManagerCommand,
installPackagesTask,
joinPathFragments,
names,
PackageManager,
Tree,
} from '@nx/devkit';
Expand Down Expand Up @@ -131,7 +130,6 @@ function normalizeOptions(options: Schema): NormalizedSchema {
...options,
};

normalized.name = names(options.name).fileName;
if (!options.directory) {
normalized.directory = normalized.name;
}
Expand Down
6 changes: 0 additions & 6 deletions packages/workspace/src/generators/preset/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Preset } from '../utils/presets';
import { join } from 'path';

export async function presetGenerator(tree: Tree, options: Schema) {
options = normalizeOptions(options);
const presetTask = await createPreset(tree, options);
return async () => {
installPackagesTask(tree);
Expand Down Expand Up @@ -314,8 +313,3 @@ async function createPreset(tree: Tree, options: Schema) {
throw new Error(`Invalid preset ${options.preset}`);
}
}

function normalizeOptions(options: Schema): Schema {
options.name = names(options.name).fileName;
return options;
}