@nx-dotnet/core
Advanced tools
Comparing version 0.1.4 to 0.1.5-dev.1
@@ -13,2 +13,7 @@ { | ||
"description": "serve executor" | ||
}, | ||
"test": { | ||
"implementation": "./src/executors/test/executor", | ||
"schema": "./src/executors/test/schema.json", | ||
"description": "test executor" | ||
} | ||
@@ -15,0 +20,0 @@ }, |
@@ -9,6 +9,7 @@ { | ||
"chokidar": "^3.5.1", | ||
"@nx-dotnet/dotnet": "0.1.4", | ||
"@nx-dotnet/utils": "0.1.4" | ||
"@nx-dotnet/dotnet": "0.1.5-dev.1", | ||
"@nx-dotnet/utils": "0.1.5-dev.1", | ||
"xmldoc": "^1.1.2" | ||
}, | ||
"version": "0.1.4" | ||
"version": "0.1.5-dev.1" | ||
} |
import { ExecutorContext } from '@nrwl/devkit'; | ||
import { DotNetClient } from '@nx-dotnet/dotnet'; | ||
import { BuildExecutorSchema } from './schema'; | ||
import { DotNetClient } from '@nx-dotnet/dotnet'; | ||
export default function runExecutor(options: BuildExecutorSchema, context: ExecutorContext, dotnetClient?: DotNetClient): Promise<{ | ||
success: boolean; | ||
}>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const dotnet_1 = require("@nx-dotnet/dotnet"); | ||
const utils_1 = require("@nx-dotnet/utils"); | ||
const dotnet_1 = require("@nx-dotnet/dotnet"); | ||
function runExecutor(options, context, dotnetClient = new dotnet_1.DotNetClient(dotnet_1.dotnetFactory())) { | ||
@@ -7,0 +7,0 @@ return tslib_1.__awaiter(this, void 0, void 0, function* () { |
import { ExecutorContext } from '@nrwl/devkit'; | ||
import { promises as fs } from 'fs'; | ||
import { DotNetClient, mockDotnetFactory } from '@nx-dotnet/dotnet'; | ||
@@ -4,0 +6,0 @@ import { rimraf } from '@nx-dotnet/utils'; |
import { ExecutorContext } from '@nrwl/devkit'; | ||
import { DotNetClient } from '@nx-dotnet/dotnet'; | ||
import { ServeExecutorSchema } from './schema'; | ||
import { DotNetClient } from '@nx-dotnet/dotnet'; | ||
export default function dotnetRunExecutor(options: ServeExecutorSchema, context: ExecutorContext, dotnetClient?: DotNetClient): Promise<{ | ||
success: boolean; | ||
}>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const utils_1 = require("@nx-dotnet/utils"); | ||
const chockidar = require("chokidar"); | ||
const dotnet_1 = require("@nx-dotnet/dotnet"); | ||
const utils_1 = require("@nx-dotnet/utils"); | ||
let resolver; | ||
@@ -19,4 +19,4 @@ let childProcess; | ||
.watch(nxProjectConfiguration.root); | ||
utils_1.getDependantProjectsForNxProject(context.projectName, context.workspace, (project) => { | ||
watcher.add(project.root); | ||
utils_1.getDependantProjectsForNxProject(context.projectName, context.workspace, (dependency) => { | ||
watcher.add(dependency.root); | ||
}); | ||
@@ -44,6 +44,7 @@ watcher | ||
} | ||
childProcess = dotnetClient.run(project, Object.keys(options).map((x) => ({ | ||
const opts = Object.keys(options).map((x) => ({ | ||
flag: x, | ||
value: options[x], | ||
}))); | ||
})); | ||
childProcess = dotnetClient.run(project, opts); | ||
childProcess.on('error', (err) => { | ||
@@ -57,4 +58,2 @@ console.error(err); | ||
yield utils_1.rimraf(projectDirectory + '/obj'); | ||
if (options.cleanup) | ||
console.log('clean'); | ||
if (exitCode || exitCode === 0) | ||
@@ -72,3 +71,3 @@ console.log(exitCode); | ||
//do something when app is closing | ||
process.on('exit', () => exitHandler({ cleanup: true })); | ||
process.on('exit', () => exitHandler({ exit: false })); | ||
//catches ctrl+c event | ||
@@ -75,0 +74,0 @@ process.on('SIGINT', () => exitHandler({ exit: true })); |
import { Tree } from '@nrwl/devkit'; | ||
import { DotNetClient } from '@nx-dotnet/dotnet'; | ||
import { NxDotnetGeneratorSchema } from './schema'; | ||
export default function (host: Tree, options: NxDotnetGeneratorSchema, dotnetClient?: any): Promise<void>; | ||
export default function (host: Tree, options: NxDotnetGeneratorSchema, dotnetClient?: DotNetClient): Promise<void>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const devkit_1 = require("@nrwl/devkit"); | ||
const dotnet_1 = require("@nx-dotnet/dotnet"); | ||
const utils_1 = require("@nx-dotnet/utils"); | ||
const generator_1 = require("../init/generator"); | ||
function normalizeOptions(host, options) { | ||
const name = devkit_1.names(options.name).fileName; | ||
const projectDirectory = options.directory | ||
? `${devkit_1.names(options.directory).fileName}/${name}` | ||
: name; | ||
const projectName = projectDirectory.replace(new RegExp('/', 'g'), '-'); | ||
const projectRoot = `${devkit_1.getWorkspaceLayout(host).appsDir}/${projectDirectory}`; | ||
const parsedTags = options.tags | ||
? options.tags.split(',').map((s) => s.trim()) | ||
: []; | ||
return Object.assign(Object.assign({}, options), { name, | ||
projectName, | ||
projectRoot, | ||
projectDirectory, | ||
parsedTags, projectLanguage: options.language, projectTemplate: options.template }); | ||
} | ||
const generate_project_1 = require("../utils/generate-project"); | ||
function default_1(host, options, dotnetClient = new dotnet_1.DotNetClient(dotnet_1.dotnetFactory())) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
generator_1.default(host); | ||
const normalizedOptions = normalizeOptions(host, options); | ||
devkit_1.addProjectConfiguration(host, normalizedOptions.projectName, { | ||
root: normalizedOptions.projectRoot, | ||
projectType: 'application', | ||
sourceRoot: `${normalizedOptions.projectRoot}`, | ||
targets: { | ||
build: { | ||
executor: '@nx-dotnet/core:build', | ||
options: { | ||
output: `dist/${normalizedOptions.name}`, | ||
configuration: 'Debug' | ||
}, | ||
configurations: { | ||
production: { | ||
configuration: 'Release' | ||
} | ||
} | ||
}, | ||
serve: { | ||
executor: '@nx-dotnet/core:serve', | ||
options: { | ||
configuration: 'Debug' | ||
}, | ||
configurations: { | ||
production: { | ||
configuration: 'Release' | ||
} | ||
} | ||
}, | ||
test: { | ||
executor: '@nx-dotnet/core:test', | ||
}, | ||
}, | ||
tags: normalizedOptions.parsedTags, | ||
}); | ||
const newParams = [ | ||
{ | ||
flag: 'language', | ||
value: normalizedOptions.language, | ||
}, | ||
{ | ||
flag: 'name', | ||
value: normalizedOptions.name, | ||
}, | ||
{ | ||
flag: 'output', | ||
value: normalizedOptions.projectRoot, | ||
}, | ||
]; | ||
if (utils_1.isDryRun()) { | ||
newParams.push({ | ||
flag: 'dry-run', | ||
}); | ||
} | ||
dotnetClient.new(normalizedOptions.template, newParams); | ||
yield devkit_1.formatFiles(host); | ||
}); | ||
return generate_project_1.GenerateProject(host, options, dotnetClient, 'application'); | ||
} | ||
exports.default = default_1; | ||
//# sourceMappingURL=generator.js.map |
@@ -0,7 +1,8 @@ | ||
import { readProjectConfiguration, Tree } from '@nrwl/devkit'; | ||
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; | ||
import { Tree, readProjectConfiguration } from '@nrwl/devkit'; | ||
import { DotNetClient, mockDotnetFactory } from '@nx-dotnet/dotnet'; | ||
import generator from './generator'; | ||
import { NxDotnetGeneratorSchema } from './schema'; | ||
import { DotNetClient, mockDotnetFactory } from '@nx-dotnet/dotnet'; | ||
@@ -16,2 +17,3 @@ describe('nx-dotnet app generator', () => { | ||
template: 'mvc', | ||
"test-template": 'none' | ||
}; | ||
@@ -18,0 +20,0 @@ |
@@ -1,7 +0,3 @@ | ||
export interface NxDotnetGeneratorSchema { | ||
name: string; | ||
tags?: string; | ||
directory?: string; | ||
template: string; | ||
language: string; | ||
} | ||
import { NxDotnetProjectGeneratorSchema } from '../../models'; | ||
export type NxDotnetGeneratorSchema = NxDotnetProjectGeneratorSchema |
@@ -40,2 +40,17 @@ { | ||
} | ||
}, | ||
"test-template": { | ||
"type": "string", | ||
"description": "Which template should be used for creating the tests project?", | ||
"default": "nunit", | ||
"x-prompt": { | ||
"message": "Which template should be used for creating the tests project", | ||
"type": "list", | ||
"items": [ | ||
{"value": "nunit", "label": "NUnit 3 Test Project"}, | ||
{"value": "xunit", "label": "xUnit Test Project"}, | ||
{"value": "mstest", "label": "Unit Test Project"}, | ||
{"value": "none", "label": "No Unit Test Project"} | ||
] | ||
} | ||
} | ||
@@ -42,0 +57,0 @@ }, |
@@ -23,2 +23,3 @@ "use strict"; | ||
function updateGitIgnore(host) { | ||
var _a; | ||
if (!host.isFile('.gitignore')) { | ||
@@ -28,3 +29,3 @@ console.warn('Not updating gitignore because it is not present!'); | ||
} | ||
let lines = host.read('.gitignore').toString(); | ||
let lines = ((_a = host.read('.gitignore')) !== null && _a !== void 0 ? _a : '').toString(); | ||
lines += '\r\napps/*/bin'; | ||
@@ -31,0 +32,0 @@ lines += '\r\napps/*/obj'; |
@@ -0,3 +1,3 @@ | ||
import { Tree } from '@nrwl/devkit'; | ||
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; | ||
import { Tree } from '@nrwl/devkit'; | ||
@@ -4,0 +4,0 @@ import generator from './generator'; |
import { Tree } from '@nrwl/devkit'; | ||
import { DotNetClient } from '@nx-dotnet/dotnet'; | ||
import { NxDotnetGeneratorSchema } from './schema'; | ||
export default function (host: Tree, options: NxDotnetGeneratorSchema, dotnetClient?: any): Promise<void>; | ||
export default function (host: Tree, options: NxDotnetGeneratorSchema, dotnetClient?: DotNetClient): Promise<void>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const devkit_1 = require("@nrwl/devkit"); | ||
const dotnet_1 = require("@nx-dotnet/dotnet"); | ||
const utils_1 = require("@nx-dotnet/utils"); | ||
const generator_1 = require("../init/generator"); | ||
function normalizeOptions(host, options) { | ||
const name = devkit_1.names(options.name).fileName; | ||
const projectDirectory = options.directory | ||
? `${devkit_1.names(options.directory).fileName}/${name}` | ||
: name; | ||
const projectName = projectDirectory.replace(new RegExp('/', 'g'), '-'); | ||
const projectRoot = `${devkit_1.getWorkspaceLayout(host).libsDir}/${projectDirectory}`; | ||
const parsedTags = options.tags | ||
? options.tags.split(',').map((s) => s.trim()) | ||
: []; | ||
return Object.assign(Object.assign({}, options), { name, | ||
projectName, | ||
projectRoot, | ||
projectDirectory, | ||
parsedTags, projectLanguage: options.language, projectTemplate: options.template }); | ||
} | ||
const generate_project_1 = require("../utils/generate-project"); | ||
function default_1(host, options, dotnetClient = new dotnet_1.DotNetClient(dotnet_1.dotnetFactory())) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
generator_1.default(host); | ||
const normalizedOptions = normalizeOptions(host, options); | ||
devkit_1.addProjectConfiguration(host, normalizedOptions.projectName, { | ||
root: normalizedOptions.projectRoot, | ||
projectType: 'library', | ||
sourceRoot: `${normalizedOptions.projectRoot}`, | ||
targets: { | ||
build: { | ||
executor: '@nx-dotnet/core:build', | ||
options: { | ||
output: `dist/${normalizedOptions.name}`, | ||
configuration: 'Debug', | ||
}, | ||
configurations: { | ||
production: { | ||
configuration: 'Release', | ||
}, | ||
}, | ||
}, | ||
}, | ||
tags: normalizedOptions.parsedTags, | ||
}); | ||
const newParams = [ | ||
{ | ||
flag: 'language', | ||
value: normalizedOptions.language, | ||
}, | ||
{ | ||
flag: 'name', | ||
value: normalizedOptions.name, | ||
}, | ||
{ | ||
flag: 'output', | ||
value: normalizedOptions.projectRoot, | ||
}, | ||
]; | ||
if (utils_1.isDryRun()) { | ||
newParams.push({ | ||
flag: 'dry-run', | ||
}); | ||
} | ||
dotnetClient.new(normalizedOptions.template, newParams); | ||
yield devkit_1.formatFiles(host); | ||
}); | ||
return generate_project_1.GenerateProject(host, options, dotnetClient, 'library'); | ||
} | ||
exports.default = default_1; | ||
//# sourceMappingURL=generator.js.map |
@@ -0,7 +1,8 @@ | ||
import { readProjectConfiguration, Tree } from '@nrwl/devkit'; | ||
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; | ||
import { Tree, readProjectConfiguration } from '@nrwl/devkit'; | ||
import { DotNetClient, mockDotnetFactory } from '@nx-dotnet/dotnet'; | ||
import generator from './generator'; | ||
import { NxDotnetGeneratorSchema } from './schema'; | ||
import { DotNetClient, mockDotnetFactory } from '@nx-dotnet/dotnet'; | ||
@@ -16,2 +17,3 @@ describe('nx-dotnet library generator', () => { | ||
template: 'classlib', | ||
"test-template": 'none' | ||
}; | ||
@@ -18,0 +20,0 @@ |
@@ -1,7 +0,3 @@ | ||
export interface NxDotnetGeneratorSchema { | ||
name: string; | ||
tags?: string; | ||
directory?: string; | ||
template: string; | ||
language: string; | ||
} | ||
import { NxDotnetProjectGeneratorSchema } from '../../models'; | ||
export type NxDotnetGeneratorSchema = NxDotnetProjectGeneratorSchema |
import { Tree } from '@nrwl/devkit'; | ||
import { DotNetClient } from '@nx-dotnet/dotnet'; | ||
import { NxDotnetGeneratorSchema } from './schema'; | ||
export default function (host: Tree, options: NxDotnetGeneratorSchema, client?: any): Promise<void>; | ||
export default function (host: Tree, options: NxDotnetGeneratorSchema, client?: DotNetClient): Promise<void>; |
@@ -11,3 +11,3 @@ "use strict"; | ||
const sourceProject = devkit_1.readProjectConfiguration(host, options.reference); | ||
let [hostProjectFile, sourceProjectFile] = [null, null]; | ||
let [hostProjectFile, sourceProjectFile] = ['', '']; | ||
try { | ||
@@ -14,0 +14,0 @@ [hostProjectFile, sourceProjectFile] = yield Promise.all([ |
@@ -0,11 +1,8 @@ | ||
import { addProjectConfiguration, Tree } from '@nrwl/devkit'; | ||
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; | ||
import { | ||
Tree, | ||
readProjectConfiguration, | ||
addProjectConfiguration, | ||
} from '@nrwl/devkit'; | ||
import { DotNetClient } from '@nx-dotnet/dotnet'; | ||
import generator from './generator'; | ||
import { NxDotnetGeneratorSchema } from './schema'; | ||
import { DotNetClient } from '@nx-dotnet/dotnet'; | ||
@@ -59,9 +56,2 @@ describe('nx-dotnet project reference', () => { | ||
}); | ||
it('should update dependencies', async () => { | ||
await generator(appTree, options, client); | ||
expect( | ||
readProjectConfiguration(appTree, appId).implicitDependencies | ||
).toContain(libId); | ||
}); | ||
}); |
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
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
53327
74
1038
4
2
+ Addedxmldoc@^1.1.2
+ Added@nx-dotnet/dotnet@0.1.5-dev.1(transitive)
+ Added@nx-dotnet/utils@0.1.5-dev.1(transitive)
- Removed@nx-dotnet/dotnet@0.1.4(transitive)
- Removed@nx-dotnet/utils@0.1.4(transitive)
Updated@nx-dotnet/utils@0.1.5-dev.1