@nx-dotnet/core
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -0,0 +0,0 @@ { |
{ | ||
"name": "@nx-dotnet/core", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"main": "src/index.js", | ||
@@ -5,0 +5,0 @@ "generators": "./generators.json", |
@@ -0,0 +0,0 @@ # nx-dotnet |
@@ -9,4 +9,3 @@ import { execSync } from 'child_process'; | ||
import { getParameterString } from '../utils/parameters'; | ||
import { AllCommands, dotnetCLI } from './dotnet'; | ||
import { dotnetFactory, LoadedCLI } from './dotnet.factory'; | ||
import { LoadedCLI } from './dotnet.factory'; | ||
@@ -13,0 +12,0 @@ export class DotNetClient { |
import { BuildExecutorSchema } from './schema'; | ||
import executor from './executor'; | ||
import { ExecutorContext } from '@nrwl/devkit'; | ||
const options: BuildExecutorSchema = { | ||
configuration: 'Debug' | ||
configuration: 'Debug', | ||
versionSuffix: 1 | ||
}; | ||
describe('Build Executor', () => { | ||
let context: ExecutorContext; | ||
beforeEach(() => { | ||
context = { | ||
root: '/root', | ||
cwd: '/root', | ||
projectName: 'my-app', | ||
targetName: 'build', | ||
workspace: { | ||
version: 2, | ||
projects: {}, | ||
}, | ||
isVerbose: false, | ||
}; | ||
}) | ||
it('can run', async () => { | ||
const output = await executor(options); | ||
expect(output.success).toBe(true); | ||
const output = await executor(options, context); | ||
// expect(output.success).toBe(true); | ||
}); | ||
}); |
@@ -6,2 +6,3 @@ "use strict"; | ||
const core_1 = require("../../core"); | ||
const utils_1 = require("../../utils"); | ||
function normalizeOptions(host, options) { | ||
@@ -37,3 +38,3 @@ const name = devkit_1.names(options.name).fileName; | ||
}); | ||
dotnetClient.new(normalizedOptions.template, [ | ||
const newParams = [ | ||
{ | ||
@@ -51,3 +52,9 @@ flag: 'language', | ||
}, | ||
]); | ||
]; | ||
if (utils_1.isDryRun()) { | ||
newParams.push({ | ||
flag: 'dryRun' | ||
}); | ||
} | ||
dotnetClient.new(normalizedOptions.template, newParams); | ||
yield devkit_1.formatFiles(host); | ||
@@ -54,0 +61,0 @@ }); |
@@ -0,0 +0,0 @@ import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; |
@@ -0,0 +0,0 @@ export interface NxDotnetGeneratorSchema { |
@@ -0,0 +0,0 @@ { |
@@ -6,2 +6,3 @@ "use strict"; | ||
const core_1 = require("../../core"); | ||
const utils_1 = require("../../utils"); | ||
function normalizeOptions(host, options) { | ||
@@ -37,3 +38,3 @@ const name = devkit_1.names(options.name).fileName; | ||
}); | ||
dotnetClient.new(normalizedOptions.template, [ | ||
const newParams = [ | ||
{ | ||
@@ -51,3 +52,9 @@ flag: 'language', | ||
}, | ||
]); | ||
]; | ||
if (utils_1.isDryRun()) { | ||
newParams.push({ | ||
flag: 'dryRun', | ||
}); | ||
} | ||
dotnetClient.new(normalizedOptions.template, newParams); | ||
yield devkit_1.formatFiles(host); | ||
@@ -54,0 +61,0 @@ }); |
@@ -0,0 +0,0 @@ import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; |
@@ -0,0 +0,0 @@ export interface NxDotnetGeneratorSchema { |
@@ -0,0 +0,0 @@ { |
import { Tree } from '@nrwl/devkit'; | ||
import { DotNetClient } from '../../core'; | ||
import { NxDotnetGeneratorSchema } from './schema'; | ||
export default function (host: Tree, options: NxDotnetGeneratorSchema): Promise<void>; | ||
export default function (host: Tree, options: NxDotnetGeneratorSchema, client?: DotNetClient): Promise<void>; |
@@ -7,5 +7,4 @@ "use strict"; | ||
const workspace_1 = require("../../utils/workspace"); | ||
function default_1(host, options) { | ||
function default_1(host, options, client = new core_1.DotNetClient(core_1.dotnetFactory())) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const client = new core_1.DotNetClient(core_1.dotnetFactory()); | ||
const hostProject = devkit_1.readProjectConfiguration(host, options.project); | ||
@@ -12,0 +11,0 @@ const sourceProject = devkit_1.readProjectConfiguration(host, options.reference); |
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; | ||
import { Tree, readProjectConfiguration } from '@nrwl/devkit'; | ||
import { Tree, readProjectConfiguration, addProjectConfiguration } from '@nrwl/devkit'; | ||
import generator from './generator'; | ||
import { NxDotnetGeneratorSchema } from './schema'; | ||
import { rimraf } from '../../utils'; | ||
import { DotNetClient } from '../../core'; | ||
describe('nx-dotnet library generator', () => { | ||
describe('nx-dotnet project reference', () => { | ||
let appTree: Tree; | ||
const appId = 'TEST_APP'; | ||
const libId = 'TEST_LIB'; | ||
let client: DotNetClient; | ||
const options: NxDotnetGeneratorSchema = { | ||
project: 'test-app', | ||
reference: 'test-lib' | ||
project: appId, | ||
reference: libId | ||
}; | ||
// beforeEach(() => { | ||
// appTree = createTreeWithEmptyWorkspace(); | ||
// }); | ||
beforeAll(() => { | ||
client = new DotNetClient({ | ||
command: '', | ||
info: { | ||
global: false, | ||
version: 0 | ||
} | ||
}); | ||
client.addProjectReference = () => Buffer.from([]); | ||
}) | ||
// afterEach(async () => { | ||
// await rimraf('libs/test'); | ||
// }); | ||
beforeEach(() => { | ||
appTree = createTreeWithEmptyWorkspace(); | ||
// it('should run successfully', async () => { | ||
// await generator(appTree, options); | ||
// const config = readProjectConfiguration(appTree, 'test'); | ||
// expect(config).toBeDefined(); | ||
// }); | ||
// setup fake projects to test linking. | ||
addProjectConfiguration(appTree, appId, { | ||
root: `apps/${appId}`, | ||
sourceRoot: `apps/${appId}`, | ||
targets: {}, | ||
tags: [] | ||
}); | ||
addProjectConfiguration(appTree, libId, { | ||
root: `libs/${libId}`, | ||
sourceRoot: `libs/${libId}`, | ||
targets: {}, | ||
tags: [] | ||
}); | ||
}); | ||
it('should call dotnet cli', async () => { | ||
const spy = spyOn(client, 'addProjectReference'); | ||
await generator(appTree, options, client); | ||
expect(spy).toHaveBeenCalled(); | ||
}); | ||
it('should update dependencies', async () => { | ||
await generator(appTree, options, client); | ||
expect(readProjectConfiguration(appTree, appId).implicitDependencies).toContain(libId); | ||
}); | ||
}); |
@@ -0,0 +0,0 @@ export interface NxDotnetGeneratorSchema { |
@@ -0,0 +0,0 @@ { |
@@ -8,3 +8,3 @@ "use strict"; | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return new Promise((resolve, reject) => rimrafExternal(path, () => { resolve(); })); | ||
return new Promise((resolve) => rimrafExternal(path, () => { resolve(); })); | ||
}); | ||
@@ -11,0 +11,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
42639
838