Skip to content

Commit

Permalink
feat(misc): remove references to projectNameAndRootFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo committed Sep 25, 2024
1 parent fbc1c96 commit 271935e
Show file tree
Hide file tree
Showing 213 changed files with 1,716 additions and 1,501 deletions.
6 changes: 3 additions & 3 deletions docs/shared/recipes/module-federation/federate-a-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Since we are using Nx, we will create a library for this module.
**Create a library**

```shell
nx generate @nx/js:library --name=hello --unitTestRunner=jest --projectNameAndRootFormat=as-provided
nx generate @nx/js:library --name=hello --unitTestRunner=jest
```

Update the `hello.ts` file with the following code:
Expand All @@ -46,14 +46,14 @@ Now that we have created the module, we need to configure it to be federated.
{%tab label="React"%}

```shell
nx generate @nx/react:federate-module hello/src/index.ts --name=hello --remote=greeting --projectNameAndRootFormat=as-provided
nx generate @nx/react:federate-module hello/src/index.ts --name=hello --remote=greeting
```

{% /tab %}
{%tab label="Angular"%}

```shell
nx generate @nx/angular:federate-module hello/src/index.ts --name=hello --remote=greeting --projectNameAndRootFormat=as-provided
nx generate @nx/angular:federate-module hello/src/index.ts --name=hello --remote=greeting
```

{% /tab %}
Expand Down
2 changes: 1 addition & 1 deletion docs/shared/recipes/storybook/one-storybook-for-all.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
{% /callout %}

```shell
nx g @nx/react:library storybook-host --directory=libs/storybook-host --bundler=none --unitTestRunner=none --projectNameAndRootFormat=as-provided
nx g @nx/react:library storybook-host --directory=libs/storybook-host --bundler=none --unitTestRunner=none
```

Now, you have a new library, which will act as a shell/host for all your stories.
Expand Down
6 changes: 3 additions & 3 deletions docs/shared/recipes/storybook/one-storybook-per-scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ The commands below uses the `as-provided` directory flag behavior, which is the
{% /callout %}

```shell
nx g @nx/angular:lib storybook-host-client --directory=libs/storybook-host-client --projectNameAndRootFormat=as-provided
nx g @nx/angular:lib storybook-host-client --directory=libs/storybook-host-client
```

```shell
nx g @nx/angular:lib storybook-host-admin --directory=libs/storybook-host-admin --projectNameAndRootFormat=as-provided
nx g @nx/angular:lib storybook-host-admin --directory=libs/storybook-host-admin
```

```shell
nx g @nx/angular:lib storybook-host-shared --directory=libs/storybook-host-shared --projectNameAndRootFormat=as-provided
nx g @nx/angular:lib storybook-host-shared --directory=libs/storybook-host-shared
```

### Generate the Storybook configuration for the libraries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
So, let’s use React for the Storybook Composition host library:

```shell
nx g @nx/react:lib storybook-host --directory=libs/storybook-host --bundler=none --unitTestRunner=none --projectNameAndRootFormat=as-provided
nx g @nx/react:lib storybook-host --directory=libs/storybook-host --bundler=none --unitTestRunner=none
```

Now that your library is generated, you can write your intro in the generated component (you can also do this later, it does not matter).
Expand Down
12 changes: 4 additions & 8 deletions e2e/angular/src/module-federation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,10 @@ test('renders remotes', async ({ page }) => {
const hostPort = 4200;

runCLI(
`generate @nx/angular:host ${host} --remotes=${remote} --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided`
`generate @nx/angular:host ${host} --remotes=${remote} --e2eTestRunner=cypress --no-interactive`
);

runCLI(
`generate @nx/js:lib ${lib} --no-interactive --projectNameAndRootFormat=as-provided`
);
runCLI(`generate @nx/js:lib ${lib} --no-interactive`);

// Federate Module
runCLI(
Expand Down Expand Up @@ -357,12 +355,10 @@ test('renders remotes', async ({ page }) => {
const hostPort = 4200;

runCLI(
`generate @nx/angular:host ${host} --remotes=${remote} --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided`
`generate @nx/angular:host ${host} --remotes=${remote} --e2eTestRunner=cypress --no-interactive`
);

runCLI(
`generate @nx/js:lib ${lib} --no-interactive --projectNameAndRootFormat=as-provided`
);
runCLI(`generate @nx/js:lib ${lib} --no-interactive`);

// Federate Module
runCLI(
Expand Down
1 change: 0 additions & 1 deletion e2e/angular/src/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ describe('Angular Crystal Plugin', () => {
beforeAll(() => {
proj = newProject({
packages: ['@nx/angular'],
unsetProjectNameAndRootFormat: false,
});

if (getSelectedPackageManager() === 'pnpm') {
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/src/cypress.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default defineConfig({
async () => {
const appName = uniq('next-cy-app');
runCLI(
`generate @nx/next:app ${appName} --directory=apps/${appName} --e2eTestRunner=none --no-interactive --projectNameAndRootFormat=as-provided`
`generate @nx/next:app ${appName} --directory=apps/${appName} --e2eTestRunner=none --no-interactive `
);
runCLI(
`generate @nx/next:component btn --project=${appName} --directory=apps/${appName}/components --nameAndDirectoryFormat=as-provided --no-interactive`
Expand Down
18 changes: 6 additions & 12 deletions e2e/eslint/src/linter-legacy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,12 @@ describe('Linter (legacy)', () => {
bundler: 'vite',
e2eTestRunner: 'none',
});
runCLI(
`generate @nx/js:lib ${mylib} --directory libs/${mylib} --projectNameAndRootFormat as-provided`,
{
env: { NX_ADD_PLUGINS: 'false' },
}
);
runCLI(
`generate @nx/js:lib ${mylib2} --directory libs/${mylib2} --projectNameAndRootFormat as-provided`,
{
env: { NX_ADD_PLUGINS: 'false' },
}
);
runCLI(`generate @nx/js:lib ${mylib} --directory libs/${mylib}`, {
env: { NX_ADD_PLUGINS: 'false' },
});
runCLI(`generate @nx/js:lib ${mylib2} --directory libs/${mylib2}`, {
env: { NX_ADD_PLUGINS: 'false' },
});

// migrate to flat structure
runCLI(`generate @nx/eslint:convert-to-flat-config`, {
Expand Down
8 changes: 2 additions & 6 deletions e2e/eslint/src/linter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,12 +602,8 @@ describe('Linter', () => {
const reactLib = uniq('react-lib');
const jsLib = uniq('js-lib');

runCLI(
`generate @nx/react:lib ${reactLib} --directory=${reactLib} --projectNameAndRootFormat=as-provided`
);
runCLI(
`generate @nx/js:lib ${jsLib} --directory=${jsLib} --projectNameAndRootFormat=as-provided`
);
runCLI(`generate @nx/react:lib ${reactLib} --directory=${reactLib}`);
runCLI(`generate @nx/js:lib ${jsLib} --directory=${jsLib}`);

checkFilesExist(
`${reactLib}/eslint.config.js`,
Expand Down
1 change: 0 additions & 1 deletion e2e/gradle/src/gradle-import.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ describe('Nx Import Gradle', () => {
beforeAll(() => {
proj = newProject({
packages: ['@nx/js'],
unsetProjectNameAndRootFormat: false,
});

if (getSelectedPackageManager() === 'pnpm') {
Expand Down
16 changes: 4 additions & 12 deletions e2e/jest/src/jest-root.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ describe('Jest root projects', () => {
beforeAll(() => {
newProject({
packages: ['@nx/angular'],
unsetProjectNameAndRootFormat: false,
});
runCLI(
`generate @nx/angular:app ${myapp} --directory . --rootProject --projectNameAndRootFormat as-provided --no-interactive`
`generate @nx/angular:app ${myapp} --directory . --rootProject --no-interactive`
);
});

Expand All @@ -20,9 +19,7 @@ describe('Jest root projects', () => {
}, 300_000);

it('should add lib project and tests should still work', async () => {
runCLI(
`generate @nx/angular:lib ${mylib} --projectNameAndRootFormat as-provided --no-interactive`
);
runCLI(`generate @nx/angular:lib ${mylib} --no-interactive`);

expect(() => runCLI(`test ${mylib}`)).not.toThrow();
expect(() => runCLI(`test ${myapp}`)).not.toThrow();
Expand All @@ -33,21 +30,16 @@ describe('Jest root projects', () => {
beforeAll(() => {
newProject({
packages: ['@nx/react'],
unsetProjectNameAndRootFormat: false,
});
runCLI(
`generate @nx/react:app ${myapp} --directory . --rootProject --projectNameAndRootFormat as-provided`
);
runCLI(`generate @nx/react:app ${myapp} --directory . --rootProject`);
});

it('should test root level app projects', async () => {
expect(() => runCLI(`test ${myapp}`)).not.toThrow();
}, 300_000);

it('should add lib project and tests should still work', async () => {
runCLI(
`generate @nx/react:lib ${mylib} --unitTestRunner=jest --projectNameAndRootFormat as-provided`
);
runCLI(`generate @nx/react:lib ${mylib} --unitTestRunner=jest`);

expect(() => runCLI(`test ${mylib}`)).not.toThrow();
expect(() => runCLI(`test ${myapp}`)).not.toThrow();
Expand Down
6 changes: 2 additions & 4 deletions e2e/next/src/next-component-tests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function addBabelSupport(path: string) {

function createAppWithCt(appName: string) {
runCLI(
`generate @nx/next:app ${appName} --directory=apps/${appName} --no-interactive --appDir=false --src=false --projectNameAndRootFormat=as-provided`
`generate @nx/next:app ${appName} --directory=apps/${appName} --no-interactive --appDir=false --src=false`
);
runCLI(
`generate @nx/next:component button --project=${appName} --directory=apps/${appName}/components --nameAndDirectoryFormat=as-provided --no-interactive`
Expand Down Expand Up @@ -213,9 +213,7 @@ export default Button;
}

function createLibWithCtCypress(libName: string) {
runCLI(
`generate @nx/next:lib ${libName} --no-interactive --projectNameAndRootFormat=as-provided`
);
runCLI(`generate @nx/next:lib ${libName} --no-interactive`);

runCLI(
`generate @nx/next:cypress-component-configuration --project=${libName} --no-interactive`
Expand Down
4 changes: 2 additions & 2 deletions e2e/next/src/next-playwright.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Next Playwright e2e tests', () => {
packages: ['@nx/next'],
});
runCLI(
`generate @nx/next:app ${appName} --e2eTestRunner=playwright --projectNameAndRootFormat=as-provided --no-interactive`
`generate @nx/next:app ${appName} --e2eTestRunner=playwright --no-interactive`
);
});

Expand All @@ -35,7 +35,7 @@ describe('Next Playwright e2e tests', () => {

it('should execute e2e tests using playwright with a library used in the app', () => {
runCLI(
`generate @nx/js:library ${usedInAppLibName} --unitTestRunner=none --importPath=@mylib --projectNameAndRootFormat=as-provided --no-interactive`
`generate @nx/js:library ${usedInAppLibName} --unitTestRunner=none --importPath=@mylib --no-interactive`
);

updateFile(
Expand Down
3 changes: 1 addition & 2 deletions e2e/nuxt/src/nuxt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ describe('Nuxt Plugin', () => {
beforeAll(() => {
newProject({
packages: ['@nx/nuxt'],
unsetProjectNameAndRootFormat: false,
});
runCLI(
`generate @nx/nuxt:app ${app} --unitTestRunner=vitest --projectNameAndRootFormat=as-provided --e2eTestRunner=cypress`
`generate @nx/nuxt:app ${app} --unitTestRunner=vitest --e2eTestRunner=cypress`
);
runCLI(
`generate @nx/nuxt:component --directory=${app}/src/components/one --name=one --nameAndDirectoryFormat=as-provided --unitTestRunner=vitest`
Expand Down
1 change: 0 additions & 1 deletion e2e/nx/src/import.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ describe('Nx Import', () => {
beforeAll(() => {
proj = newProject({
packages: ['@nx/js'],
unsetProjectNameAndRootFormat: false,
});

if (getSelectedPackageManager() === 'pnpm') {
Expand Down
1 change: 0 additions & 1 deletion e2e/nx/src/nx-cloud.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { cleanupProject, newProject, runCLI } from '@nx/e2e/utils';
describe('Nx Cloud', () => {
beforeAll(() =>
newProject({
unsetProjectNameAndRootFormat: false,
packages: ['@nx/js'],
})
);
Expand Down
5 changes: 2 additions & 3 deletions e2e/playwright/src/playwright.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ describe('Playwright E2E Test Runner - legacy', () => {
env = process.env.NX_ADD_PLUGINS;
newProject({
name: uniq('playwright'),
unsetProjectNameAndRootFormat: false,
});
process.env.NX_ADD_PLUGINS = 'false';
});
Expand All @@ -98,7 +97,7 @@ describe('Playwright E2E Test Runner - legacy', () => {
const pmc = getPackageManagerCommand();

runCLI(
`g @nx/web:app demo-e2e --directory apps/demo-e2e --unitTestRunner=none --bundler=vite --e2eTestRunner=none --style=css --no-interactive --projectNameAndRootFormat=as-provided`
`g @nx/web:app demo-e2e --directory apps/demo-e2e --unitTestRunner=none --bundler=vite --e2eTestRunner=none --style=css --no-interactive`
);
runCLI(
`g @nx/playwright:configuration --project demo-e2e --webServerCommand="${pmc.runNx} serve demo-e2e" --webServerAddress="http://localhost:4200"`
Expand All @@ -121,7 +120,7 @@ describe('Playwright E2E Test Runner - legacy', () => {
const pmc = getPackageManagerCommand();

runCLI(
`g @nx/web:app demo-js-e2e --directory apps/demo-js-e2e --unitTestRunner=none --bundler=vite --e2eTestRunner=none --style=css --no-interactive --projectNameAndRootFormat=as-provided`
`g @nx/web:app demo-js-e2e --directory apps/demo-js-e2e --unitTestRunner=none --bundler=vite --e2eTestRunner=none --style=css --no-interactive`
);
runCLI(
`g @nx/playwright:configuration --project demo-js-e2e --js --webServerCommand="${pmc.runNx} serve demo-e2e" --webServerAddress="http://localhost:4200"`
Expand Down
4 changes: 2 additions & 2 deletions e2e/react/src/playwright.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('React Playwright e2e tests', () => {
packages: ['@nx/react'],
});
runCLI(
`generate @nx/react:app ${appName} --e2eTestRunner=playwright --bundler=vite --projectNameAndRootFormat=as-provided --no-interactive`
`generate @nx/react:app ${appName} --e2eTestRunner=playwright --bundler=vite --no-interactive`
);
});

Expand All @@ -35,7 +35,7 @@ describe('React Playwright e2e tests', () => {

it('should execute e2e tests using playwright with a library used in the app', () => {
runCLI(
`generate @nx/js:library ${usedInAppLibName} --unitTestRunner=none --importPath=@mylib --projectNameAndRootFormat=as-provided --no-interactive`
`generate @nx/js:library ${usedInAppLibName} --unitTestRunner=none --importPath=@mylib --no-interactive`
);

updateFile(
Expand Down
18 changes: 7 additions & 11 deletions e2e/react/src/react-module-federation.rspack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,10 @@ describe('React Rspack Module Federation', () => {
const host = uniq('host');

runCLI(
`generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
`generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --skipFormat`
);

runCLI(
`generate @nx/js:lib ${lib} --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
);
runCLI(`generate @nx/js:lib ${lib} --no-interactive --skipFormat`);

// Federate Module
runCLI(
Expand Down Expand Up @@ -595,12 +593,10 @@ describe('React Rspack Module Federation', () => {
const host = uniq('host');

runCLI(
`generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
`generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --skipFormat`
);

runCLI(
`generate @nx/js:lib ${lib} --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
);
runCLI(`generate @nx/js:lib ${lib} --no-interactive --skipFormat`);

// Federate Module
runCLI(
Expand Down Expand Up @@ -703,7 +699,7 @@ describe('React Rspack Module Federation', () => {
const host = uniq('host');

runCLI(
`generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --typescriptConfiguration=false --skipFormat`
`generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --typescriptConfiguration=false --skipFormat`
);

// Update remote to be loaded via script
Expand Down Expand Up @@ -837,11 +833,11 @@ describe('React Rspack Module Federation', () => {
const lib = uniq('lib');

runCLI(
`generate @nx/react:host ${shell} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
`generate @nx/react:host ${shell} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --skipFormat`
);

runCLI(
`generate @nx/js:lib ${lib} --importPath=@acme/${lib} --publishable=true --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
`generate @nx/js:lib ${lib} --importPath=@acme/${lib} --publishable=true --no-interactive --skipFormat`
);

const shellPort = readPort(shell);
Expand Down
Loading

0 comments on commit 271935e

Please sign in to comment.