Skip to content

Commit

Permalink
fix(core): fix slashes in inputs migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz committed Oct 6, 2022
1 parent 8dd1fbf commit 5eeb732
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 13 deletions.
@@ -1,11 +1,11 @@
import {
formatFiles,
joinPathFragments,
readWorkspaceConfiguration,
Tree,
updateWorkspaceConfiguration,
} from '@nrwl/devkit';
import { forEachExecutorOptions } from '@nrwl/workspace/src/utilities/executor-options-utils';
import { join } from 'path';

export default async function (tree: Tree) {
const workspaceConfiguration = readWorkspaceConfiguration(tree);
Expand All @@ -31,7 +31,9 @@ export default async function (tree: Tree) {

lintTargetDefaults.inputs ??= [
'default',
...(globalEslintFile ? [join('{workspaceRoot}', globalEslintFile)] : []),
...(globalEslintFile
? [joinPathFragments('{workspaceRoot}', globalEslintFile)]
: []),
];
}

Expand Down
8 changes: 5 additions & 3 deletions packages/nx/src/migrations/update-15-0-0/migrate-to-inputs.ts
Expand Up @@ -6,7 +6,7 @@ import {
updateProjectConfiguration,
updateWorkspaceConfiguration,
} from '../../generators/utils/project-configuration';
import { join } from 'path';
import { joinPathFragments } from '../../utils/path';

const skippedFiles = [
'package.json', // Not to be added to filesets
Expand Down Expand Up @@ -73,15 +73,17 @@ export default async function (tree: Tree) {
const projectSpecificFileset = new Set(
project.namedInputs.projectSpecificFiles ?? []
);
projectSpecificFileset.add(join('{workspaceRoot}', files));
projectSpecificFileset.add(
joinPathFragments('{workspaceRoot}', files)
);
project.namedInputs.projectSpecificFiles = Array.from(
projectSpecificFileset
);
updateProjectConfiguration(tree, dependent, project);
}
} else {
workspaceConfiguration.namedInputs.sharedGlobals.push(
join('{workspaceRoot}', files)
joinPathFragments('{workspaceRoot}', files)
);
}
}
Expand Down
@@ -1,10 +1,10 @@
import {
formatFiles,
joinPathFragments,
readWorkspaceConfiguration,
Tree,
updateWorkspaceConfiguration,
} from '@nrwl/devkit';
import { join } from 'path';

export default async function (tree: Tree) {
const workspaceConfiguration = readWorkspaceConfiguration(tree);
Expand All @@ -17,7 +17,9 @@ export default async function (tree: Tree) {
const sharedGlobalFileset = new Set(
workspaceConfiguration.namedInputs.sharedGlobals
);
sharedGlobalFileset.add(join('{workspaceRoot}', globalBabelFile));
sharedGlobalFileset.add(
joinPathFragments('{workspaceRoot}', globalBabelFile)
);
workspaceConfiguration.namedInputs.sharedGlobals =
Array.from(sharedGlobalFileset);
}
Expand Down
@@ -1,10 +1,10 @@
import {
formatFiles,
joinPathFragments,
readWorkspaceConfiguration,
Tree,
updateWorkspaceConfiguration,
} from '@nrwl/devkit';
import { join } from 'path';

export default async function (tree: Tree) {
const workspaceConfiguration = readWorkspaceConfiguration(tree);
Expand All @@ -17,7 +17,9 @@ export default async function (tree: Tree) {
const sharedGlobalFileset = new Set(
workspaceConfiguration.namedInputs.sharedGlobals
);
sharedGlobalFileset.add(join('{workspaceRoot}', globalBabelFile));
sharedGlobalFileset.add(
joinPathFragments('{workspaceRoot}', globalBabelFile)
);
workspaceConfiguration.namedInputs.sharedGlobals =
Array.from(sharedGlobalFileset);
}
Expand Down
6 changes: 4 additions & 2 deletions packages/web/src/migrations/update-15-0-0/add-babel-inputs.ts
@@ -1,10 +1,10 @@
import {
formatFiles,
joinPathFragments,
readWorkspaceConfiguration,
Tree,
updateWorkspaceConfiguration,
} from '@nrwl/devkit';
import { join } from 'path';

export default async function (tree: Tree) {
const workspaceConfiguration = readWorkspaceConfiguration(tree);
Expand All @@ -17,7 +17,9 @@ export default async function (tree: Tree) {
const sharedGlobalFileset = new Set(
workspaceConfiguration.namedInputs.sharedGlobals
);
sharedGlobalFileset.add(join('{workspaceRoot}', globalBabelFile));
sharedGlobalFileset.add(
joinPathFragments('{workspaceRoot}', globalBabelFile)
);
workspaceConfiguration.namedInputs.sharedGlobals =
Array.from(sharedGlobalFileset);
}
Expand Down
@@ -1,10 +1,10 @@
import {
formatFiles,
joinPathFragments,
readWorkspaceConfiguration,
Tree,
updateWorkspaceConfiguration,
} from '@nrwl/devkit';
import { join } from 'path';

export default async function (tree: Tree) {
const workspaceConfiguration = readWorkspaceConfiguration(tree);
Expand All @@ -17,7 +17,9 @@ export default async function (tree: Tree) {
const sharedGlobalFileset = new Set(
workspaceConfiguration.namedInputs.sharedGlobals
);
sharedGlobalFileset.add(join('{workspaceRoot}', globalBabelFile));
sharedGlobalFileset.add(
joinPathFragments('{workspaceRoot}', globalBabelFile)
);
workspaceConfiguration.namedInputs.sharedGlobals =
Array.from(sharedGlobalFileset);
}
Expand Down

0 comments on commit 5eeb732

Please sign in to comment.