Skip to content

Commit

Permalink
feat(core): create tool manifest during init
Browse files Browse the repository at this point in the history
Create the manifest file so future generators can install local tools

Fixes #44
  • Loading branch information
Ben Callaghan committed May 18, 2021
1 parent d02b0b7 commit 996aaee
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/core/src/generators/init/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import {
WorkspaceConfiguration,
writeJson,
} from '@nrwl/devkit';
import { DotNetClient, dotnetFactory } from '@nx-dotnet/dotnet';

import { CONFIG_FILE_PATH, NxDotnetConfig } from '@nx-dotnet/utils';

export default async function (host: Tree) {
export default async function (
host: Tree,
dotnetClient = new DotNetClient(dotnetFactory()),
) {
const initialized = host.isFile(CONFIG_FILE_PATH);

const configObject: NxDotnetConfig = initialized
Expand All @@ -26,6 +30,8 @@ export default async function (host: Tree) {
if (!initialized) {
updateGitIgnore(host, readWorkspaceConfiguration(host));
}

initToolManifest(host, dotnetClient);
}

function updateGitIgnore(
Expand Down Expand Up @@ -59,3 +65,11 @@ function updateNxJson(host: Tree) {
}
writeJson(host, 'nx.json', nxJson);
}

function initToolManifest(host: Tree, dotnetClient: DotNetClient) {
const initialized = host.exists('.config/dotnet-tools.json');
if (!initialized) {
console.log('Tool Manifest created for managing local .NET tools');
dotnetClient.new('tool-manifest');
}
}

0 comments on commit 996aaee

Please sign in to comment.