Skip to content

Commit

Permalink
feat(core): import warns when source and destination directories are …
Browse files Browse the repository at this point in the history
…different
  • Loading branch information
jaysoo committed Sep 11, 2024
1 parent 2a3307c commit 89746ad
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/nx/src/command-line/import/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ export async function importHandler(options: ImportOptions) {
packageManager
);

const sourceIsNxWorkspace = existsSync(join(sourceGitClient.root, 'nx.json'));

const relativeDestination = relative(
destinationGitClient.root,
absDestination
Expand Down Expand Up @@ -310,6 +312,19 @@ export async function importHandler(options: ImportOptions) {

await warnOnMissingWorkspacesEntry(packageManager, pmc, relativeDestination);

if (source != destination) {
output.warn({
title: `Check configuration files`,
bodyLines: [
`The source directory (${source}) and destination directory (${destination}) are different.`,
`You may need to update configuration files to match the directory in this repository.`,
sourceIsNxWorkspace
? `For example, path options in project.json such as "main", "tsConfig", "outputPath" need to be updated.`
: `For example, relative paths in tsconfig.json and other tooling config files may need to be updated.`,
],
});
}

// When only a subdirectory is imported, there might be devDependencies in the root package.json file
// that needs to be ported over as well.
if (ref) {
Expand Down

0 comments on commit 89746ad

Please sign in to comment.