Skip to content

Commit

Permalink
fix(misc): create workspaces and default app with the name as provided (
Browse files Browse the repository at this point in the history
#23196)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #19253

(cherry picked from commit 4cc3dc6)
  • Loading branch information
leosvelperez authored and FrozenPandaz committed May 9, 2024
1 parent 3367cc9 commit 04bb40e
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 28 deletions.
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;
}

0 comments on commit 04bb40e

Please sign in to comment.