fix(core): merge package.json plugins and updated project.json plugin… (#26952)
… using v2 ## Current Behavior <!-- This is the behavior we have today --> The `package.json` handling is split between before and after plugins so it's confusing. Also, `package.json` nodes will get overwritten by plugins while others won't. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> The `package.json` handling is merged. Also, the `package.json` nodes will always overwrite plugins as intended. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
This commit is contained in:
parent
1a9429643f
commit
51f5fe4434
@ -25,7 +25,7 @@ import {
|
|||||||
clearRequireCache,
|
clearRequireCache,
|
||||||
loadConfigFile,
|
loadConfigFile,
|
||||||
} from '@nx/devkit/src/utils/config-utils';
|
} from '@nx/devkit/src/utils/config-utils';
|
||||||
import { getGlobPatternsFromPackageManagerWorkspaces } from 'nx/src/plugins/package-json-workspaces';
|
import { getGlobPatternsFromPackageManagerWorkspaces } from 'nx/src/plugins/package-json';
|
||||||
import { combineGlobPatterns } from 'nx/src/utils/globs';
|
import { combineGlobPatterns } from 'nx/src/utils/globs';
|
||||||
import { minimatch } from 'minimatch';
|
import { minimatch } from 'minimatch';
|
||||||
import { hashObject } from 'nx/src/devkit-internals';
|
import { hashObject } from 'nx/src/devkit-internals';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import type { NxPluginV2 } from '../src/project-graph/plugins';
|
import type { NxPluginV2 } from '../src/project-graph/plugins';
|
||||||
import { workspaceRoot } from '../src/utils/workspace-root';
|
import { workspaceRoot } from '../src/utils/workspace-root';
|
||||||
import { createNodeFromPackageJson } from '../src/plugins/package-json-workspaces';
|
import { createNodeFromPackageJson } from '../src/plugins/package-json';
|
||||||
|
|
||||||
const plugin: NxPluginV2 = {
|
const plugin: NxPluginV2 = {
|
||||||
name: 'nx-all-package-jsons-plugin',
|
name: 'nx-all-package-jsons-plugin',
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { basename, join, relative } from 'path';
|
|||||||
import {
|
import {
|
||||||
buildProjectConfigurationFromPackageJson,
|
buildProjectConfigurationFromPackageJson,
|
||||||
getGlobPatternsFromPackageManagerWorkspaces,
|
getGlobPatternsFromPackageManagerWorkspaces,
|
||||||
} from '../../plugins/package-json-workspaces';
|
} from '../../plugins/package-json';
|
||||||
import { buildProjectFromProjectJson } from '../../plugins/project-json/build-nodes/project-json';
|
import { buildProjectFromProjectJson } from '../../plugins/project-json/build-nodes/project-json';
|
||||||
import { renamePropertyWithStableKeys } from '../../adapter/angular-json';
|
import { renamePropertyWithStableKeys } from '../../adapter/angular-json';
|
||||||
import {
|
import {
|
||||||
|
|||||||
@ -1,2 +0,0 @@
|
|||||||
export * from './create-nodes';
|
|
||||||
export const name = 'nx/core/package-json-workspaces';
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import '../../internal-testing-utils/mock-fs';
|
import '../../internal-testing-utils/mock-fs';
|
||||||
|
|
||||||
import { vol } from 'memfs';
|
import { vol } from 'memfs';
|
||||||
import { createNodeFromPackageJson, createNodes } from './create-nodes';
|
import { createNodeFromPackageJson, createNodesV2 } from './create-nodes';
|
||||||
|
|
||||||
describe('nx package.json workspaces plugin', () => {
|
describe('nx package.json workspaces plugin', () => {
|
||||||
const context = {
|
const context = {
|
||||||
@ -198,7 +198,7 @@ describe('nx package.json workspaces plugin', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('negative patterns', () => {
|
describe('negative patterns', () => {
|
||||||
it('should work based on negative patterns defined in package.json workspaces', () => {
|
it('should work based on negative patterns defined in package.json workspaces', async () => {
|
||||||
vol.fromJSON(
|
vol.fromJSON(
|
||||||
{
|
{
|
||||||
'package.json': JSON.stringify({
|
'package.json': JSON.stringify({
|
||||||
@ -231,64 +231,74 @@ describe('nx package.json workspaces plugin', () => {
|
|||||||
|
|
||||||
// No matching project based on the package.json "workspace" config
|
// No matching project based on the package.json "workspace" config
|
||||||
expect(
|
expect(
|
||||||
createNodes[1]('package.json', undefined, context)
|
await createNodesV2[1](['package.json'], undefined, context)
|
||||||
).toMatchInlineSnapshot(`{}`);
|
).toMatchInlineSnapshot(`[]`);
|
||||||
|
|
||||||
// Matching project based on the package.json "workspace" config
|
// Matching project based on the package.json "workspace" config
|
||||||
expect(createNodes[1]('packages/vite/package.json', undefined, context))
|
expect(
|
||||||
.toMatchInlineSnapshot(`
|
await createNodesV2[1](
|
||||||
{
|
['packages/vite/package.json'],
|
||||||
"projects": {
|
undefined,
|
||||||
"packages/vite": {
|
context
|
||||||
"metadata": {
|
)
|
||||||
"description": undefined,
|
).toMatchInlineSnapshot(`
|
||||||
"targetGroups": {},
|
[
|
||||||
},
|
[
|
||||||
"name": "vite",
|
"packages/vite/package.json",
|
||||||
"root": "packages/vite",
|
{
|
||||||
"sourceRoot": "packages/vite",
|
"projects": {
|
||||||
"tags": [
|
"packages/vite": {
|
||||||
"npm:public",
|
"metadata": {
|
||||||
],
|
"description": undefined,
|
||||||
"targets": {
|
"targetGroups": {},
|
||||||
"nx-release-publish": {
|
},
|
||||||
"dependsOn": [
|
"name": "vite",
|
||||||
"^nx-release-publish",
|
"root": "packages/vite",
|
||||||
|
"sourceRoot": "packages/vite",
|
||||||
|
"tags": [
|
||||||
|
"npm:public",
|
||||||
],
|
],
|
||||||
"executor": "@nx/js:release-publish",
|
"targets": {
|
||||||
"options": {},
|
"nx-release-publish": {
|
||||||
|
"dependsOn": [
|
||||||
|
"^nx-release-publish",
|
||||||
|
],
|
||||||
|
"executor": "@nx/js:release-publish",
|
||||||
|
"options": {},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
}
|
]
|
||||||
`);
|
`);
|
||||||
|
|
||||||
// No matching project based on the package.json "workspace" config
|
// No matching project based on the package.json "workspace" config
|
||||||
expect(
|
expect(
|
||||||
createNodes[1]('packages/fs/package.json', undefined, context)
|
await createNodesV2[1](['packages/fs/package.json'], undefined, context)
|
||||||
).toMatchInlineSnapshot(`{}`);
|
).toMatchInlineSnapshot(`[]`);
|
||||||
|
|
||||||
// No matching project based on the package.json "workspace" config
|
// No matching project based on the package.json "workspace" config
|
||||||
expect(
|
expect(
|
||||||
createNodes[1](
|
await createNodesV2[1](
|
||||||
'packages/orm-browser-example/package.json',
|
['packages/orm-browser-example/package.json'],
|
||||||
undefined,
|
undefined,
|
||||||
context
|
context
|
||||||
)
|
)
|
||||||
).toMatchInlineSnapshot(`{}`);
|
).toMatchInlineSnapshot(`[]`);
|
||||||
|
|
||||||
// No matching project based on the package.json "workspace" config
|
// No matching project based on the package.json "workspace" config
|
||||||
expect(
|
expect(
|
||||||
createNodes[1](
|
await createNodesV2[1](
|
||||||
'packages/framework-examples/package.json',
|
['packages/framework-examples/package.json'],
|
||||||
undefined,
|
undefined,
|
||||||
context
|
context
|
||||||
)
|
)
|
||||||
).toMatchInlineSnapshot(`{}`);
|
).toMatchInlineSnapshot(`[]`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should work based on negative patterns defined in pnpm-workspace.yaml', () => {
|
it('should work based on negative patterns defined in pnpm-workspace.yaml', async () => {
|
||||||
vol.fromJSON(
|
vol.fromJSON(
|
||||||
{
|
{
|
||||||
'package.json': JSON.stringify({ name: 'root' }),
|
'package.json': JSON.stringify({ name: 'root' }),
|
||||||
@ -319,64 +329,74 @@ describe('nx package.json workspaces plugin', () => {
|
|||||||
|
|
||||||
// No matching project based on the pnpm-workspace.yaml "packages" config
|
// No matching project based on the pnpm-workspace.yaml "packages" config
|
||||||
expect(
|
expect(
|
||||||
createNodes[1]('package.json', undefined, context)
|
await createNodesV2[1](['package.json'], undefined, context)
|
||||||
).toMatchInlineSnapshot(`{}`);
|
).toMatchInlineSnapshot(`[]`);
|
||||||
|
|
||||||
// Matching project based on the pnpm-workspace.yaml "packages" config
|
// Matching project based on the pnpm-workspace.yaml "packages" config
|
||||||
expect(createNodes[1]('packages/vite/package.json', undefined, context))
|
expect(
|
||||||
.toMatchInlineSnapshot(`
|
await createNodesV2[1](
|
||||||
{
|
['packages/vite/package.json'],
|
||||||
"projects": {
|
undefined,
|
||||||
"packages/vite": {
|
context
|
||||||
"metadata": {
|
)
|
||||||
"description": undefined,
|
).toMatchInlineSnapshot(`
|
||||||
"targetGroups": {},
|
[
|
||||||
},
|
[
|
||||||
"name": "vite",
|
"packages/vite/package.json",
|
||||||
"root": "packages/vite",
|
{
|
||||||
"sourceRoot": "packages/vite",
|
"projects": {
|
||||||
"tags": [
|
"packages/vite": {
|
||||||
"npm:public",
|
"metadata": {
|
||||||
],
|
"description": undefined,
|
||||||
"targets": {
|
"targetGroups": {},
|
||||||
"nx-release-publish": {
|
},
|
||||||
"dependsOn": [
|
"name": "vite",
|
||||||
"^nx-release-publish",
|
"root": "packages/vite",
|
||||||
|
"sourceRoot": "packages/vite",
|
||||||
|
"tags": [
|
||||||
|
"npm:public",
|
||||||
],
|
],
|
||||||
"executor": "@nx/js:release-publish",
|
"targets": {
|
||||||
"options": {},
|
"nx-release-publish": {
|
||||||
|
"dependsOn": [
|
||||||
|
"^nx-release-publish",
|
||||||
|
],
|
||||||
|
"executor": "@nx/js:release-publish",
|
||||||
|
"options": {},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
}
|
]
|
||||||
`);
|
`);
|
||||||
|
|
||||||
// No matching project based on the pnpm-workspace.yaml "packages" config
|
// No matching project based on the pnpm-workspace.yaml "packages" config
|
||||||
expect(
|
expect(
|
||||||
createNodes[1]('packages/fs/package.json', undefined, context)
|
await createNodesV2[1](['packages/fs/package.json'], undefined, context)
|
||||||
).toMatchInlineSnapshot(`{}`);
|
).toMatchInlineSnapshot(`[]`);
|
||||||
|
|
||||||
// No matching project based on the pnpm-workspace.yaml "packages" config
|
// No matching project based on the pnpm-workspace.yaml "packages" config
|
||||||
expect(
|
expect(
|
||||||
createNodes[1](
|
await createNodesV2[1](
|
||||||
'packages/orm-browser-example/package.json',
|
['packages/orm-browser-example/package.json'],
|
||||||
undefined,
|
undefined,
|
||||||
context
|
context
|
||||||
)
|
)
|
||||||
).toMatchInlineSnapshot(`{}`);
|
).toMatchInlineSnapshot(`[]`);
|
||||||
|
|
||||||
// No matching project based on the pnpm-workspace.yaml "packages" config
|
// No matching project based on the pnpm-workspace.yaml "packages" config
|
||||||
expect(
|
expect(
|
||||||
createNodes[1](
|
await createNodesV2[1](
|
||||||
'packages/framework-examples/package.json',
|
['packages/framework-examples/package.json'],
|
||||||
undefined,
|
undefined,
|
||||||
context
|
context
|
||||||
)
|
)
|
||||||
).toMatchInlineSnapshot(`{}`);
|
).toMatchInlineSnapshot(`[]`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should work based on negative patterns defined in lerna.json', () => {
|
it('should work based on negative patterns defined in lerna.json', async () => {
|
||||||
vol.fromJSON(
|
vol.fromJSON(
|
||||||
{
|
{
|
||||||
'package.json': JSON.stringify({ name: 'root' }),
|
'package.json': JSON.stringify({ name: 'root' }),
|
||||||
@ -403,66 +423,76 @@ describe('nx package.json workspaces plugin', () => {
|
|||||||
|
|
||||||
// No matching project based on the lerna.json "packages" config
|
// No matching project based on the lerna.json "packages" config
|
||||||
expect(
|
expect(
|
||||||
createNodes[1]('package.json', undefined, context)
|
await createNodesV2[1](['package.json'], undefined, context)
|
||||||
).toMatchInlineSnapshot(`{}`);
|
).toMatchInlineSnapshot(`[]`);
|
||||||
|
|
||||||
// Matching project based on the lerna.json "packages" config
|
// Matching project based on the lerna.json "packages" config
|
||||||
expect(createNodes[1]('packages/vite/package.json', undefined, context))
|
expect(
|
||||||
.toMatchInlineSnapshot(`
|
await createNodesV2[1](
|
||||||
{
|
['packages/vite/package.json'],
|
||||||
"projects": {
|
undefined,
|
||||||
"packages/vite": {
|
context
|
||||||
"metadata": {
|
)
|
||||||
"description": undefined,
|
).toMatchInlineSnapshot(`
|
||||||
"targetGroups": {},
|
[
|
||||||
},
|
[
|
||||||
"name": "vite",
|
"packages/vite/package.json",
|
||||||
"root": "packages/vite",
|
{
|
||||||
"sourceRoot": "packages/vite",
|
"projects": {
|
||||||
"tags": [
|
"packages/vite": {
|
||||||
"npm:public",
|
"metadata": {
|
||||||
],
|
"description": undefined,
|
||||||
"targets": {
|
"targetGroups": {},
|
||||||
"nx-release-publish": {
|
},
|
||||||
"dependsOn": [
|
"name": "vite",
|
||||||
"^nx-release-publish",
|
"root": "packages/vite",
|
||||||
|
"sourceRoot": "packages/vite",
|
||||||
|
"tags": [
|
||||||
|
"npm:public",
|
||||||
],
|
],
|
||||||
"executor": "@nx/js:release-publish",
|
"targets": {
|
||||||
"options": {},
|
"nx-release-publish": {
|
||||||
|
"dependsOn": [
|
||||||
|
"^nx-release-publish",
|
||||||
|
],
|
||||||
|
"executor": "@nx/js:release-publish",
|
||||||
|
"options": {},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
}
|
]
|
||||||
`);
|
`);
|
||||||
|
|
||||||
// No matching project based on the lerna.json "packages" config
|
// No matching project based on the lerna.json "packages" config
|
||||||
expect(
|
expect(
|
||||||
createNodes[1]('packages/fs/package.json', undefined, context)
|
await createNodesV2[1](['packages/fs/package.json'], undefined, context)
|
||||||
).toMatchInlineSnapshot(`{}`);
|
).toMatchInlineSnapshot(`[]`);
|
||||||
|
|
||||||
// No matching project based on the lerna.json "packages" config
|
// No matching project based on the lerna.json "packages" config
|
||||||
expect(
|
expect(
|
||||||
createNodes[1](
|
await createNodesV2[1](
|
||||||
'packages/orm-browser-example/package.json',
|
['packages/orm-browser-example/package.json'],
|
||||||
undefined,
|
undefined,
|
||||||
context
|
context
|
||||||
)
|
)
|
||||||
).toMatchInlineSnapshot(`{}`);
|
).toMatchInlineSnapshot(`[]`);
|
||||||
|
|
||||||
// No matching project based on the lerna.json "packages" config
|
// No matching project based on the lerna.json "packages" config
|
||||||
expect(
|
expect(
|
||||||
createNodes[1](
|
await createNodesV2[1](
|
||||||
'packages/framework-examples/package.json',
|
['packages/framework-examples/package.json'],
|
||||||
undefined,
|
undefined,
|
||||||
context
|
context
|
||||||
)
|
)
|
||||||
).toMatchInlineSnapshot(`{}`);
|
).toMatchInlineSnapshot(`[]`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('sibling project.json files', () => {
|
describe('sibling project.json files', () => {
|
||||||
it('should add a script target if the sibling project.json file does not exist', () => {
|
it('should add a script target if the sibling project.json file does not exist', async () => {
|
||||||
vol.fromJSON(
|
vol.fromJSON(
|
||||||
{
|
{
|
||||||
'package.json': JSON.stringify({
|
'package.json': JSON.stringify({
|
||||||
@ -479,51 +509,57 @@ describe('nx package.json workspaces plugin', () => {
|
|||||||
'/root'
|
'/root'
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(createNodes[1]('packages/a/package.json', undefined, context))
|
expect(
|
||||||
.toMatchInlineSnapshot(`
|
await createNodesV2[1](['packages/a/package.json'], undefined, context)
|
||||||
{
|
).toMatchInlineSnapshot(`
|
||||||
"projects": {
|
[
|
||||||
"packages/a": {
|
[
|
||||||
"metadata": {
|
"packages/a/package.json",
|
||||||
"description": undefined,
|
{
|
||||||
"targetGroups": {
|
"projects": {
|
||||||
"NPM Scripts": [
|
"packages/a": {
|
||||||
"build",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"name": "root",
|
|
||||||
"root": "packages/a",
|
|
||||||
"sourceRoot": "packages/a",
|
|
||||||
"tags": [
|
|
||||||
"npm:public",
|
|
||||||
],
|
|
||||||
"targets": {
|
|
||||||
"build": {
|
|
||||||
"executor": "nx:run-script",
|
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"runCommand": "npm run build",
|
"description": undefined,
|
||||||
"scriptContent": "echo build",
|
"targetGroups": {
|
||||||
|
"NPM Scripts": [
|
||||||
|
"build",
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"options": {
|
"name": "root",
|
||||||
"script": "build",
|
"root": "packages/a",
|
||||||
},
|
"sourceRoot": "packages/a",
|
||||||
},
|
"tags": [
|
||||||
"nx-release-publish": {
|
"npm:public",
|
||||||
"dependsOn": [
|
|
||||||
"^nx-release-publish",
|
|
||||||
],
|
],
|
||||||
"executor": "@nx/js:release-publish",
|
"targets": {
|
||||||
"options": {},
|
"build": {
|
||||||
|
"executor": "nx:run-script",
|
||||||
|
"metadata": {
|
||||||
|
"runCommand": "npm run build",
|
||||||
|
"scriptContent": "echo build",
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"script": "build",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"nx-release-publish": {
|
||||||
|
"dependsOn": [
|
||||||
|
"^nx-release-publish",
|
||||||
|
],
|
||||||
|
"executor": "@nx/js:release-publish",
|
||||||
|
"options": {},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
}
|
]
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add a script target if the sibling project.json exists but does not have a conflicting target', () => {
|
it('should add a script target if the sibling project.json exists but does not have a conflicting target', async () => {
|
||||||
vol.fromJSON(
|
vol.fromJSON(
|
||||||
{
|
{
|
||||||
'package.json': JSON.stringify({
|
'package.json': JSON.stringify({
|
||||||
@ -547,51 +583,57 @@ describe('nx package.json workspaces plugin', () => {
|
|||||||
'/root'
|
'/root'
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(createNodes[1]('packages/a/package.json', undefined, context))
|
expect(
|
||||||
.toMatchInlineSnapshot(`
|
await createNodesV2[1](['packages/a/package.json'], undefined, context)
|
||||||
{
|
).toMatchInlineSnapshot(`
|
||||||
"projects": {
|
[
|
||||||
"packages/a": {
|
[
|
||||||
"metadata": {
|
"packages/a/package.json",
|
||||||
"description": undefined,
|
{
|
||||||
"targetGroups": {
|
"projects": {
|
||||||
"NPM Scripts": [
|
"packages/a": {
|
||||||
"build",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"name": "root",
|
|
||||||
"root": "packages/a",
|
|
||||||
"sourceRoot": "packages/a",
|
|
||||||
"tags": [
|
|
||||||
"npm:public",
|
|
||||||
],
|
|
||||||
"targets": {
|
|
||||||
"build": {
|
|
||||||
"executor": "nx:run-script",
|
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"runCommand": "npm run build",
|
"description": undefined,
|
||||||
"scriptContent": "echo build",
|
"targetGroups": {
|
||||||
|
"NPM Scripts": [
|
||||||
|
"build",
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"options": {
|
"name": "root",
|
||||||
"script": "build",
|
"root": "packages/a",
|
||||||
},
|
"sourceRoot": "packages/a",
|
||||||
},
|
"tags": [
|
||||||
"nx-release-publish": {
|
"npm:public",
|
||||||
"dependsOn": [
|
|
||||||
"^nx-release-publish",
|
|
||||||
],
|
],
|
||||||
"executor": "@nx/js:release-publish",
|
"targets": {
|
||||||
"options": {},
|
"build": {
|
||||||
|
"executor": "nx:run-script",
|
||||||
|
"metadata": {
|
||||||
|
"runCommand": "npm run build",
|
||||||
|
"scriptContent": "echo build",
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"script": "build",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"nx-release-publish": {
|
||||||
|
"dependsOn": [
|
||||||
|
"^nx-release-publish",
|
||||||
|
],
|
||||||
|
"executor": "@nx/js:release-publish",
|
||||||
|
"options": {},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
}
|
]
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not add a script target if the sibling project.json exists and has a conflicting target', () => {
|
it('should not add a script target if the sibling project.json exists and has a conflicting target', async () => {
|
||||||
vol.fromJSON(
|
vol.fromJSON(
|
||||||
{
|
{
|
||||||
'package.json': JSON.stringify({
|
'package.json': JSON.stringify({
|
||||||
@ -615,33 +657,39 @@ describe('nx package.json workspaces plugin', () => {
|
|||||||
'/root'
|
'/root'
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(createNodes[1]('packages/a/package.json', undefined, context))
|
expect(
|
||||||
.toMatchInlineSnapshot(`
|
await createNodesV2[1](['packages/a/package.json'], undefined, context)
|
||||||
{
|
).toMatchInlineSnapshot(`
|
||||||
"projects": {
|
[
|
||||||
"packages/a": {
|
[
|
||||||
"metadata": {
|
"packages/a/package.json",
|
||||||
"description": undefined,
|
{
|
||||||
"targetGroups": {},
|
"projects": {
|
||||||
},
|
"packages/a": {
|
||||||
"name": "root",
|
"metadata": {
|
||||||
"root": "packages/a",
|
"description": undefined,
|
||||||
"sourceRoot": "packages/a",
|
"targetGroups": {},
|
||||||
"tags": [
|
},
|
||||||
"npm:public",
|
"name": "root",
|
||||||
],
|
"root": "packages/a",
|
||||||
"targets": {
|
"sourceRoot": "packages/a",
|
||||||
"nx-release-publish": {
|
"tags": [
|
||||||
"dependsOn": [
|
"npm:public",
|
||||||
"^nx-release-publish",
|
|
||||||
],
|
],
|
||||||
"executor": "@nx/js:release-publish",
|
"targets": {
|
||||||
"options": {},
|
"nx-release-publish": {
|
||||||
|
"dependsOn": [
|
||||||
|
"^nx-release-publish",
|
||||||
|
],
|
||||||
|
"executor": "@nx/js:release-publish",
|
||||||
|
"options": {},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
}
|
]
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -16,22 +16,71 @@ import {
|
|||||||
readTargetsFromPackageJson,
|
readTargetsFromPackageJson,
|
||||||
} from '../../utils/package-json';
|
} from '../../utils/package-json';
|
||||||
import { joinPathFragments } from '../../utils/path';
|
import { joinPathFragments } from '../../utils/path';
|
||||||
import { CreateNodes } from '../../project-graph/plugins';
|
import {
|
||||||
|
createNodesFromFiles,
|
||||||
|
CreateNodesV2,
|
||||||
|
} from '../../project-graph/plugins';
|
||||||
|
import { basename } from 'path';
|
||||||
|
|
||||||
export const createNodes: CreateNodes = [
|
export const createNodesV2: CreateNodesV2 = [
|
||||||
combineGlobPatterns('package.json', '**/package.json'),
|
combineGlobPatterns(
|
||||||
(p, _, { workspaceRoot }) => {
|
'package.json',
|
||||||
const readJson = (f) => readJsonFile(join(workspaceRoot, f));
|
'**/package.json',
|
||||||
const matcher = buildPackageJsonWorkspacesMatcher(workspaceRoot, readJson);
|
'project.json',
|
||||||
|
'**/project.json'
|
||||||
|
),
|
||||||
|
(configFiles, _, context) => {
|
||||||
|
const { packageJsons, projectJsonRoots } = splitConfigFiles(configFiles);
|
||||||
|
|
||||||
if (matcher(p)) {
|
const readJson = (f) => readJsonFile(join(context.workspaceRoot, f));
|
||||||
return createNodeFromPackageJson(p, workspaceRoot);
|
const isInPackageJsonWorkspaces = buildPackageJsonWorkspacesMatcher(
|
||||||
}
|
context.workspaceRoot,
|
||||||
// The given package.json is not part of the workspaces configuration.
|
readJson
|
||||||
return {};
|
);
|
||||||
|
const isNextToProjectJson = (packageJsonPath: string) => {
|
||||||
|
return projectJsonRoots.has(dirname(packageJsonPath));
|
||||||
|
};
|
||||||
|
|
||||||
|
return createNodesFromFiles(
|
||||||
|
(packageJsonPath, options, context) => {
|
||||||
|
if (
|
||||||
|
!isInPackageJsonWorkspaces(packageJsonPath) &&
|
||||||
|
!isNextToProjectJson(packageJsonPath)
|
||||||
|
) {
|
||||||
|
// Skip if package.json is not part of the package.json workspaces and not next to a project.json.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return createNodeFromPackageJson(
|
||||||
|
packageJsonPath,
|
||||||
|
context.workspaceRoot
|
||||||
|
);
|
||||||
|
},
|
||||||
|
packageJsons,
|
||||||
|
_,
|
||||||
|
context
|
||||||
|
);
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
function splitConfigFiles(configFiles: readonly string[]): {
|
||||||
|
packageJsons: string[];
|
||||||
|
projectJsonRoots: Set<string>;
|
||||||
|
} {
|
||||||
|
const packageJsons = [];
|
||||||
|
const projectJsonRoots = new Set<string>();
|
||||||
|
|
||||||
|
for (const configFile of configFiles) {
|
||||||
|
if (basename(configFile) === 'package.json') {
|
||||||
|
packageJsons.push(configFile);
|
||||||
|
} else {
|
||||||
|
projectJsonRoots.add(dirname(configFile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { packageJsons, projectJsonRoots };
|
||||||
|
}
|
||||||
|
|
||||||
export function buildPackageJsonWorkspacesMatcher(
|
export function buildPackageJsonWorkspacesMatcher(
|
||||||
workspaceRoot: string,
|
workspaceRoot: string,
|
||||||
readJson: (string) => any
|
readJson: (string) => any
|
||||||
2
packages/nx/src/plugins/package-json/index.ts
Normal file
2
packages/nx/src/plugins/package-json/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from './create-nodes';
|
||||||
|
export const name = 'nx/core/package-json';
|
||||||
@ -1,126 +0,0 @@
|
|||||||
import * as memfs from 'memfs';
|
|
||||||
|
|
||||||
import '../../../internal-testing-utils/mock-fs';
|
|
||||||
|
|
||||||
import { PackageJsonProjectsNextToProjectJsonPlugin } from './package-json-next-to-project-json';
|
|
||||||
import { CreateNodesContext } from '../../../project-graph/plugins';
|
|
||||||
const { createNodes } = PackageJsonProjectsNextToProjectJsonPlugin;
|
|
||||||
|
|
||||||
describe('nx project.json plugin', () => {
|
|
||||||
let context: CreateNodesContext;
|
|
||||||
let createNodesFunction = createNodes[1];
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
context = {
|
|
||||||
nxJsonConfiguration: {},
|
|
||||||
workspaceRoot: '/root',
|
|
||||||
configFiles: [],
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should build projects from package.json next to project.json', () => {
|
|
||||||
memfs.vol.fromJSON(
|
|
||||||
{
|
|
||||||
'package.json': JSON.stringify({
|
|
||||||
name: 'lib-a',
|
|
||||||
description: 'lib-a project description',
|
|
||||||
}),
|
|
||||||
'packages/lib-a/project.json': JSON.stringify({
|
|
||||||
name: 'lib-a',
|
|
||||||
description: 'lib-a project description',
|
|
||||||
targets: {
|
|
||||||
build: {
|
|
||||||
executor: 'nx:run-commands',
|
|
||||||
options: {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
'packages/lib-a/package.json': JSON.stringify({
|
|
||||||
name: 'lib-a',
|
|
||||||
description: 'lib-a package description',
|
|
||||||
scripts: {
|
|
||||||
test: 'jest',
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
'/root'
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(
|
|
||||||
createNodesFunction('packages/lib-a/project.json', undefined, context)
|
|
||||||
).toMatchInlineSnapshot(`
|
|
||||||
{
|
|
||||||
"projects": {
|
|
||||||
"lib-a": {
|
|
||||||
"metadata": {
|
|
||||||
"description": "lib-a package description",
|
|
||||||
"targetGroups": {
|
|
||||||
"NPM Scripts": [
|
|
||||||
"test",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"name": "lib-a",
|
|
||||||
"root": "packages/lib-a",
|
|
||||||
"tags": [
|
|
||||||
"npm:public",
|
|
||||||
],
|
|
||||||
"targets": {
|
|
||||||
"nx-release-publish": {
|
|
||||||
"dependsOn": [
|
|
||||||
"^nx-release-publish",
|
|
||||||
],
|
|
||||||
"executor": "@nx/js:release-publish",
|
|
||||||
"options": {},
|
|
||||||
},
|
|
||||||
"test": {
|
|
||||||
"executor": "nx:run-script",
|
|
||||||
"metadata": {
|
|
||||||
"runCommand": "npm run test",
|
|
||||||
"scriptContent": "jest",
|
|
||||||
},
|
|
||||||
"options": {
|
|
||||||
"script": "test",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
`);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not build package manager workspace projects from package.json next to project.json', () => {
|
|
||||||
memfs.vol.fromJSON(
|
|
||||||
{
|
|
||||||
'package.json': JSON.stringify({
|
|
||||||
name: 'lib-a',
|
|
||||||
description: 'lib-a project description',
|
|
||||||
workspaces: ['packages/lib-a'],
|
|
||||||
}),
|
|
||||||
'packages/lib-a/project.json': JSON.stringify({
|
|
||||||
name: 'lib-a',
|
|
||||||
description: 'lib-a project description',
|
|
||||||
targets: {
|
|
||||||
build: {
|
|
||||||
executor: 'nx:run-commands',
|
|
||||||
options: {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
'packages/lib-a/package.json': JSON.stringify({
|
|
||||||
name: 'lib-a',
|
|
||||||
description: 'lib-a package description',
|
|
||||||
scripts: {
|
|
||||||
test: 'jest',
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
'/root'
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(
|
|
||||||
createNodesFunction('packages/lib-a/project.json', undefined, context)
|
|
||||||
).toMatchInlineSnapshot(`{}`);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -1,75 +0,0 @@
|
|||||||
import { dirname, join } from 'path';
|
|
||||||
import { existsSync } from 'fs';
|
|
||||||
import { NxPluginV2 } from '../../../project-graph/plugins';
|
|
||||||
import { readJsonFile } from '../../../utils/fileutils';
|
|
||||||
import { ProjectConfiguration } from '../../../config/workspace-json-project-json';
|
|
||||||
import {
|
|
||||||
PackageJson,
|
|
||||||
getMetadataFromPackageJson,
|
|
||||||
getTagsFromPackageJson,
|
|
||||||
readTargetsFromPackageJson,
|
|
||||||
} from '../../../utils/package-json';
|
|
||||||
import { buildPackageJsonWorkspacesMatcher } from '../../package-json-workspaces';
|
|
||||||
|
|
||||||
// TODO: Remove this one day, this should not need to be done.
|
|
||||||
|
|
||||||
export const PackageJsonProjectsNextToProjectJsonPlugin: NxPluginV2 = {
|
|
||||||
// Its not a problem if plugins happen to have same name, and this
|
|
||||||
// will look least confusing in the source map.
|
|
||||||
name: 'nx/core/package-json',
|
|
||||||
createNodes: [
|
|
||||||
'{project.json,**/project.json}',
|
|
||||||
(file, _, { workspaceRoot }) => {
|
|
||||||
const project = createProjectFromPackageJsonNextToProjectJson(
|
|
||||||
file,
|
|
||||||
workspaceRoot
|
|
||||||
);
|
|
||||||
|
|
||||||
return project
|
|
||||||
? {
|
|
||||||
projects: {
|
|
||||||
[project.name]: project,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
: {};
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
export default PackageJsonProjectsNextToProjectJsonPlugin;
|
|
||||||
|
|
||||||
function createProjectFromPackageJsonNextToProjectJson(
|
|
||||||
projectJsonPath: string,
|
|
||||||
workspaceRoot: string
|
|
||||||
): ProjectConfiguration | null {
|
|
||||||
const root = dirname(projectJsonPath);
|
|
||||||
const relativePackageJsonPath = join(root, 'package.json');
|
|
||||||
const packageJsonPath = join(workspaceRoot, relativePackageJsonPath);
|
|
||||||
const readJson = (f) => readJsonFile(join(workspaceRoot, f));
|
|
||||||
|
|
||||||
// Do not create projects for package.json files
|
|
||||||
// that are part of the package manager workspaces
|
|
||||||
// Those package.json files will be processed later on
|
|
||||||
const matcher = buildPackageJsonWorkspacesMatcher(workspaceRoot, readJson);
|
|
||||||
|
|
||||||
if (!existsSync(packageJsonPath) || matcher(relativePackageJsonPath)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const packageJson: PackageJson = readJsonFile(packageJsonPath);
|
|
||||||
|
|
||||||
let { nx, name } = packageJson;
|
|
||||||
|
|
||||||
return {
|
|
||||||
...nx,
|
|
||||||
name,
|
|
||||||
root,
|
|
||||||
targets: readTargetsFromPackageJson(packageJson),
|
|
||||||
metadata: getMetadataFromPackageJson(packageJson),
|
|
||||||
tags: getTagsFromPackageJson(packageJson),
|
|
||||||
} as ProjectConfiguration;
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -4,7 +4,7 @@ import '../../../internal-testing-utils/mock-fs';
|
|||||||
|
|
||||||
import { ProjectJsonProjectsPlugin } from './project-json';
|
import { ProjectJsonProjectsPlugin } from './project-json';
|
||||||
import { CreateNodesContext } from '../../../project-graph/plugins';
|
import { CreateNodesContext } from '../../../project-graph/plugins';
|
||||||
const { createNodes } = ProjectJsonProjectsPlugin;
|
const { createNodesV2 } = ProjectJsonProjectsPlugin;
|
||||||
|
|
||||||
describe('nx project.json plugin', () => {
|
describe('nx project.json plugin', () => {
|
||||||
let context: CreateNodesContext;
|
let context: CreateNodesContext;
|
||||||
@ -16,7 +16,7 @@ describe('nx project.json plugin', () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should build projects from project.json', () => {
|
it('should build projects from project.json', async () => {
|
||||||
memfs.vol.fromJSON(
|
memfs.vol.fromJSON(
|
||||||
{
|
{
|
||||||
'project.json': JSON.stringify({
|
'project.json': JSON.stringify({
|
||||||
@ -36,36 +36,46 @@ describe('nx project.json plugin', () => {
|
|||||||
'/root'
|
'/root'
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(createNodes[1]('project.json', undefined, context))
|
expect(
|
||||||
.toMatchInlineSnapshot(`
|
await createNodesV2[1](
|
||||||
{
|
['project.json', 'packages/lib-a/project.json'],
|
||||||
"projects": {
|
undefined,
|
||||||
".": {
|
context
|
||||||
"name": "root",
|
)
|
||||||
"root": ".",
|
).toMatchInlineSnapshot(`
|
||||||
"targets": {
|
[
|
||||||
"command": "echo root project",
|
[
|
||||||
},
|
"project.json",
|
||||||
},
|
{
|
||||||
},
|
"projects": {
|
||||||
}
|
".": {
|
||||||
`);
|
"name": "root",
|
||||||
expect(createNodes[1]('packages/lib-a/project.json', undefined, context))
|
"root": ".",
|
||||||
.toMatchInlineSnapshot(`
|
"targets": {
|
||||||
{
|
"command": "echo root project",
|
||||||
"projects": {
|
},
|
||||||
"packages/lib-a": {
|
|
||||||
"name": "lib-a",
|
|
||||||
"root": "packages/lib-a",
|
|
||||||
"targets": {
|
|
||||||
"build": {
|
|
||||||
"executor": "nx:run-commands",
|
|
||||||
"options": {},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
}
|
[
|
||||||
|
"packages/lib-a/project.json",
|
||||||
|
{
|
||||||
|
"projects": {
|
||||||
|
"packages/lib-a": {
|
||||||
|
"name": "lib-a",
|
||||||
|
"root": "packages/lib-a",
|
||||||
|
"targets": {
|
||||||
|
"build": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
]
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,25 +3,35 @@ import { dirname, join } from 'node:path';
|
|||||||
import { ProjectConfiguration } from '../../../config/workspace-json-project-json';
|
import { ProjectConfiguration } from '../../../config/workspace-json-project-json';
|
||||||
import { toProjectName } from '../../../config/to-project-name';
|
import { toProjectName } from '../../../config/to-project-name';
|
||||||
import { readJsonFile } from '../../../utils/fileutils';
|
import { readJsonFile } from '../../../utils/fileutils';
|
||||||
import { NxPluginV2 } from '../../../project-graph/plugins';
|
import {
|
||||||
|
createNodesFromFiles,
|
||||||
|
NxPluginV2,
|
||||||
|
} from '../../../project-graph/plugins';
|
||||||
import { PackageJson } from '../../../utils/package-json';
|
import { PackageJson } from '../../../utils/package-json';
|
||||||
|
|
||||||
export const ProjectJsonProjectsPlugin: NxPluginV2 = {
|
export const ProjectJsonProjectsPlugin: NxPluginV2 = {
|
||||||
name: 'nx/core/project-json',
|
name: 'nx/core/project-json',
|
||||||
createNodes: [
|
createNodesV2: [
|
||||||
'{project.json,**/project.json}',
|
'{project.json,**/project.json}',
|
||||||
(file, _, { workspaceRoot }) => {
|
(configFiles, _, context) => {
|
||||||
const json = readJsonFile<ProjectConfiguration>(
|
return createNodesFromFiles(
|
||||||
join(workspaceRoot, file)
|
(file) => {
|
||||||
);
|
const json = readJsonFile<ProjectConfiguration>(
|
||||||
|
join(context.workspaceRoot, file)
|
||||||
|
);
|
||||||
|
|
||||||
const project = buildProjectFromProjectJson(json, file);
|
const project = buildProjectFromProjectJson(json, file);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
projects: {
|
projects: {
|
||||||
[project.root]: project,
|
[project.root]: project,
|
||||||
|
},
|
||||||
|
};
|
||||||
},
|
},
|
||||||
};
|
configFiles,
|
||||||
|
_,
|
||||||
|
context
|
||||||
|
);
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@ -24,7 +24,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
buildProjectConfigurationFromPackageJson,
|
buildProjectConfigurationFromPackageJson,
|
||||||
getGlobPatternsFromPackageManagerWorkspaces,
|
getGlobPatternsFromPackageManagerWorkspaces,
|
||||||
} from '../plugins/package-json-workspaces';
|
} from '../plugins/package-json';
|
||||||
import { globWithWorkspaceContextSync } from '../utils/workspace-context';
|
import { globWithWorkspaceContextSync } from '../utils/workspace-context';
|
||||||
import { buildProjectFromProjectJson } from '../plugins/project-json/build-nodes/project-json';
|
import { buildProjectFromProjectJson } from '../plugins/project-json/build-nodes/project-json';
|
||||||
import { PackageJson } from '../utils/package-json';
|
import { PackageJson } from '../utils/package-json';
|
||||||
|
|||||||
@ -192,12 +192,6 @@ async function normalizePlugins(plugins: PluginConfiguration[], root: string) {
|
|||||||
plugins ??= [];
|
plugins ??= [];
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// This plugin adds targets that we want to be able to overwrite
|
|
||||||
// in any user-land plugin, so it has to be first :).
|
|
||||||
join(
|
|
||||||
__dirname,
|
|
||||||
'../../plugins/project-json/build-nodes/package-json-next-to-project-json'
|
|
||||||
),
|
|
||||||
...plugins,
|
...plugins,
|
||||||
// Most of the nx core node plugins go on the end, s.t. it overwrites any other plugins
|
// Most of the nx core node plugins go on the end, s.t. it overwrites any other plugins
|
||||||
...(await getDefaultPlugins(root)),
|
...(await getDefaultPlugins(root)),
|
||||||
@ -210,7 +204,7 @@ export async function getDefaultPlugins(root: string) {
|
|||||||
...(shouldMergeAngularProjects(root, false)
|
...(shouldMergeAngularProjects(root, false)
|
||||||
? [join(__dirname, '../../adapter/angular-json')]
|
? [join(__dirname, '../../adapter/angular-json')]
|
||||||
: []),
|
: []),
|
||||||
join(__dirname, '../../plugins/package-json-workspaces'),
|
join(__dirname, '../../plugins/package-json'),
|
||||||
join(__dirname, '../../plugins/project-json/build-nodes/project-json'),
|
join(__dirname, '../../plugins/project-json/build-nodes/project-json'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -293,7 +293,9 @@ async function importPluginModule(pluginPath: string): Promise<NxPlugin> {
|
|||||||
const m = await import(pluginPath);
|
const m = await import(pluginPath);
|
||||||
if (
|
if (
|
||||||
m.default &&
|
m.default &&
|
||||||
('createNodes' in m.default || 'createDependencies' in m.default)
|
('createNodes' in m.default ||
|
||||||
|
'createNodesV2' in m.default ||
|
||||||
|
'createDependencies' in m.default)
|
||||||
) {
|
) {
|
||||||
return m.default;
|
return m.default;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -183,4 +183,18 @@ describe('createNodesFromFiles', () => {
|
|||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should filter out null results', async () => {
|
||||||
|
const createNodes = [
|
||||||
|
'**/*',
|
||||||
|
() => {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
] as const;
|
||||||
|
const options = {};
|
||||||
|
|
||||||
|
expect(
|
||||||
|
await createNodesFromFiles(createNodes[1], configFiles, options, context)
|
||||||
|
).toEqual([]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -73,7 +73,9 @@ export async function createNodesFromFiles<T = unknown>(
|
|||||||
...context,
|
...context,
|
||||||
configFiles,
|
configFiles,
|
||||||
});
|
});
|
||||||
results.push([file, value] as const);
|
if (value) {
|
||||||
|
results.push([file, value] as const);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
errors.push([file, e] as const);
|
errors.push([file, e] as const);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { shouldMergeAngularProjects } from '../adapter/angular-json';
|
|||||||
import { ProjectGraphProcessor } from '../config/project-graph';
|
import { ProjectGraphProcessor } from '../config/project-graph';
|
||||||
import { TargetConfiguration } from '../config/workspace-json-project-json';
|
import { TargetConfiguration } from '../config/workspace-json-project-json';
|
||||||
import ProjectJsonProjectsPlugin from '../plugins/project-json/build-nodes/project-json';
|
import ProjectJsonProjectsPlugin from '../plugins/project-json/build-nodes/project-json';
|
||||||
import * as PackageJsonWorkspacesPlugin from '../plugins/package-json-workspaces';
|
import * as PackageJsonWorkspacesPlugin from '../plugins/package-json';
|
||||||
import { NxPluginV2 } from '../project-graph/plugins';
|
import { NxPluginV2 } from '../project-graph/plugins';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user