fix(nextjs): hide lockfile generation behind a flag so it can be toggled on and off (#14204)
This commit is contained in:
parent
e8b2731a47
commit
d3ba6447d0
@ -53,6 +53,11 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Include `devDependencies` in the generated package.json file. By default only production `dependencies` are included.",
|
"description": "Include `devDependencies` in the generated package.json file. By default only production `dependencies` are included.",
|
||||||
"default": false
|
"default": false
|
||||||
|
},
|
||||||
|
"generateLockfile": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Generate a lockfile (e.g. yarn.lock) that matches the workspace lockfile to ensure package versions match.",
|
||||||
|
"default": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["root", "outputPath"],
|
"required": ["root", "outputPath"],
|
||||||
|
|||||||
@ -12,9 +12,9 @@ import {
|
|||||||
updateFile,
|
updateFile,
|
||||||
updateProjectConfig,
|
updateProjectConfig,
|
||||||
} from '@nrwl/e2e/utils';
|
} from '@nrwl/e2e/utils';
|
||||||
import { checkApp } from './utils';
|
|
||||||
import { stringUtils } from '@nrwl/workspace';
|
import { stringUtils } from '@nrwl/workspace';
|
||||||
import * as http from 'http';
|
import * as http from 'http';
|
||||||
|
import { checkApp } from './utils';
|
||||||
|
|
||||||
describe('Next.js Applications', () => {
|
describe('Next.js Applications', () => {
|
||||||
let proj: string;
|
let proj: string;
|
||||||
|
|||||||
@ -1,14 +1,11 @@
|
|||||||
import {
|
import {
|
||||||
checkFilesExist,
|
checkFilesExist,
|
||||||
detectPackageManager,
|
|
||||||
killPorts,
|
killPorts,
|
||||||
readJson,
|
readJson,
|
||||||
runCLI,
|
runCLI,
|
||||||
runCLIAsync,
|
runCLIAsync,
|
||||||
runCypressTests,
|
runCypressTests,
|
||||||
tmpProjPath,
|
|
||||||
} from '../../utils';
|
} from '../../utils';
|
||||||
import { getLockFileName } from '../../../packages/nx/src/lock-file/lock-file';
|
|
||||||
|
|
||||||
export async function checkApp(
|
export async function checkApp(
|
||||||
appName: string,
|
appName: string,
|
||||||
@ -28,12 +25,6 @@ export async function checkApp(
|
|||||||
expect(packageJson.dependencies['react-dom']).toBeDefined();
|
expect(packageJson.dependencies['react-dom']).toBeDefined();
|
||||||
expect(packageJson.dependencies.next).toBeDefined();
|
expect(packageJson.dependencies.next).toBeDefined();
|
||||||
|
|
||||||
checkFilesExist(
|
|
||||||
`dist/apps/${appName}/${getLockFileName(
|
|
||||||
detectPackageManager(tmpProjPath())
|
|
||||||
)}`
|
|
||||||
);
|
|
||||||
|
|
||||||
if (opts.checkLint) {
|
if (opts.checkLint) {
|
||||||
const lintResults = runCLI(`lint ${appName}`);
|
const lintResults = runCLI(`lint ${appName}`);
|
||||||
expect(lintResults).toContain('All files pass linting.');
|
expect(lintResults).toContain('All files pass linting.');
|
||||||
|
|||||||
@ -90,11 +90,14 @@ export default async function buildExecutor(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
updatePackageJson(builtPackageJson, context);
|
updatePackageJson(builtPackageJson, context);
|
||||||
const lockFile = createLockFile(builtPackageJson);
|
|
||||||
writeJsonFile(`${options.outputPath}/package.json`, builtPackageJson);
|
writeJsonFile(`${options.outputPath}/package.json`, builtPackageJson);
|
||||||
writeFileSync(`${options.outputPath}/${getLockFileName()}`, lockFile, {
|
|
||||||
encoding: 'utf-8',
|
if (options.generateLockfile) {
|
||||||
});
|
const lockFile = createLockFile(builtPackageJson);
|
||||||
|
writeFileSync(`${options.outputPath}/${getLockFileName()}`, lockFile, {
|
||||||
|
encoding: 'utf-8',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
createNextConfigFile(options, context);
|
createNextConfigFile(options, context);
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,11 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Include `devDependencies` in the generated package.json file. By default only production `dependencies` are included.",
|
"description": "Include `devDependencies` in the generated package.json file. By default only production `dependencies` are included.",
|
||||||
"default": false
|
"default": false
|
||||||
|
},
|
||||||
|
"generateLockfile": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Generate a lockfile (e.g. yarn.lock) that matches the workspace lockfile to ensure package versions match.",
|
||||||
|
"default": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["root", "outputPath"]
|
"required": ["root", "outputPath"]
|
||||||
|
|||||||
@ -37,6 +37,7 @@ export interface NextBuildBuilderOptions {
|
|||||||
nextConfig?: string;
|
nextConfig?: string;
|
||||||
buildLibsFromSource?: boolean;
|
buildLibsFromSource?: boolean;
|
||||||
includeDevDependenciesInPackageJson?: boolean;
|
includeDevDependenciesInPackageJson?: boolean;
|
||||||
|
generateLockfile?: boolean;
|
||||||
watch?: boolean;
|
watch?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user