@nx-dotnet/core
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -5,2 +5,9 @@ { | ||
"build": { | ||
"implementation": "./src/executors/build/builder", | ||
"schema": "./src/executors/build/schema.json", | ||
"description": "build executor" | ||
} | ||
}, | ||
"builders": { | ||
"build": { | ||
"implementation": "./src/executors/build/executor", | ||
@@ -7,0 +14,0 @@ "schema": "./src/executors/build/schema.json", |
@@ -15,4 +15,9 @@ { | ||
"description": "Generate a new C# project." | ||
}, | ||
"project-reference": { | ||
"factory": "./src/generators/project-reference/generator", | ||
"schema": "./src/generators/project-reference/schema.json", | ||
"description": "Adds a reference from one project to another." | ||
} | ||
} | ||
} |
{ | ||
"name": "@nx-dotnet/core", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main": "src/index.js", | ||
"generators": "./generators.json", | ||
"executors": "./executors.json", | ||
"builders": "./executors.json", | ||
"private": false, | ||
"typings": "src/index.d.ts" | ||
} |
@@ -0,4 +1,5 @@ | ||
import { ExecutorContext } from '@nrwl/devkit'; | ||
import { BuildExecutorSchema } from './schema'; | ||
export default function runExecutor(options: BuildExecutorSchema): Promise<{ | ||
export default function runExecutor(options: BuildExecutorSchema, context: ExecutorContext): Promise<{ | ||
success: boolean; | ||
}>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
function runExecutor(options) { | ||
const execute_dotnet_1 = require("../utils/execute-dotnet"); | ||
function runExecutor(options, context) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
console.log('Executor ran for Build', options); | ||
return { | ||
success: true, | ||
const params = { | ||
'-c': options.configuration | ||
}; | ||
if (options.versionSuffix) { | ||
params['--version-suffix'] = options.versionSuffix; | ||
} | ||
if (options.framework) { | ||
params['-f'] = options.framework; | ||
} | ||
return execute_dotnet_1.ExecuteDotNet('build', context, params); | ||
}); | ||
@@ -11,0 +18,0 @@ } |
import { BuildExecutorSchema } from './schema'; | ||
import executor from './executor'; | ||
const options: BuildExecutorSchema = {}; | ||
const options: BuildExecutorSchema = { | ||
configuration: 'Debug' | ||
}; | ||
@@ -6,0 +8,0 @@ describe('Build Executor', () => { |
@@ -1,1 +0,5 @@ | ||
export interface BuildExecutorSchema {} // eslint-disable-line | ||
export interface BuildExecutorSchema { | ||
framework?: string; | ||
versionSuffix: number; | ||
configuration: 'Debug' | 'Release'; | ||
} |
@@ -7,4 +7,19 @@ { | ||
"type": "object", | ||
"properties": {}, | ||
"required": [] | ||
"properties": { | ||
"framework": { | ||
"type": "string", | ||
"description": "Compiles for a specific framework. The framework must be defined in the project file" | ||
}, | ||
"versionSuffix": { | ||
"type": "number", | ||
"description": "Sets the value of the $(VersionSuffix) property to use when building the project. This only works if the $(Version) property isn't set. Then, $(Version) is set to the $(VersionPrefix) combined with the $(VersionSuffix), separated by a dash." | ||
}, | ||
"configuration": { | ||
"type": "string", | ||
"enum": ["Debug", "Release"], | ||
"default": "Debug", | ||
"description": "Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project" | ||
} | ||
}, | ||
"required": ["configuration"] | ||
} |
@@ -5,3 +5,3 @@ "use strict"; | ||
const devkit_1 = require("@nrwl/devkit"); | ||
const child_process_1 = require("child_process"); | ||
const core_1 = require("../../core"); | ||
function normalizeOptions(host, options) { | ||
@@ -24,2 +24,3 @@ const name = devkit_1.names(options.name).fileName; | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const dotnetClient = new core_1.DotNetClient(core_1.dotnetFactory()); | ||
const normalizedOptions = normalizeOptions(host, options); | ||
@@ -29,3 +30,3 @@ devkit_1.addProjectConfiguration(host, normalizedOptions.projectName, { | ||
projectType: 'application', | ||
sourceRoot: `${normalizedOptions.projectRoot}/src`, | ||
sourceRoot: `${normalizedOptions.projectRoot}`, | ||
targets: { | ||
@@ -38,3 +39,16 @@ build: { | ||
}); | ||
child_process_1.execSync(`dotnet new ${normalizedOptions.template} --language ${normalizedOptions.language} --name ${normalizedOptions.projectName} --output ${normalizedOptions.projectRoot}`); | ||
dotnetClient.new(normalizedOptions.template, [ | ||
{ | ||
flag: 'language', | ||
value: normalizedOptions.language, | ||
}, | ||
{ | ||
flag: 'name', | ||
value: normalizedOptions.name, | ||
}, | ||
{ | ||
flag: 'output', | ||
value: normalizedOptions.projectRoot, | ||
}, | ||
]); | ||
yield devkit_1.formatFiles(host); | ||
@@ -41,0 +55,0 @@ }); |
@@ -6,3 +6,4 @@ import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; | ||
import { NxDotnetGeneratorSchema } from './schema'; | ||
import { rimraf } from '../shared'; | ||
import { rimraf } from '../../utils'; | ||
import { promises as fs } from 'fs'; | ||
@@ -23,3 +24,3 @@ describe('nx-dotnet app generator', () => { | ||
await rimraf('apps/test'); | ||
}) | ||
}); | ||
@@ -30,3 +31,5 @@ it('should run successfully', async () => { | ||
expect(config).toBeDefined(); | ||
const directoryCreated = await (await fs.stat(config.sourceRoot)).isDirectory(); | ||
expect(directoryCreated).toBeTruthy(); | ||
}); | ||
}); |
@@ -5,3 +5,3 @@ "use strict"; | ||
const devkit_1 = require("@nrwl/devkit"); | ||
const child_process_1 = require("child_process"); | ||
const core_1 = require("../../core"); | ||
function normalizeOptions(host, options) { | ||
@@ -25,6 +25,7 @@ const name = devkit_1.names(options.name).fileName; | ||
const normalizedOptions = normalizeOptions(host, options); | ||
const dotnetClient = new core_1.DotNetClient(core_1.dotnetFactory()); | ||
devkit_1.addProjectConfiguration(host, normalizedOptions.projectName, { | ||
root: normalizedOptions.projectRoot, | ||
projectType: 'library', | ||
sourceRoot: `${normalizedOptions.projectRoot}/src`, | ||
sourceRoot: `${normalizedOptions.projectRoot}`, | ||
targets: { | ||
@@ -37,3 +38,16 @@ build: { | ||
}); | ||
child_process_1.execSync(`dotnet new ${normalizedOptions.template} --language ${normalizedOptions.language} --name ${normalizedOptions.projectName} --output ${normalizedOptions.projectRoot}`); | ||
dotnetClient.new(normalizedOptions.template, [ | ||
{ | ||
flag: 'language', | ||
value: normalizedOptions.language, | ||
}, | ||
{ | ||
flag: 'name', | ||
value: normalizedOptions.name, | ||
}, | ||
{ | ||
flag: 'output', | ||
value: normalizedOptions.projectRoot, | ||
}, | ||
]); | ||
yield devkit_1.formatFiles(host); | ||
@@ -40,0 +54,0 @@ }); |
@@ -6,3 +6,3 @@ import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; | ||
import { NxDotnetGeneratorSchema } from './schema'; | ||
import { rimraf } from '../shared'; | ||
import { rimraf } from '../../utils'; | ||
@@ -9,0 +9,0 @@ describe('nx-dotnet library generator', () => { |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
40022
88
778
2
3