Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nx-dotnet/core

Package Overview
Dependencies
Maintainers
1
Versions
230
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nx-dotnet/core - npm Package Compare versions

Comparing version 0.13.0 to 0.14.0

src/generators/test/generator.d.ts

6

CHANGELOG.md

@@ -0,1 +1,7 @@

# [0.14.0](https://github.com/nx-dotnet/nx-dotnet/compare/v0.13.0...v0.14.0) (2021-07-05)
### Features
- **core:** add test project generator ([#69](https://github.com/nx-dotnet/nx-dotnet/issues/69)) ([7f7084f](https://github.com/nx-dotnet/nx-dotnet/commit/7f7084f1c4809acf9278a8dafbf255ba34c5ab0b))
# [0.13.0](https://github.com/nx-dotnet/nx-dotnet/compare/v0.12.0...v0.13.0) (2021-06-23)

@@ -2,0 +8,0 @@

@@ -42,4 +42,9 @@ {

"description": "Restores NuGet packages and .NET tools used by the workspace"
},
"test": {
"factory": "./src/generators/test/generator",
"schema": "./src/generators/test/schema.json",
"description": "Generate a .NET test project for an existing application or library"
}
}
}

6

package.json

@@ -8,4 +8,4 @@ {

"dependencies": {
"@nx-dotnet/dotnet": "0.13.0",
"@nx-dotnet/utils": "0.13.0",
"@nx-dotnet/dotnet": "0.14.0",
"@nx-dotnet/utils": "0.14.0",
"glob": "^7.1.6",

@@ -23,3 +23,3 @@ "rimraf": "^3.0.2",

"license": "MIT",
"version": "0.13.0",
"version": "0.14.0",
"keywords": [

@@ -26,0 +26,0 @@ "Nx",

import { ProjectType, Tree } from '@nrwl/devkit';
import { DotNetClient } from '@nx-dotnet/dotnet';
import { NxDotnetProjectGeneratorSchema } from '../../models';
import { DotNetClient, dotnetNewOptions } from '@nx-dotnet/dotnet';
import { NxDotnetProjectGeneratorSchema, NxDotnetTestGeneratorSchema } from '../../models';
export interface NormalizedSchema extends NxDotnetProjectGeneratorSchema {
projectName: string;
projectRoot: string;
projectDirectory: string;
projectLanguage: string;
projectTemplate: string;
parsedTags: string[];
className: string;
namespaceName: string;
projectType: ProjectType;
}
export declare function normalizeOptions(host: Tree, options: NxDotnetProjectGeneratorSchema | NxDotnetTestGeneratorSchema, projectType?: ProjectType): NormalizedSchema;
export declare function SetOutputPath(host: Tree, projectRootPath: string, projectFilePath: string): void;
export declare function GenerateProject(host: Tree, options: NxDotnetProjectGeneratorSchema, dotnetClient: DotNetClient, projectType: ProjectType): Promise<void>;
export declare function addDryRunParameter(parameters: dotnetNewOptions): void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GenerateProject = void 0;
exports.addDryRunParameter = exports.GenerateProject = exports.SetOutputPath = exports.normalizeOptions = void 0;
const tslib_1 = require("tslib");

@@ -12,3 +12,21 @@ const devkit_1 = require("@nrwl/devkit");

const generator_1 = require("../init/generator");
const generate_test_project_1 = require("./generate-test-project");
function normalizeOptions(host, options, projectType) {
var _a;
if (!('name' in options)) {
// Reconstruct the original parameters as if the test project were generated at the same time as the target project.
const project = devkit_1.readProjectConfiguration(host, options.project);
const projectPaths = project.root.split('/');
const directory = projectPaths.slice(1, -1).join('/'); // The middle portions contain the original path.
const [name] = projectPaths.slice(-1); // The final folder contains the original name.
options = {
name,
language: options.language,
skipOutputPathManipulation: options.skipOutputPathManipulation,
testTemplate: options.testTemplate,
directory,
tags: (_a = project.tags) === null || _a === void 0 ? void 0 : _a.join(','),
};
projectType = project.projectType;
}
const name = devkit_1.names(options.name).fileName;

@@ -37,46 +55,5 @@ const className = devkit_1.names(options.name).className;

projectDirectory,
parsedTags, projectLanguage: options.language, projectTemplate: options.template, namespaceName });
parsedTags, projectLanguage: options.language, projectTemplate: options.template, namespaceName, projectType: projectType !== null && projectType !== void 0 ? projectType : 'library' });
}
function GenerateTestProject(schema, host, dotnetClient, projectType) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const testRoot = schema.projectRoot + '-test';
const testProjectName = schema.projectName + '-test';
devkit_1.addProjectConfiguration(host, testProjectName, {
root: testRoot,
projectType: projectType,
sourceRoot: `${testRoot}`,
targets: {
build: models_1.GetBuildExecutorConfiguration(testRoot),
test: models_1.GetTestExecutorConfig(),
lint: models_1.GetLintExecutorConfiguration(),
},
tags: schema.parsedTags,
});
const newParams = [
{
flag: 'language',
value: schema.language,
},
{
flag: 'name',
value: schema.namespaceName + '.Test',
},
{
flag: 'output',
value: schema.projectRoot + '-test',
},
];
if (utils_1.isDryRun()) {
addDryRunParameter(newParams);
}
dotnetClient.new(schema.testTemplate, newParams);
if (!utils_1.isDryRun() && !schema.skipOutputPathManipulation) {
const testCsProj = yield utils_1.findProjectFileInPath(testRoot);
SetOutputPath(host, testRoot, testCsProj);
const baseCsProj = yield utils_1.findProjectFileInPath(schema.projectRoot);
SetOutputPath(host, schema.projectRoot, baseCsProj);
dotnetClient.addProjectReference(testCsProj, baseCsProj);
}
});
}
exports.normalizeOptions = normalizeOptions;
function SetOutputPath(host, projectRootPath, projectFilePath) {

@@ -106,2 +83,3 @@ var _a;

}
exports.SetOutputPath = SetOutputPath;
function GenerateProject(host, options, dotnetClient, projectType) {

@@ -142,3 +120,3 @@ var _a;

if (options['testTemplate'] !== 'none') {
yield GenerateTestProject(normalizedOptions, host, dotnetClient, projectType);
yield generate_test_project_1.GenerateTestProject(host, normalizedOptions, dotnetClient);
}

@@ -158,2 +136,3 @@ else if (!options.skipOutputPathManipulation) {

}
exports.addDryRunParameter = addDryRunParameter;
//# sourceMappingURL=generate-project.js.map

@@ -6,1 +6,2 @@ export * from './build-executor-configuration';

export * from './lint-executor-configuration';
export * from './test-generator-schema';

@@ -9,2 +9,3 @@ "use strict";

tslib_1.__exportStar(require("./lint-executor-configuration"), exports);
tslib_1.__exportStar(require("./test-generator-schema"), exports);
//# sourceMappingURL=index.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc