MCPcopy Index your code
hub / github.com/code-pushup/cli / registerPluginInWorkspace

Function registerPluginInWorkspace

testing/test-nx-utils/src/lib/utils/nx.ts:65–92  ·  view source on GitHub ↗
(
  tree: Tree,
  configuration: PluginConfiguration,
  pluginConfig?: Record<string, unknown>,
)

Source from the content-addressed store, hash-verified

63}
64
65export function registerPluginInWorkspace(
66 tree: Tree,
67 configuration: PluginConfiguration,
68 pluginConfig?: Record<string, unknown>,
69) {
70 const normalizedPluginConfiguration =
71 typeof configuration === 'string'
72 ? {
73 plugin: configuration,
74 }
75 : configuration;
76
77 const pluginName =
78 typeof configuration === 'string' ? configuration : configuration.plugin;
79
80 updateJson(tree, 'nx.json', (json: NxJsonConfiguration) => ({
81 ...json,
82 plugins: [...(json.plugins ?? []), normalizedPluginConfiguration],
83 ...(pluginConfig
84 ? {
85 pluginsConfig: {
86 ...json.pluginsConfig,
87 [pluginName]: pluginConfig,
88 },
89 }
90 : {}),
91 }));
92}
93
94export async function nxShowProjectJson<T extends ProjectConfiguration>(
95 cwd: string,

Calls

no outgoing calls

Tested by

no test coverage detected