Skip to content

Commit

Permalink
chore(repo): docs + format
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Mar 26, 2024
1 parent 0e7232d commit 057d270
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 35 deletions.
2 changes: 1 addition & 1 deletion docs/generated/devkit/CreateNodes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Type alias: CreateNodes\<T\>

Ƭ **CreateNodes**\<`T`\>: readonly [configFilePattern: string, createNodesFunction: CreateNodesFunction\<T\>]
Ƭ **CreateNodes**\<`T`\>: readonly [projectFilePattern: string, createNodesFunction: CreateNodesFunction\<T\>]

A pair of file patterns and [CreateNodesFunction](../../devkit/documents/CreateNodesFunction)

Expand Down
12 changes: 12 additions & 0 deletions docs/generated/devkit/ExpandedPluginConfiguration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Type alias: ExpandedPluginConfiguration

Ƭ **ExpandedPluginConfiguration**: `Object`

#### Type declaration

| Name | Type |
| :--------- | :--------- |
| `exclude?` | `string`[] |
| `include?` | `string`[] |
| `options?` | `unknown` |
| `plugin` | `string` |
2 changes: 1 addition & 1 deletion docs/generated/devkit/PluginConfiguration.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Type alias: PluginConfiguration

Ƭ **PluginConfiguration**: `string` \| \{ `exclude?`: `string`[] ; `include?`: `string`[] ; `options?`: `unknown` ; `plugin`: `string` }
Ƭ **PluginConfiguration**: `string` \| [`ExpandedPluginConfiguration`](../../devkit/documents/ExpandedPluginConfiguration)
1 change: 1 addition & 0 deletions docs/generated/devkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ It only uses language primitives and immutable objects
- [CustomHasher](../../devkit/documents/CustomHasher)
- [DynamicDependency](../../devkit/documents/DynamicDependency)
- [Executor](../../devkit/documents/Executor)
- [ExpandedPluginConfiguration](../../devkit/documents/ExpandedPluginConfiguration)
- [Generator](../../devkit/documents/Generator)
- [GeneratorCallback](../../devkit/documents/GeneratorCallback)
- [Hasher](../../devkit/documents/Hasher)
Expand Down
1 change: 1 addition & 0 deletions docs/generated/packages/devkit/documents/nx_devkit.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ It only uses language primitives and immutable objects
- [CustomHasher](../../devkit/documents/CustomHasher)
- [DynamicDependency](../../devkit/documents/DynamicDependency)
- [Executor](../../devkit/documents/Executor)
- [ExpandedPluginConfiguration](../../devkit/documents/ExpandedPluginConfiguration)
- [Generator](../../devkit/documents/Generator)
- [GeneratorCallback](../../devkit/documents/GeneratorCallback)
- [Hasher](../../devkit/documents/Hasher)
Expand Down
4 changes: 1 addition & 3 deletions packages/nx/src/config/nx-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,7 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
useInferencePlugins?: boolean;
}

export type PluginConfiguration =
| string
| ExpandedPluginConfiguration;
export type PluginConfiguration = string | ExpandedPluginConfiguration;

export type ExpandedPluginConfiguration = {
plugin: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ import { workspaceRoot } from '../../utils/workspace-root';
import { notifyFileWatcherSockets } from './file-watching/file-watcher-sockets';
import { serverLogger } from './logger';
import { NxWorkspaceFilesExternals } from '../../native';
import {
ConfigurationResult,
} from '../../project-graph/utils/project-configuration-utils';
import { ConfigurationResult } from '../../project-graph/utils/project-configuration-utils';
import { DaemonProjectGraphError } from '../daemon-project-graph-error';
import { LoadedNxPlugin } from '../../project-graph/plugins/internal-api';
import { getPlugins } from './plugins';
Expand Down
8 changes: 4 additions & 4 deletions packages/nx/src/migrations/update-15-1-0/set-project-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { loadNxPlugins } from '../../project-graph/plugins/internal-api';

export default async function (tree: Tree) {
const nxJson = readNxJson(tree);
const [plugins, cleanup] = (await loadNxPlugins(nxJson?.plugins ?? [], tree.root))
const projectFiles = retrieveProjectConfigurationPaths(
tree.root,
plugins
const [plugins, cleanup] = await loadNxPlugins(
nxJson?.plugins ?? [],
tree.root
);
const projectFiles = retrieveProjectConfigurationPaths(tree.root, plugins);
const projectJsons = projectFiles.filter((f) => f.endsWith('project.json'));

for (let f of projectJsons) {
Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/plugins/target-defaults/symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export const ONLY_MODIFIES_EXISTING_TARGET = 'NX_ONLY_MODIFIES_EXISTING_TARGET';
* NOTE: This cannot be a symbol, as they are not serialized in JSON the communication
* between the plugin-worker and the main process.
*/
export const OVERRIDE_SOURCE_FILE = 'NX_OVERRIDE_SOURCE_FILE';
export const OVERRIDE_SOURCE_FILE = 'NX_OVERRIDE_SOURCE_FILE';
2 changes: 1 addition & 1 deletion packages/nx/src/project-graph/error-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ export function isMergeNodesError(e: unknown): e is MergeNodesError {
'name' in e &&
e?.name === MergeNodesError.prototype.name)
);
}
}
14 changes: 9 additions & 5 deletions packages/nx/src/project-graph/file-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,15 @@ function getProjectsSyncNoInference(root: string, nxJson: NxJsonConfiguration) {
);
for (const file of matchingConfigFiles) {
if (minimatch(file, pattern, { dot: true })) {
let r = createNodes(file, {}, {
nxJsonConfiguration: nxJson,
workspaceRoot: root,
configFiles: matchingConfigFiles,
}) as CreateNodesResult;
let r = createNodes(
file,
{},
{
nxJsonConfiguration: nxJson,
workspaceRoot: root,
configFiles: matchingConfigFiles,
}
) as CreateNodesResult;
for (const node in r.projects) {
const project = {
root: node,
Expand Down
5 changes: 1 addition & 4 deletions packages/nx/src/project-graph/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
export * from './public-api';

export {
readPluginPackageJson,
registerPluginTSTranspiler,
} from './loader';
export { readPluginPackageJson, registerPluginTSTranspiler } from './loader';
4 changes: 3 additions & 1 deletion packages/nx/src/project-graph/plugins/internal-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ export async function loadNxPlugins(
? loadNxPluginInIsolation
: loadNxPlugin;

console.log(loadingMethod === loadNxPluginInIsolation ? 'isolated' : 'not isolated')
console.log(
loadingMethod === loadNxPluginInIsolation ? 'isolated' : 'not isolated'
);

plugins = await normalizePlugins(plugins, root);

Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/project-graph/plugins/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface CreateNodesContext {
/**
* The subset of configuration files which match the createNodes pattern
*/
readonly configFiles: string[];
readonly configFiles: string[];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/project-graph/plugins/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export async function runCreateNodesInParallel(
console.log('FINDING NODES', {
plugin: plugin.name,
configFiles,
})
});

const promises: Array<
CreateNodesResultWithContext | Promise<CreateNodesResultWithContext>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,15 +353,14 @@ export async function createProjectConfigurations(
nxJsonConfiguration: nxJson,
workspaceRoot: root,
configFiles: matchingConfigFiles,
})
.catch((e) => {
if (isAggregateCreateNodesError(e)) {
errors.push(...e.errors);
return e.partialResults;
} else {
throw e;
}
});
}).catch((e) => {
if (isAggregateCreateNodesError(e)) {
errors.push(...e.errors);
return e.partialResults;
} else {
throw e;
}
});

results.push(r);
}
Expand Down

0 comments on commit 057d270

Please sign in to comment.