fix(gradle): expose create nodes v2 (#26282)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> ## Current Behavior <!-- This is the behavior we have today --> `createNodesV2` was written but not exported. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> `createNodesV2` is exported. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
This commit is contained in:
parent
2cb7ecb77b
commit
fde4932ab9
@ -11,7 +11,7 @@ import {
|
|||||||
updateNxJson,
|
updateNxJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import {
|
import {
|
||||||
addPlugin as _addPlugin,
|
addPluginV1 as _addPlugin,
|
||||||
generateCombinations,
|
generateCombinations,
|
||||||
} from '@nx/devkit/src/utils/add-plugin';
|
} from '@nx/devkit/src/utils/add-plugin';
|
||||||
import { createNodes } from '../../plugins/plugin';
|
import { createNodes } from '../../plugins/plugin';
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import {
|
|||||||
Tree,
|
Tree,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import {
|
import {
|
||||||
addPlugin,
|
addPluginV1,
|
||||||
generateCombinations,
|
generateCombinations,
|
||||||
} from '@nx/devkit/src/utils/add-plugin';
|
} from '@nx/devkit/src/utils/add-plugin';
|
||||||
import { createNodes, DetoxPluginOptions } from '../../plugins/plugin';
|
import { createNodes, DetoxPluginOptions } from '../../plugins/plugin';
|
||||||
@ -36,7 +36,7 @@ export async function detoxInitGeneratorInternal(host: Tree, schema: Schema) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (schema.addPlugin) {
|
if (schema.addPlugin) {
|
||||||
await addPlugin(
|
await addPluginV1(
|
||||||
host,
|
host,
|
||||||
await createProjectGraphAsync(),
|
await createProjectGraphAsync(),
|
||||||
'@nx/detox/plugin',
|
'@nx/detox/plugin',
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { createTreeWithEmptyWorkspace } from 'nx/src/generators/testing-utils/cr
|
|||||||
import type { Tree } from 'nx/src/generators/tree';
|
import type { Tree } from 'nx/src/generators/tree';
|
||||||
import { readJson, writeJson } from 'nx/src/generators/utils/json';
|
import { readJson, writeJson } from 'nx/src/generators/utils/json';
|
||||||
import type { PackageJson } from 'nx/src/utils/package-json';
|
import type { PackageJson } from 'nx/src/utils/package-json';
|
||||||
import { CreateNodes } from 'nx/src/project-graph/plugins';
|
import { CreateNodesV2 } from 'nx/src/project-graph/plugins';
|
||||||
import { ProjectGraph } from 'nx/src/devkit-exports';
|
import { ProjectGraph } from 'nx/src/devkit-exports';
|
||||||
import { TempFs } from 'nx/src/internal-testing-utils/temp-fs';
|
import { TempFs } from 'nx/src/internal-testing-utils/temp-fs';
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ import { addPlugin, generateCombinations } from './add-plugin';
|
|||||||
|
|
||||||
describe('addPlugin', () => {
|
describe('addPlugin', () => {
|
||||||
let tree: Tree;
|
let tree: Tree;
|
||||||
let createNodes: CreateNodes<{ targetName: string }>;
|
let createNodes: CreateNodesV2<{ targetName: string }>;
|
||||||
let graph: ProjectGraph;
|
let graph: ProjectGraph;
|
||||||
let fs: TempFs;
|
let fs: TempFs;
|
||||||
|
|
||||||
@ -55,7 +55,10 @@ describe('addPlugin', () => {
|
|||||||
};
|
};
|
||||||
createNodes = [
|
createNodes = [
|
||||||
'**/next.config.{js,cjs,mjs}',
|
'**/next.config.{js,cjs,mjs}',
|
||||||
(_, { targetName }) => ({
|
(_, { targetName }) => [
|
||||||
|
[
|
||||||
|
'app1/next.config.js',
|
||||||
|
{
|
||||||
projects: {
|
projects: {
|
||||||
app1: {
|
app1: {
|
||||||
name: 'app1',
|
name: 'app1',
|
||||||
@ -63,6 +66,13 @@ describe('addPlugin', () => {
|
|||||||
[targetName]: { command: 'next build' },
|
[targetName]: { command: 'next build' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'app2/next.config.js',
|
||||||
|
{
|
||||||
|
projects: {
|
||||||
app2: {
|
app2: {
|
||||||
name: 'app2',
|
name: 'app2',
|
||||||
targets: {
|
targets: {
|
||||||
@ -70,7 +80,9 @@ describe('addPlugin', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
await fs.createFiles({
|
await fs.createFiles({
|
||||||
@ -217,7 +229,10 @@ describe('addPlugin', () => {
|
|||||||
|
|
||||||
createNodes = [
|
createNodes = [
|
||||||
'**/cypress.config.{js,ts,mjs,mts,cjs,cts}',
|
'**/cypress.config.{js,ts,mjs,mts,cjs,cts}',
|
||||||
() => ({
|
() => [
|
||||||
|
[
|
||||||
|
'app1/cypress.config.ts',
|
||||||
|
{
|
||||||
projects: {
|
projects: {
|
||||||
app1: {
|
app1: {
|
||||||
name: 'app1',
|
name: 'app1',
|
||||||
@ -229,7 +244,9 @@ describe('addPlugin', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
await addPlugin(
|
await addPlugin(
|
||||||
@ -284,7 +301,10 @@ describe('addPlugin', () => {
|
|||||||
|
|
||||||
createNodes = [
|
createNodes = [
|
||||||
'**/next.config.{js,cjs,mjs}',
|
'**/next.config.{js,cjs,mjs}',
|
||||||
() => ({
|
() => [
|
||||||
|
[
|
||||||
|
'app1/next.config.js',
|
||||||
|
{
|
||||||
projects: {
|
projects: {
|
||||||
app1: {
|
app1: {
|
||||||
name: 'app1',
|
name: 'app1',
|
||||||
@ -295,7 +315,9 @@ describe('addPlugin', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
await addPlugin(
|
await addPlugin(
|
||||||
@ -328,7 +350,10 @@ describe('addPlugin', () => {
|
|||||||
|
|
||||||
createNodes = [
|
createNodes = [
|
||||||
'**/tsconfig.json',
|
'**/tsconfig.json',
|
||||||
() => ({
|
() => [
|
||||||
|
[
|
||||||
|
'app1/tsconfig.json',
|
||||||
|
{
|
||||||
projects: {
|
projects: {
|
||||||
app1: {
|
app1: {
|
||||||
name: 'app1',
|
name: 'app1',
|
||||||
@ -337,7 +362,9 @@ describe('addPlugin', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
await addPlugin(
|
await addPlugin(
|
||||||
@ -370,7 +397,10 @@ describe('addPlugin', () => {
|
|||||||
|
|
||||||
createNodes = [
|
createNodes = [
|
||||||
'**/tsconfig.json',
|
'**/tsconfig.json',
|
||||||
() => ({
|
() => [
|
||||||
|
[
|
||||||
|
'app1/tsconfig.json',
|
||||||
|
{
|
||||||
projects: {
|
projects: {
|
||||||
app1: {
|
app1: {
|
||||||
name: 'app1',
|
name: 'app1',
|
||||||
@ -379,7 +409,9 @@ describe('addPlugin', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
await addPlugin(
|
await addPlugin(
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import * as yargs from 'yargs-parser';
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
CreateNodes,
|
CreateNodes,
|
||||||
|
CreateNodesV2,
|
||||||
ProjectConfiguration,
|
ProjectConfiguration,
|
||||||
ProjectGraph,
|
ProjectGraph,
|
||||||
readJson,
|
readJson,
|
||||||
@ -24,6 +25,41 @@ import {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
export async function addPlugin<PluginOptions>(
|
export async function addPlugin<PluginOptions>(
|
||||||
|
tree: Tree,
|
||||||
|
graph: ProjectGraph,
|
||||||
|
pluginName: string,
|
||||||
|
createNodesTuple: CreateNodesV2<PluginOptions>,
|
||||||
|
options: Partial<
|
||||||
|
Record<keyof PluginOptions, PluginOptions[keyof PluginOptions][]>
|
||||||
|
>,
|
||||||
|
shouldUpdatePackageJsonScripts: boolean
|
||||||
|
): Promise<void> {
|
||||||
|
return _addPluginInternal(
|
||||||
|
tree,
|
||||||
|
graph,
|
||||||
|
pluginName,
|
||||||
|
(pluginOptions) =>
|
||||||
|
new LoadedNxPlugin(
|
||||||
|
{
|
||||||
|
name: pluginName,
|
||||||
|
createNodesV2: createNodesTuple,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
plugin: pluginName,
|
||||||
|
options: pluginOptions,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
options,
|
||||||
|
shouldUpdatePackageJsonScripts
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use `addPlugin` instead
|
||||||
|
* Iterates through various forms of plugin options to find the one which does not conflict with the current graph
|
||||||
|
|
||||||
|
*/
|
||||||
|
export async function addPluginV1<PluginOptions>(
|
||||||
tree: Tree,
|
tree: Tree,
|
||||||
graph: ProjectGraph,
|
graph: ProjectGraph,
|
||||||
pluginName: string,
|
pluginName: string,
|
||||||
@ -33,6 +69,36 @@ export async function addPlugin<PluginOptions>(
|
|||||||
>,
|
>,
|
||||||
shouldUpdatePackageJsonScripts: boolean
|
shouldUpdatePackageJsonScripts: boolean
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
return _addPluginInternal(
|
||||||
|
tree,
|
||||||
|
graph,
|
||||||
|
pluginName,
|
||||||
|
(pluginOptions) =>
|
||||||
|
new LoadedNxPlugin(
|
||||||
|
{
|
||||||
|
name: pluginName,
|
||||||
|
createNodes: createNodesTuple,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
plugin: pluginName,
|
||||||
|
options: pluginOptions,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
options,
|
||||||
|
shouldUpdatePackageJsonScripts
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function _addPluginInternal<PluginOptions>(
|
||||||
|
tree: Tree,
|
||||||
|
graph: ProjectGraph,
|
||||||
|
pluginName: string,
|
||||||
|
pluginFactory: (pluginOptions: PluginOptions) => LoadedNxPlugin,
|
||||||
|
options: Partial<
|
||||||
|
Record<keyof PluginOptions, PluginOptions[keyof PluginOptions][]>
|
||||||
|
>,
|
||||||
|
shouldUpdatePackageJsonScripts: boolean
|
||||||
|
) {
|
||||||
const graphNodes = Object.values(graph.nodes);
|
const graphNodes = Object.values(graph.nodes);
|
||||||
const nxJson = readNxJson(tree);
|
const nxJson = readNxJson(tree);
|
||||||
|
|
||||||
@ -56,18 +122,7 @@ export async function addPlugin<PluginOptions>(
|
|||||||
global.NX_GRAPH_CREATION = true;
|
global.NX_GRAPH_CREATION = true;
|
||||||
try {
|
try {
|
||||||
projConfigs = await retrieveProjectConfigurations(
|
projConfigs = await retrieveProjectConfigurations(
|
||||||
[
|
[pluginFactory(pluginOptions)],
|
||||||
new LoadedNxPlugin(
|
|
||||||
{
|
|
||||||
name: pluginName,
|
|
||||||
createNodes: createNodesTuple,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
plugin: pluginName,
|
|
||||||
options: pluginOptions,
|
|
||||||
}
|
|
||||||
),
|
|
||||||
],
|
|
||||||
tree.root,
|
tree.root,
|
||||||
nxJson
|
nxJson
|
||||||
);
|
);
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import {
|
|||||||
Tree,
|
Tree,
|
||||||
updateNxJson,
|
updateNxJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { addPlugin } from '@nx/devkit/src/utils/add-plugin';
|
import { addPluginV1 } from '@nx/devkit/src/utils/add-plugin';
|
||||||
import { eslintVersion, nxVersion } from '../../utils/versions';
|
import { eslintVersion, nxVersion } from '../../utils/versions';
|
||||||
import { findEslintFile } from '../utils/eslint-file';
|
import { findEslintFile } from '../utils/eslint-file';
|
||||||
import { createNodes } from '../../plugins/plugin';
|
import { createNodes } from '../../plugins/plugin';
|
||||||
@ -73,7 +73,7 @@ export async function initEsLint(
|
|||||||
];
|
];
|
||||||
|
|
||||||
if (rootEslintFile && options.addPlugin && !hasPlugin) {
|
if (rootEslintFile && options.addPlugin && !hasPlugin) {
|
||||||
await addPlugin(
|
await addPluginV1(
|
||||||
tree,
|
tree,
|
||||||
graph,
|
graph,
|
||||||
'@nx/eslint/plugin',
|
'@nx/eslint/plugin',
|
||||||
@ -94,7 +94,7 @@ export async function initEsLint(
|
|||||||
updateProductionFileset(tree);
|
updateProductionFileset(tree);
|
||||||
|
|
||||||
if (options.addPlugin) {
|
if (options.addPlugin) {
|
||||||
await addPlugin(
|
await addPluginV1(
|
||||||
tree,
|
tree,
|
||||||
graph,
|
graph,
|
||||||
'@nx/eslint/plugin',
|
'@nx/eslint/plugin',
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import {
|
|||||||
runTasksInSerial,
|
runTasksInSerial,
|
||||||
Tree,
|
Tree,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { addPlugin } from '@nx/devkit/src/utils/add-plugin';
|
import { addPluginV1 } from '@nx/devkit/src/utils/add-plugin';
|
||||||
import { createNodes } from '../../../plugins/plugin';
|
import { createNodes } from '../../../plugins/plugin';
|
||||||
import {
|
import {
|
||||||
expoCliVersion,
|
expoCliVersion,
|
||||||
@ -36,7 +36,7 @@ export async function expoInitGeneratorInternal(host: Tree, schema: Schema) {
|
|||||||
addGitIgnoreEntry(host);
|
addGitIgnoreEntry(host);
|
||||||
|
|
||||||
if (schema.addPlugin) {
|
if (schema.addPlugin) {
|
||||||
await addPlugin(
|
await addPluginV1(
|
||||||
host,
|
host,
|
||||||
await createProjectGraphAsync(),
|
await createProjectGraphAsync(),
|
||||||
'@nx/expo/plugin',
|
'@nx/expo/plugin',
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
export { createDependencies } from './src/plugin/dependencies';
|
export { createDependencies } from './src/plugin/dependencies';
|
||||||
export { createNodes } from './src/plugin/nodes';
|
export { createNodes, createNodesV2 } from './src/plugin/nodes';
|
||||||
|
|||||||
@ -11,10 +11,10 @@ jest.mock('../utils/get-gradle-report.ts', () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
import { createNodes } from './nodes';
|
import { createNodesV2 } from './nodes';
|
||||||
|
|
||||||
describe('@nx/gradle/plugin', () => {
|
describe('@nx/gradle/plugin', () => {
|
||||||
let createNodesFunction = createNodes[1];
|
let createNodesFunction = createNodesV2[1];
|
||||||
let context: CreateNodesContext;
|
let context: CreateNodesContext;
|
||||||
let tempFs: TempFs;
|
let tempFs: TempFs;
|
||||||
let cwd: string;
|
let cwd: string;
|
||||||
@ -59,16 +59,21 @@ describe('@nx/gradle/plugin', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should create nodes based on gradle', async () => {
|
it('should create nodes based on gradle', async () => {
|
||||||
const nodes = await createNodesFunction(
|
const results = await createNodesFunction(
|
||||||
'proj/gradle.build',
|
['proj/gradle.build'],
|
||||||
{
|
{
|
||||||
buildTargetName: 'build',
|
buildTargetName: 'build',
|
||||||
},
|
},
|
||||||
context
|
context
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(nodes.projects.proj).toMatchInlineSnapshot(`
|
expect(results).toMatchInlineSnapshot(`
|
||||||
|
[
|
||||||
|
[
|
||||||
|
"proj/gradle.build",
|
||||||
{
|
{
|
||||||
|
"projects": {
|
||||||
|
"proj": {
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"targetGroups": {
|
"targetGroups": {
|
||||||
"Test": [
|
"Test": [
|
||||||
@ -96,10 +101,13 @@ describe('@nx/gradle/plugin', () => {
|
|||||||
"gradle",
|
"gradle",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"outputs": undefined,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
]
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -121,16 +129,21 @@ describe('@nx/gradle/plugin', () => {
|
|||||||
'nested/nested/proj/gradle.build': ``,
|
'nested/nested/proj/gradle.build': ``,
|
||||||
});
|
});
|
||||||
|
|
||||||
const nodes = await createNodesFunction(
|
const results = await createNodesFunction(
|
||||||
'nested/nested/proj/gradle.build',
|
['nested/nested/proj/gradle.build'],
|
||||||
{
|
{
|
||||||
buildTargetName: 'build',
|
buildTargetName: 'build',
|
||||||
},
|
},
|
||||||
context
|
context
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(nodes.projects['nested/nested/proj']).toMatchInlineSnapshot(`
|
expect(results).toMatchInlineSnapshot(`
|
||||||
|
[
|
||||||
|
[
|
||||||
|
"nested/nested/proj/gradle.build",
|
||||||
{
|
{
|
||||||
|
"projects": {
|
||||||
|
"nested/nested/proj": {
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"targetGroups": {
|
"targetGroups": {
|
||||||
"Test": [
|
"Test": [
|
||||||
@ -158,10 +171,13 @@ describe('@nx/gradle/plugin', () => {
|
|||||||
"gradle",
|
"gradle",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"outputs": undefined,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
]
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -218,18 +218,23 @@ function createGradleTargets(
|
|||||||
const targetName = options?.[`${task.name}TargetName`] ?? task.name;
|
const targetName = options?.[`${task.name}TargetName`] ?? task.name;
|
||||||
|
|
||||||
const outputs = outputDirs.get(task.name);
|
const outputs = outputDirs.get(task.name);
|
||||||
|
|
||||||
targets[targetName] = {
|
targets[targetName] = {
|
||||||
command: `${getGradleExecFile()} ${
|
command: `${getGradleExecFile()} ${
|
||||||
gradleProject ? gradleProject + ':' : ''
|
gradleProject ? gradleProject + ':' : ''
|
||||||
}${task.name}`,
|
}${task.name}`,
|
||||||
cache: cacheableTaskType.has(task.type),
|
cache: cacheableTaskType.has(task.type),
|
||||||
inputs: inputsMap[task.name],
|
inputs: inputsMap[task.name],
|
||||||
outputs: outputs ? [outputs] : undefined,
|
|
||||||
dependsOn: dependsOnMap[task.name],
|
dependsOn: dependsOnMap[task.name],
|
||||||
metadata: {
|
metadata: {
|
||||||
technologies: ['gradle'],
|
technologies: ['gradle'],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (outputs) {
|
||||||
|
targets[targetName].outputs = [outputs];
|
||||||
|
}
|
||||||
|
|
||||||
if (!targetGroups[task.type]) {
|
if (!targetGroups[task.type]) {
|
||||||
targetGroups[task.type] = [];
|
targetGroups[task.type] = [];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import {
|
|||||||
type GeneratorCallback,
|
type GeneratorCallback,
|
||||||
type Tree,
|
type Tree,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { addPlugin } from '@nx/devkit/src/utils/add-plugin';
|
import { addPluginV1 } from '@nx/devkit/src/utils/add-plugin';
|
||||||
import { createNodes } from '../../plugins/plugin';
|
import { createNodes } from '../../plugins/plugin';
|
||||||
import {
|
import {
|
||||||
getPresetExt,
|
getPresetExt,
|
||||||
@ -104,7 +104,7 @@ export async function jestInitGeneratorInternal(
|
|||||||
if (!tree.exists(`jest.preset.${presetExt}`)) {
|
if (!tree.exists(`jest.preset.${presetExt}`)) {
|
||||||
updateProductionFileSet(tree);
|
updateProductionFileSet(tree);
|
||||||
if (options.addPlugin) {
|
if (options.addPlugin) {
|
||||||
await addPlugin(
|
await addPluginV1(
|
||||||
tree,
|
tree,
|
||||||
await createProjectGraphAsync(),
|
await createProjectGraphAsync(),
|
||||||
'@nx/jest/plugin',
|
'@nx/jest/plugin',
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import {
|
|||||||
readNxJson,
|
readNxJson,
|
||||||
createProjectGraphAsync,
|
createProjectGraphAsync,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { addPlugin } from '@nx/devkit/src/utils/add-plugin';
|
import { addPluginV1 } from '@nx/devkit/src/utils/add-plugin';
|
||||||
import { reactDomVersion, reactVersion } from '@nx/react/src/utils/versions';
|
import { reactDomVersion, reactVersion } from '@nx/react/src/utils/versions';
|
||||||
import { addGitIgnoreEntry } from '../../utils/add-gitignore-entry';
|
import { addGitIgnoreEntry } from '../../utils/add-gitignore-entry';
|
||||||
import { nextVersion, nxVersion } from '../../utils/versions';
|
import { nextVersion, nxVersion } from '../../utils/versions';
|
||||||
@ -53,7 +53,7 @@ export async function nextInitGeneratorInternal(
|
|||||||
schema.addPlugin ??= addPluginDefault;
|
schema.addPlugin ??= addPluginDefault;
|
||||||
if (schema.addPlugin) {
|
if (schema.addPlugin) {
|
||||||
const { createNodes } = await import('../../plugins/plugin');
|
const { createNodes } = await import('../../plugins/plugin');
|
||||||
await addPlugin(
|
await addPluginV1(
|
||||||
host,
|
host,
|
||||||
await createProjectGraphAsync(),
|
await createProjectGraphAsync(),
|
||||||
'@nx/next/plugin',
|
'@nx/next/plugin',
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import { createProjectGraphAsync, GeneratorCallback, Tree } from '@nx/devkit';
|
import { createProjectGraphAsync, GeneratorCallback, Tree } from '@nx/devkit';
|
||||||
import { addPlugin } from '@nx/devkit/src/utils/add-plugin';
|
import { addPluginV1 } from '@nx/devkit/src/utils/add-plugin';
|
||||||
|
|
||||||
import { createNodes } from '../../plugins/plugin';
|
import { createNodes } from '../../plugins/plugin';
|
||||||
import { InitSchema } from './schema';
|
import { InitSchema } from './schema';
|
||||||
import { updateDependencies } from './lib/utils';
|
import { updateDependencies } from './lib/utils';
|
||||||
|
|
||||||
export async function nuxtInitGenerator(host: Tree, schema: InitSchema) {
|
export async function nuxtInitGenerator(host: Tree, schema: InitSchema) {
|
||||||
await addPlugin(
|
await addPluginV1(
|
||||||
host,
|
host,
|
||||||
await createProjectGraphAsync(),
|
await createProjectGraphAsync(),
|
||||||
'@nx/nuxt/plugin',
|
'@nx/nuxt/plugin',
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import {
|
|||||||
runTasksInSerial,
|
runTasksInSerial,
|
||||||
Tree,
|
Tree,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { addPlugin } from '@nx/devkit/src/utils/add-plugin';
|
import { addPluginV1 } from '@nx/devkit/src/utils/add-plugin';
|
||||||
import { createNodes } from '../../plugins/plugin';
|
import { createNodes } from '../../plugins/plugin';
|
||||||
import { nxVersion, playwrightVersion } from '../../utils/versions';
|
import { nxVersion, playwrightVersion } from '../../utils/versions';
|
||||||
import { InitGeneratorSchema } from './schema';
|
import { InitGeneratorSchema } from './schema';
|
||||||
@ -45,7 +45,7 @@ export async function initGeneratorInternal(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (options.addPlugin) {
|
if (options.addPlugin) {
|
||||||
await addPlugin(
|
await addPluginV1(
|
||||||
tree,
|
tree,
|
||||||
await createProjectGraphAsync(),
|
await createProjectGraphAsync(),
|
||||||
'@nx/playwright/plugin',
|
'@nx/playwright/plugin',
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import {
|
|||||||
runTasksInSerial,
|
runTasksInSerial,
|
||||||
Tree,
|
Tree,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { addPlugin } from '@nx/devkit/src/utils/add-plugin';
|
import { addPluginV1 } from '@nx/devkit/src/utils/add-plugin';
|
||||||
import { createNodes } from '../../../plugins/plugin';
|
import { createNodes } from '../../../plugins/plugin';
|
||||||
import {
|
import {
|
||||||
nxVersion,
|
nxVersion,
|
||||||
@ -39,7 +39,7 @@ export async function reactNativeInitGeneratorInternal(
|
|||||||
schema.addPlugin ??= addPluginDefault;
|
schema.addPlugin ??= addPluginDefault;
|
||||||
|
|
||||||
if (schema.addPlugin) {
|
if (schema.addPlugin) {
|
||||||
await addPlugin(
|
await addPluginV1(
|
||||||
host,
|
host,
|
||||||
await createProjectGraphAsync(),
|
await createProjectGraphAsync(),
|
||||||
'@nx/react-native/plugin',
|
'@nx/react-native/plugin',
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import {
|
|||||||
createProjectGraphAsync,
|
createProjectGraphAsync,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import {
|
import {
|
||||||
addPlugin,
|
addPluginV1,
|
||||||
generateCombinations,
|
generateCombinations,
|
||||||
} from '@nx/devkit/src/utils/add-plugin';
|
} from '@nx/devkit/src/utils/add-plugin';
|
||||||
import { createNodes } from '../../plugins/plugin';
|
import { createNodes } from '../../plugins/plugin';
|
||||||
@ -44,7 +44,7 @@ export async function remixInitGeneratorInternal(tree: Tree, options: Schema) {
|
|||||||
nxJson.useInferencePlugins !== false;
|
nxJson.useInferencePlugins !== false;
|
||||||
options.addPlugin ??= addPluginDefault;
|
options.addPlugin ??= addPluginDefault;
|
||||||
if (options.addPlugin) {
|
if (options.addPlugin) {
|
||||||
await addPlugin(
|
await addPluginV1(
|
||||||
tree,
|
tree,
|
||||||
await createProjectGraphAsync(),
|
await createProjectGraphAsync(),
|
||||||
'@nx/remix/plugin',
|
'@nx/remix/plugin',
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import {
|
|||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { nxVersion } from '../../utils/versions';
|
import { nxVersion } from '../../utils/versions';
|
||||||
import { Schema } from './schema';
|
import { Schema } from './schema';
|
||||||
import { addPlugin } from '@nx/devkit/src/utils/add-plugin';
|
import { addPluginV1 } from '@nx/devkit/src/utils/add-plugin';
|
||||||
import { createNodes } from '../../plugins/plugin';
|
import { createNodes } from '../../plugins/plugin';
|
||||||
|
|
||||||
export async function rollupInitGenerator(tree: Tree, schema: Schema) {
|
export async function rollupInitGenerator(tree: Tree, schema: Schema) {
|
||||||
@ -25,7 +25,7 @@ export async function rollupInitGenerator(tree: Tree, schema: Schema) {
|
|||||||
|
|
||||||
schema.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
|
schema.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
|
||||||
if (schema.addPlugin) {
|
if (schema.addPlugin) {
|
||||||
await addPlugin(
|
await addPluginV1(
|
||||||
tree,
|
tree,
|
||||||
await createProjectGraphAsync(),
|
await createProjectGraphAsync(),
|
||||||
'@nx/rollup/plugin',
|
'@nx/rollup/plugin',
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import {
|
|||||||
updateJson,
|
updateJson,
|
||||||
updateNxJson,
|
updateNxJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { addPlugin } from '@nx/devkit/src/utils/add-plugin';
|
import { addPluginV1 } from '@nx/devkit/src/utils/add-plugin';
|
||||||
import { gte } from 'semver';
|
import { gte } from 'semver';
|
||||||
import { createNodes } from '../../plugins/plugin';
|
import { createNodes } from '../../plugins/plugin';
|
||||||
import {
|
import {
|
||||||
@ -102,7 +102,7 @@ export async function initGeneratorInternal(tree: Tree, schema: Schema) {
|
|||||||
schema.addPlugin ??= addPluginDefault;
|
schema.addPlugin ??= addPluginDefault;
|
||||||
|
|
||||||
if (schema.addPlugin) {
|
if (schema.addPlugin) {
|
||||||
await addPlugin(
|
await addPluginV1(
|
||||||
tree,
|
tree,
|
||||||
await createProjectGraphAsync(),
|
await createProjectGraphAsync(),
|
||||||
'@nx/storybook/plugin',
|
'@nx/storybook/plugin',
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import {
|
|||||||
Tree,
|
Tree,
|
||||||
updateNxJson,
|
updateNxJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { addPlugin } from '@nx/devkit/src/utils/add-plugin';
|
import { addPluginV1 } from '@nx/devkit/src/utils/add-plugin';
|
||||||
|
|
||||||
import { createNodes } from '../../plugins/plugin';
|
import { createNodes } from '../../plugins/plugin';
|
||||||
import { InitGeneratorSchema } from './schema';
|
import { InitGeneratorSchema } from './schema';
|
||||||
@ -60,7 +60,7 @@ export async function initGeneratorInternal(
|
|||||||
schema.addPlugin ??= addPluginDefault;
|
schema.addPlugin ??= addPluginDefault;
|
||||||
|
|
||||||
if (schema.addPlugin) {
|
if (schema.addPlugin) {
|
||||||
await addPlugin(
|
await addPluginV1(
|
||||||
tree,
|
tree,
|
||||||
await createProjectGraphAsync(),
|
await createProjectGraphAsync(),
|
||||||
'@nx/vite/plugin',
|
'@nx/vite/plugin',
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import {
|
|||||||
readNxJson,
|
readNxJson,
|
||||||
Tree,
|
Tree,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { addPlugin } from '@nx/devkit/src/utils/add-plugin';
|
import { addPluginV1 } from '@nx/devkit/src/utils/add-plugin';
|
||||||
import { createNodes } from '../../plugins/plugin';
|
import { createNodes } from '../../plugins/plugin';
|
||||||
import { nxVersion, webpackCliVersion } from '../../utils/versions';
|
import { nxVersion, webpackCliVersion } from '../../utils/versions';
|
||||||
import { Schema } from './schema';
|
import { Schema } from './schema';
|
||||||
@ -23,7 +23,7 @@ export async function webpackInitGeneratorInternal(tree: Tree, schema: Schema) {
|
|||||||
schema.addPlugin ??= addPluginDefault;
|
schema.addPlugin ??= addPluginDefault;
|
||||||
|
|
||||||
if (schema.addPlugin) {
|
if (schema.addPlugin) {
|
||||||
await addPlugin(
|
await addPluginV1(
|
||||||
tree,
|
tree,
|
||||||
await createProjectGraphAsync(),
|
await createProjectGraphAsync(),
|
||||||
'@nx/webpack/plugin',
|
'@nx/webpack/plugin',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user