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",
|
||||
"description": "Include `devDependencies` in the generated package.json file. By default only production `dependencies` are included.",
|
||||
"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"],
|
||||
|
||||
@ -12,9 +12,9 @@ import {
|
||||
updateFile,
|
||||
updateProjectConfig,
|
||||
} from '@nrwl/e2e/utils';
|
||||
import { checkApp } from './utils';
|
||||
import { stringUtils } from '@nrwl/workspace';
|
||||
import * as http from 'http';
|
||||
import { checkApp } from './utils';
|
||||
|
||||
describe('Next.js Applications', () => {
|
||||
let proj: string;
|
||||
|
||||
@ -1,14 +1,11 @@
|
||||
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,
|
||||
@ -28,12 +25,6 @@ export async function checkApp(
|
||||
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.');
|
||||
|
||||
@ -90,11 +90,14 @@ export default async function buildExecutor(
|
||||
}
|
||||
);
|
||||
updatePackageJson(builtPackageJson, context);
|
||||
const lockFile = createLockFile(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);
|
||||
|
||||
|
||||
@ -53,6 +53,11 @@
|
||||
"type": "boolean",
|
||||
"description": "Include `devDependencies` in the generated package.json file. By default only production `dependencies` are included.",
|
||||
"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"]
|
||||
|
||||
@ -37,6 +37,7 @@ export interface NextBuildBuilderOptions {
|
||||
nextConfig?: string;
|
||||
buildLibsFromSource?: boolean;
|
||||
includeDevDependenciesInPackageJson?: boolean;
|
||||
generateLockfile?: boolean;
|
||||
watch?: boolean;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user