Skip to content

Commit

Permalink
chore(repo): update nx to 15.4.0-beta.3 (#13904)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz committed Dec 20, 2022
1 parent 2614669 commit 5e5892f
Show file tree
Hide file tree
Showing 5 changed files with 277 additions and 277 deletions.
82 changes: 82 additions & 0 deletions e2e/next/src/next-styles.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import {
cleanupProject,
getSelectedPackageManager,
newProject,
runCLI,
uniq,
} from '@nrwl/e2e/utils';
import { checkApp } from './utils';

xdescribe('Next.js apps', () => {
let originalEnv: string;

beforeAll(() => {
// TODO(jack): figure out why this does not work with pnpm
const selectedPM = getSelectedPackageManager();
newProject({
packageManager: selectedPM === 'pnpm' ? 'yarn' : selectedPM,
});
});

afterAll(() => cleanupProject());

beforeEach(() => {
originalEnv = process.env.NODE_ENV;
});

afterEach(() => {
process.env.NODE_ENV = originalEnv;
});

it('should support different --style options', async () => {
const lessApp = uniq('app');

runCLI(`generate @nrwl/next:app ${lessApp} --no-interactive --style=less`);

await checkApp(lessApp, {
checkUnitTest: false,
checkLint: false,
checkE2E: false,
checkExport: false,
});

const stylusApp = uniq('app');

runCLI(
`generate @nrwl/next:app ${stylusApp} --no-interactive --style=styl`
);

await checkApp(stylusApp, {
checkUnitTest: false,
checkLint: false,
checkE2E: false,
checkExport: false,
});

const scApp = uniq('app');

runCLI(
`generate @nrwl/next:app ${scApp} --no-interactive --style=styled-components`
);

await checkApp(scApp, {
checkUnitTest: true,
checkLint: false,
checkE2E: false,
checkExport: false,
});

const emotionApp = uniq('app');

runCLI(
`generate @nrwl/next:app ${emotionApp} --no-interactive --style=@emotion/styled`
);

await checkApp(emotionApp, {
checkUnitTest: true,
checkLint: false,
checkE2E: false,
checkExport: false,
});
}, 300_000);
});
107 changes: 1 addition & 106 deletions e2e/next/src/next.test.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
import {
checkFilesExist,
cleanupProject,
detectPackageManager,
isNotWindows,
killPorts,
newProject,
readFile,
readJson,
rmDist,
runCLI,
runCLIAsync,
runCommandUntil,
runCypressTests,
tmpProjPath,
uniq,
updateFile,
updateProjectConfig,
} from '@nrwl/e2e/utils';
import { checkApp } from './utils';
import { stringUtils } from '@nrwl/workspace';
import * as http from 'http';
import { getLockFileName } from 'nx/src/lock-file/lock-file';

describe('Next.js Applications', () => {
let proj: string;
Expand Down Expand Up @@ -363,58 +358,6 @@ describe('Next.js Applications', () => {
checkExport: false,
});
}, 300_000);

it('should support different --style options', async () => {
const lessApp = uniq('app');

runCLI(`generate @nrwl/next:app ${lessApp} --no-interactive --style=less`);

await checkApp(lessApp, {
checkUnitTest: false,
checkLint: false,
checkE2E: false,
checkExport: false,
});

const stylusApp = uniq('app');

runCLI(
`generate @nrwl/next:app ${stylusApp} --no-interactive --style=styl`
);

await checkApp(stylusApp, {
checkUnitTest: false,
checkLint: false,
checkE2E: false,
checkExport: false,
});

const scApp = uniq('app');

runCLI(
`generate @nrwl/next:app ${scApp} --no-interactive --style=styled-components`
);

await checkApp(scApp, {
checkUnitTest: true,
checkLint: false,
checkE2E: false,
checkExport: false,
});

const emotionApp = uniq('app');

runCLI(
`generate @nrwl/next:app ${emotionApp} --no-interactive --style=@emotion/styled`
);

await checkApp(emotionApp, {
checkUnitTest: true,
checkLint: false,
checkE2E: false,
checkExport: false,
});
}, 300_000);
});

function getData(port: number, path = ''): Promise<any> {
Expand All @@ -431,51 +374,3 @@ function getData(port: number, path = ''): Promise<any> {
});
});
}

async function checkApp(
appName: string,
opts: {
checkUnitTest: boolean;
checkLint: boolean;
checkE2E: boolean;
checkExport: boolean;
}
) {
const buildResult = runCLI(`build ${appName}`);
expect(buildResult).toContain(`Compiled successfully`);
checkFilesExist(`dist/apps/${appName}/.next/build-manifest.json`);

const packageJson = readJson(`dist/apps/${appName}/package.json`);
expect(packageJson.dependencies.react).toBeDefined();
expect(packageJson.dependencies['react-dom']).toBeDefined();
expect(packageJson.dependencies.next).toBeDefined();

checkFilesExist(
`dist/apps/${appName}/${getLockFileName(
detectPackageManager(tmpProjPath())
)}`
);

if (opts.checkLint) {
const lintResults = runCLI(`lint ${appName}`);
expect(lintResults).toContain('All files pass linting.');
}

if (opts.checkUnitTest) {
const testResults = await runCLIAsync(`test ${appName}`);
expect(testResults.combinedOutput).toContain(
'Test Suites: 1 passed, 1 total'
);
}

if (opts.checkE2E && runCypressTests()) {
const e2eResults = runCLI(`e2e ${appName}-e2e --no-watch`);
expect(e2eResults).toContain('All specs passed!');
expect(await killPorts()).toBeTruthy();
}

if (opts.checkExport) {
runCLI(`export ${appName}`);
checkFilesExist(`dist/apps/${appName}/exported/index.html`);
}
}
59 changes: 59 additions & 0 deletions e2e/next/src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import {
checkFilesExist,
detectPackageManager,
killPorts,
readJson,
runCLI,
runCLIAsync,
runCypressTests,
tmpProjPath,
} from '../../utils';
import { getLockFileName } from '../../../packages/nx/src/lock-file/lock-file';

export async function checkApp(
appName: string,
opts: {
checkUnitTest: boolean;
checkLint: boolean;
checkE2E: boolean;
checkExport: boolean;
}
) {
const buildResult = runCLI(`build ${appName}`);
expect(buildResult).toContain(`Compiled successfully`);
checkFilesExist(`dist/apps/${appName}/.next/build-manifest.json`);

const packageJson = readJson(`dist/apps/${appName}/package.json`);
expect(packageJson.dependencies.react).toBeDefined();
expect(packageJson.dependencies['react-dom']).toBeDefined();
expect(packageJson.dependencies.next).toBeDefined();

checkFilesExist(
`dist/apps/${appName}/${getLockFileName(
detectPackageManager(tmpProjPath())
)}`
);

if (opts.checkLint) {
const lintResults = runCLI(`lint ${appName}`);
expect(lintResults).toContain('All files pass linting.');
}

if (opts.checkUnitTest) {
const testResults = await runCLIAsync(`test ${appName}`);
expect(testResults.combinedOutput).toContain(
'Test Suites: 1 passed, 1 total'
);
}

if (opts.checkE2E && runCypressTests()) {
const e2eResults = runCLI(`e2e ${appName}-e2e --no-watch`);
expect(e2eResults).toContain('All specs passed!');
expect(await killPorts()).toBeTruthy();
}

if (opts.checkExport) {
runCLI(`export ${appName}`);
checkFilesExist(`dist/apps/${appName}/exported/index.html`);
}
}
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@
"@ngrx/router-store": "~15.0.0",
"@ngrx/store": "~15.0.0",
"@nguniversal/builders": "~15.0.0",
"@nrwl/cypress": "15.3.0",
"@nrwl/devkit": "15.3.0",
"@nrwl/eslint-plugin-nx": "15.3.0",
"@nrwl/jest": "15.3.0",
"@nrwl/js": "15.3.0",
"@nrwl/linter": "15.3.0",
"@nrwl/next": "15.3.0",
"@nrwl/cypress": "15.4.0-beta.3",
"@nrwl/devkit": "15.4.0-beta.3",
"@nrwl/eslint-plugin-nx": "15.4.0-beta.3",
"@nrwl/jest": "15.4.0-beta.3",
"@nrwl/js": "15.4.0-beta.3",
"@nrwl/linter": "15.4.0-beta.3",
"@nrwl/next": "15.4.0-beta.3",
"@nrwl/nx-cloud": "15.0.2",
"@nrwl/react": "15.3.0",
"@nrwl/storybook": "15.3.0",
"@nrwl/web": "15.3.0",
"@nrwl/react": "15.4.0-beta.3",
"@nrwl/storybook": "15.4.0-beta.3",
"@nrwl/web": "15.4.0-beta.3",
"@parcel/watcher": "2.0.4",
"@phenomnomnominal/tsquery": "4.1.1",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
Expand Down Expand Up @@ -190,7 +190,7 @@
"next-sitemap": "^3.1.10",
"ng-packagr": "~15.0.0",
"node-fetch": "^2.6.7",
"nx": "15.3.0",
"nx": "15.4.0-beta.3",
"open": "^8.4.0",
"parse-markdown-links": "^1.0.4",
"parse5": "4.0.0",
Expand Down Expand Up @@ -325,3 +325,4 @@
]
}
}

Loading

1 comment on commit 5e5892f

@vercel
Copy link

@vercel vercel bot commented on 5e5892f Dec 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx.dev

Please sign in to comment.