Skip to content

Commit

Permalink
feat(core): include PR review notes
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav committed Apr 4, 2023
1 parent 7fc2e8a commit ff14335
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 137 deletions.
9 changes: 4 additions & 5 deletions docs/generated/devkit/nrwl_devkit.md
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ Returns the list of outputs that will be cached.

### getPackageManagerCommand

**getPackageManagerCommand**(`packageManager?`, `root?`): `PackageManagerCommands`
**getPackageManagerCommand**(`packageManager?`): `PackageManagerCommands`

Returns commands for the package manager used in the workspace.
By default, the package manager is derived based on the lock file,
Expand All @@ -1447,10 +1447,9 @@ execSync(`${getPackageManagerCommand().addDev} my-dev-package`);

#### Parameters

| Name | Type | Default value |
| :--------------- | :-------------------------------------------------------------------- | :-------------- |
| `packageManager` | [`PackageManager`](../../devkit/documents/nrwl_devkit#packagemanager) | `undefined` |
| `root` | `string` | `workspaceRoot` |
| Name | Type |
| :--------------- | :-------------------------------------------------------------------- |
| `packageManager` | [`PackageManager`](../../devkit/documents/nrwl_devkit#packagemanager) |

#### Returns

Expand Down
9 changes: 4 additions & 5 deletions docs/generated/packages/devkit/documents/nrwl_devkit.md
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ Returns the list of outputs that will be cached.

### getPackageManagerCommand

**getPackageManagerCommand**(`packageManager?`, `root?`): `PackageManagerCommands`
**getPackageManagerCommand**(`packageManager?`): `PackageManagerCommands`

Returns commands for the package manager used in the workspace.
By default, the package manager is derived based on the lock file,
Expand All @@ -1447,10 +1447,9 @@ execSync(`${getPackageManagerCommand().addDev} my-dev-package`);

#### Parameters

| Name | Type | Default value |
| :--------------- | :-------------------------------------------------------------------- | :-------------- |
| `packageManager` | [`PackageManager`](../../devkit/documents/nrwl_devkit#packagemanager) | `undefined` |
| `root` | `string` | `workspaceRoot` |
| Name | Type |
| :--------------- | :-------------------------------------------------------------------- |
| `packageManager` | [`PackageManager`](../../devkit/documents/nrwl_devkit#packagemanager) |

#### Returns

Expand Down
1 change: 0 additions & 1 deletion e2e/storybook/src/storybook-nested.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('Storybook generators and executors for standalone workspaces - using R

beforeAll(() => {
// create a workspace with a single react app at the root
// TODO @meeroslav: we always need to pass in `packageManager` here, otherwise `runCreateWorkspace` will use `npm` by default
runCreateWorkspace(wsName, {
preset: 'react-standalone',
appName,
Expand Down
80 changes: 25 additions & 55 deletions e2e/workspace-create-npm/src/create-nx-workspace-npm.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {
checkFilesExist,
cleanupProject,
e2eCwd,
getPackageManagerCommand,
getSelectedPackageManager,
packageInstall,
readJson,
Expand All @@ -11,31 +9,31 @@ import {
runCreateWorkspace,
uniq,
} from '@nrwl/e2e/utils';
import { execSync } from 'child_process';

describe('create-nx-workspace --preset=npm', () => {
const wsName = uniq('npm');

let originalVerbose;
let orginalGlobCache;

beforeAll(() => {
originalVerbose = process.env.NX_VERBOSE_LOGGING;
process.env.NX_VERBOSE_LOGGING = 'true';
orginalGlobCache = process.env.NX_PROJECT_GLOB_CACHE;
// glob cache is causing previous projects to show in Workspace for maxWorkers overrides
// which fails due to files no longer being available
process.env.NX_PROJECT_GLOB_CACHE = 'false';

runCreateWorkspace(wsName, {
preset: 'npm',
packageManager: getSelectedPackageManager(),
});
});

afterEach(() => {
runCommand(`git reset --hard HEAD`);
execSync(`${getPackageManagerCommand().runNx} reset`, {
cwd: `${e2eCwd}/${wsName}`,
stdio: 'pipe',
});
// cleanup previous projects
runCommand(`rm -rf packages/** tsconfig.base.json`);
});

afterAll(() => {
process.env.NX_VERBOSE_LOGGING = originalVerbose;
process.env.NX_PROJECT_GLOB_CACHE = orginalGlobCache;
cleanupProject({ skipReset: true });
});

Expand All @@ -44,9 +42,7 @@ describe('create-nx-workspace --preset=npm', () => {
const appName = uniq('my-app');

expect(() => {
runCLI(
`generate @nrwl/angular:app ${appName} --skipPackageJson --no-interactive`
);
runCLI(`generate @nrwl/angular:app ${appName} --no-interactive`);
}).not.toThrowError();
checkFilesExist('tsconfig.base.json');
}, 1_000_000);
Expand All @@ -56,9 +52,7 @@ describe('create-nx-workspace --preset=npm', () => {
const libName = uniq('lib');

expect(() => {
runCLI(
`generate @nrwl/angular:lib ${libName} --skipPackageJson --no-interactive`
);
runCLI(`generate @nrwl/angular:lib ${libName} --no-interactive`);
}).not.toThrowError();
checkFilesExist('tsconfig.base.json');
const tsconfig = readJson(`tsconfig.base.json`);
Expand All @@ -73,9 +67,7 @@ describe('create-nx-workspace --preset=npm', () => {
const libName = uniq('lib');

expect(() =>
runCLI(
`generate @nrwl/js:library ${libName} --skipPackageJson --no-interactive`
)
runCLI(`generate @nrwl/js:library ${libName} --no-interactive`)
).not.toThrowError();
checkFilesExist('tsconfig.base.json');
const tsconfig = readJson(`tsconfig.base.json`);
Expand All @@ -90,9 +82,7 @@ describe('create-nx-workspace --preset=npm', () => {
const appName = uniq('my-app');

expect(() =>
runCLI(
`generate @nrwl/web:app ${appName} --skipPackageJson --no-interactive`
)
runCLI(`generate @nrwl/web:app ${appName} --no-interactive`)
).not.toThrowError();
checkFilesExist('tsconfig.base.json');
});
Expand All @@ -103,9 +93,7 @@ describe('create-nx-workspace --preset=npm', () => {
const appName = uniq('my-app');

expect(() => {
runCLI(
`generate @nrwl/react:app ${appName} --skipPackageJson --no-interactive`
);
runCLI(`generate @nrwl/react:app ${appName} --no-interactive`);
}).not.toThrowError();
checkFilesExist('tsconfig.base.json');
});
Expand All @@ -116,9 +104,7 @@ describe('create-nx-workspace --preset=npm', () => {
const libName = uniq('lib');

expect(() => {
runCLI(
`generate @nrwl/react:lib ${libName} --skipPackageJson --no-interactive`
);
runCLI(`generate @nrwl/react:lib ${libName} --no-interactive`);
}).not.toThrowError();
checkFilesExist('tsconfig.base.json');
const tsconfig = readJson(`tsconfig.base.json`);
Expand All @@ -133,9 +119,7 @@ describe('create-nx-workspace --preset=npm', () => {
const appName = uniq('my-app');

expect(() => {
runCLI(
`generate @nrwl/next:app ${appName} --skipPackageJson --no-interactive`
);
runCLI(`generate @nrwl/next:app ${appName} --no-interactive`);
}).not.toThrowError();
checkFilesExist('tsconfig.base.json');
});
Expand All @@ -146,9 +130,7 @@ describe('create-nx-workspace --preset=npm', () => {
const libName = uniq('lib');

expect(() => {
runCLI(
`generate @nrwl/next:lib ${libName} --skipPackageJson --no-interactive`
);
runCLI(`generate @nrwl/next:lib ${libName} --no-interactive`);
}).not.toThrowError();
checkFilesExist('tsconfig.base.json');
const tsconfig = readJson(`tsconfig.base.json`);
Expand All @@ -164,7 +146,7 @@ describe('create-nx-workspace --preset=npm', () => {

expect(() => {
runCLI(
`generate @nrwl/react-native:app ${appName} --install=false --skipPackageJson --no-interactive`
`generate @nrwl/react-native:app ${appName} --install=false --no-interactive`
);
}).not.toThrowError();
checkFilesExist('tsconfig.base.json');
Expand All @@ -176,9 +158,7 @@ describe('create-nx-workspace --preset=npm', () => {
const libName = uniq('lib');

expect(() => {
runCLI(
`generate @nrwl/react-native:lib ${libName} --skipPackageJson --no-interactive`
);
runCLI(`generate @nrwl/react-native:lib ${libName} --no-interactive`);
}).not.toThrowError();
checkFilesExist('tsconfig.base.json');
const tsconfig = readJson(`tsconfig.base.json`);
Expand All @@ -193,9 +173,7 @@ describe('create-nx-workspace --preset=npm', () => {
const appName = uniq('my-app');

expect(() => {
runCLI(
`generate @nrwl/node:app ${appName} --skipPackageJson --no-interactive`
);
runCLI(`generate @nrwl/node:app ${appName} --no-interactive`);
}).not.toThrowError();
checkFilesExist('tsconfig.base.json');
});
Expand All @@ -206,9 +184,7 @@ describe('create-nx-workspace --preset=npm', () => {
const libName = uniq('lib');

expect(() => {
runCLI(
`generate @nrwl/node:lib ${libName} --skipPackageJson --no-interactive`
);
runCLI(`generate @nrwl/node:lib ${libName} --no-interactive`);
}).not.toThrowError();
checkFilesExist('tsconfig.base.json');
const tsconfig = readJson(`tsconfig.base.json`);
Expand All @@ -223,9 +199,7 @@ describe('create-nx-workspace --preset=npm', () => {
const appName = uniq('my-app');

expect(() => {
runCLI(
`generate @nrwl/nest:app ${appName} --skipPackageJson --no-interactive`
);
runCLI(`generate @nrwl/nest:app ${appName} --no-interactive`);
}).not.toThrowError();
checkFilesExist('tsconfig.base.json');
});
Expand All @@ -236,9 +210,7 @@ describe('create-nx-workspace --preset=npm', () => {
const libName = uniq('lib');

expect(() => {
runCLI(
`generate @nrwl/nest:lib ${libName} --skipPackageJson --no-interactive`
);
runCLI(`generate @nrwl/nest:lib ${libName} --no-interactive`);
}).not.toThrowError();
checkFilesExist('tsconfig.base.json');
const tsconfig = readJson(`tsconfig.base.json`);
Expand All @@ -253,9 +225,7 @@ describe('create-nx-workspace --preset=npm', () => {
const appName = uniq('my-app');

expect(() => {
runCLI(
`generate @nrwl/express:app ${appName} --skipPackageJson --no-interactive`
);
runCLI(`generate @nrwl/express:app ${appName} --no-interactive`);
}).not.toThrowError();
checkFilesExist('tsconfig.base.json');
});
Expand Down
Loading

0 comments on commit ff14335

Please sign in to comment.