@nrwl/workspace
Advanced tools
Comparing version 8.8.0-beta.3 to 8.8.0-beta.4
{ | ||
"name": "@nrwl/workspace", | ||
"version": "8.8.0-beta.3", | ||
"version": "8.8.0-beta.4", | ||
"description": "Extensible Dev Tools for Monorepos", | ||
@@ -61,4 +61,4 @@ "repository": { | ||
"chalk": "2.4.2", | ||
"@nrwl/cli": "8.8.0-beta.3" | ||
"@nrwl/cli": "8.8.0-beta.4" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import { YargsAffectedOptions } from './affected'; | ||
import { YargsAffectedOptions } from './run-tasks/affected'; | ||
export interface YargsFormatOptions extends YargsAffectedOptions { | ||
@@ -3,0 +3,0 @@ libsAndApps?: boolean; |
@@ -8,3 +8,3 @@ #!/usr/bin/env node | ||
const versions_1 = require("../utils/versions"); | ||
const affected_1 = require("./affected"); | ||
const run_tasks_1 = require("./run-tasks"); | ||
const dep_graph_1 = require("./dep-graph"); | ||
@@ -35,2 +35,3 @@ const format_1 = require("./format"); | ||
'report', | ||
'run-many', | ||
'list', | ||
@@ -61,11 +62,12 @@ 'help', | ||
`) | ||
.command('affected', 'Run task for affected projects', yargs => withAffectedOptions(withParallel(withTarget(yargs))), args => affected_1.affected('affected', Object.assign({}, args))) | ||
.command('affected:apps', 'Print applications affected by changes', withAffectedOptions, args => affected_1.affected('apps', Object.assign({}, args))) | ||
.command('affected:libs', 'Print libraries affected by changes', withAffectedOptions, args => affected_1.affected('libs', Object.assign({}, args))) | ||
.command('affected:build', 'Build applications and publishable libraries affected by changes', yargs => withAffectedOptions(withParallel(yargs)), args => affected_1.affected('affected', Object.assign({}, args, { target: 'build' }))) | ||
.command('affected:test', 'Test projects affected by changes', yargs => withAffectedOptions(withParallel(yargs)), args => affected_1.affected('affected', Object.assign({}, args, { target: 'test' }))) | ||
.command('affected:e2e', 'Run e2e tests for the applications affected by changes', yargs => withAffectedOptions(withParallel(yargs)), args => affected_1.affected('affected', Object.assign({}, args, { target: 'e2e' }))) | ||
.command('affected:dep-graph', 'Graph dependencies affected by changes', yargs => withAffectedOptions(withDepGraphOptions(yargs)), args => affected_1.affected('dep-graph', Object.assign({}, args))) | ||
.command('print-affected', 'Graph execution plan', yargs => withAffectedOptions(yargs), args => affected_1.affected('print-affected', Object.assign({}, args))) | ||
.command('affected:lint', 'Lint projects affected by changes', yargs => withAffectedOptions(withParallel(yargs)), args => affected_1.affected('affected', Object.assign({}, args, { target: 'lint' }))) | ||
.command('affected', 'Run task for affected projects', yargs => withAffectedOptions(withParallel(withTarget(yargs))), args => run_tasks_1.affected('affected', Object.assign({}, args))) | ||
.command('run-many', 'Run task for multiple projects', yargs => withRunManyOptions(withParallel(withTarget(yargs))), args => run_tasks_1.runMany(Object.assign({}, args))) | ||
.command('affected:apps', 'Print applications affected by changes', withAffectedOptions, args => run_tasks_1.affected('apps', Object.assign({}, args))) | ||
.command('affected:libs', 'Print libraries affected by changes', withAffectedOptions, args => run_tasks_1.affected('libs', Object.assign({}, args))) | ||
.command('affected:build', 'Build applications and publishable libraries affected by changes', yargs => withAffectedOptions(withParallel(yargs)), args => run_tasks_1.affected('affected', Object.assign({}, args, { target: 'build' }))) | ||
.command('affected:test', 'Test projects affected by changes', yargs => withAffectedOptions(withParallel(yargs)), args => run_tasks_1.affected('affected', Object.assign({}, args, { target: 'test' }))) | ||
.command('affected:e2e', 'Run e2e tests for the applications affected by changes', yargs => withAffectedOptions(withParallel(yargs)), args => run_tasks_1.affected('affected', Object.assign({}, args, { target: 'e2e' }))) | ||
.command('affected:dep-graph', 'Graph dependencies affected by changes', yargs => withAffectedOptions(withDepGraphOptions(yargs)), args => run_tasks_1.affected('dep-graph', Object.assign({}, args))) | ||
.command('print-affected', 'Graph execution plan', yargs => withAffectedOptions(yargs), args => run_tasks_1.affected('print-affected', Object.assign({}, args))) | ||
.command('affected:lint', 'Lint projects affected by changes', yargs => withAffectedOptions(withParallel(yargs)), args => run_tasks_1.affected('affected', Object.assign({}, args, { target: 'lint' }))) | ||
.command('dep-graph', 'Graph dependencies within workspace', yargs => withDepGraphOptions(yargs), args => dep_graph_1.generateGraph(args, [])) | ||
@@ -174,2 +176,35 @@ .command('format:check', 'Check for un-formatted files', withFormatOptions, args => format_1.format('check', args)) | ||
} | ||
function withRunManyOptions(yargs) { | ||
return yargs | ||
.option('projects', { | ||
describe: 'Projects to run (comma delimited)', | ||
type: 'string' | ||
}) | ||
.option('all', { describe: 'All projects' }) | ||
.nargs('all', 0) | ||
.check(({ all, projects }) => { | ||
if ((all && projects) || (!all && !projects)) | ||
throw new Error('You must provide either --all or --projects'); | ||
return true; | ||
}) | ||
.options('runner', { | ||
describe: 'This is the name of the tasks runner configured in nx.json', | ||
type: 'string' | ||
}) | ||
.options('configuration', { | ||
describe: 'This is the configuration to use when performing tasks on projects', | ||
type: 'string' | ||
}) | ||
.options('only-failed', { | ||
describe: 'Isolate projects which previously failed', | ||
type: 'boolean', | ||
default: false | ||
}) | ||
.option('verbose', { | ||
describe: 'Print additional error stack trace on failure' | ||
}) | ||
.conflicts({ | ||
all: 'projects' | ||
}); | ||
} | ||
function withDepGraphOptions(yargs) { | ||
@@ -176,0 +211,0 @@ return yargs |
@@ -1,2 +0,2 @@ | ||
import { YargsAffectedOptions } from './affected'; | ||
import { YargsAffectedOptions } from './run-tasks/affected'; | ||
import { Deps } from './deps-calculator'; | ||
@@ -64,3 +64,3 @@ export declare const TEN_MEGABYTES: number; | ||
} | ||
export interface AffectedMetadata { | ||
export interface ProjectMetadata { | ||
dependencyGraph: DependencyGraph; | ||
@@ -81,4 +81,4 @@ projectStates: ProjectStates; | ||
export declare function readNxJson(): NxJson; | ||
export declare function getAffectedMetadata(touchedFiles: string[], withDeps: boolean): AffectedMetadata; | ||
export declare function createAffectedMetadata(projectNodes: ProjectNode[], dependencies: Deps, touchedProjects: string[], withDeps: boolean): AffectedMetadata; | ||
export declare function getProjectMetadata(touchedFiles: string[], withDeps: boolean): ProjectMetadata; | ||
export declare function createProjectMetadata(projectNodes: ProjectNode[], dependencies: Deps, touchedProjects: string[], withDeps: boolean): ProjectMetadata; | ||
export declare function getProjectRoots(projectNames: string[]): string[]; | ||
@@ -85,0 +85,0 @@ export declare function allFilesInDir(dirName: string): { |
@@ -282,3 +282,3 @@ "use strict"; | ||
exports.readNxJson = readNxJson; | ||
function getAffectedMetadata(touchedFiles, withDeps) { | ||
function getProjectMetadata(touchedFiles, withDeps) { | ||
const workspaceJson = readWorkspaceJson(); | ||
@@ -290,6 +290,6 @@ const nxJson = readNxJson(); | ||
const tp = touched_1.touchedProjects(implicitDeps, projectNodes, touchedFiles); | ||
return createAffectedMetadata(projectNodes, dependencies, tp, withDeps); | ||
return createProjectMetadata(projectNodes, dependencies, tp, withDeps); | ||
} | ||
exports.getAffectedMetadata = getAffectedMetadata; | ||
function createAffectedMetadata(projectNodes, dependencies, touchedProjects, withDeps) { | ||
exports.getProjectMetadata = getProjectMetadata; | ||
function createProjectMetadata(projectNodes, dependencies, touchedProjects, withDeps) { | ||
const projectStates = {}; | ||
@@ -321,3 +321,3 @@ const projects = {}; | ||
} | ||
exports.createAffectedMetadata = createAffectedMetadata; | ||
exports.createProjectMetadata = createProjectMetadata; | ||
function simplifyDeps(dependencies) { | ||
@@ -324,0 +324,0 @@ const res = {}; |
@@ -412,3 +412,3 @@ "use strict"; | ||
it('should translate project nodes array to map', () => { | ||
expect(shared_1.createAffectedMetadata(projectNodes, dependencies, [], false).dependencyGraph.projects).toEqual({ | ||
expect(shared_1.createProjectMetadata(projectNodes, dependencies, [], false).dependencyGraph.projects).toEqual({ | ||
app1: { | ||
@@ -435,9 +435,9 @@ name: 'app1' | ||
it('should include the dependencies', () => { | ||
expect(shared_1.createAffectedMetadata(projectNodes, dependencies, [], false).dependencyGraph.dependencies).toEqual(dependencies); | ||
expect(shared_1.createProjectMetadata(projectNodes, dependencies, [], false).dependencyGraph.dependencies).toEqual(dependencies); | ||
}); | ||
it('should find the roots', () => { | ||
expect(shared_1.createAffectedMetadata(projectNodes, dependencies, [], false).dependencyGraph.roots).toEqual(['app1-e2e', 'customName-e2e']); | ||
expect(shared_1.createProjectMetadata(projectNodes, dependencies, [], false).dependencyGraph.roots).toEqual(['app1-e2e', 'customName-e2e']); | ||
}); | ||
it('should set projects as touched', () => { | ||
const { projectStates } = shared_1.createAffectedMetadata(projectNodes, dependencies, ['app1', 'lib2'], false); | ||
const { projectStates } = shared_1.createProjectMetadata(projectNodes, dependencies, ['app1', 'lib2'], false); | ||
expect(projectStates.app1.touched).toEqual(true); | ||
@@ -451,3 +451,3 @@ expect(projectStates.lib2.touched).toEqual(true); | ||
it('should set touched projects as affected', () => { | ||
const { projectStates } = shared_1.createAffectedMetadata(projectNodes, dependencies, ['app1', 'lib2'], false); | ||
const { projectStates } = shared_1.createProjectMetadata(projectNodes, dependencies, ['app1', 'lib2'], false); | ||
expect(projectStates.app1.affected).toEqual(true); | ||
@@ -457,3 +457,3 @@ expect(projectStates.lib2.affected).toEqual(true); | ||
it('should set dependents of touched projects as affected', () => { | ||
const { projectStates } = shared_1.createAffectedMetadata(projectNodes, dependencies, ['app1'], false); | ||
const { projectStates } = shared_1.createProjectMetadata(projectNodes, dependencies, ['app1'], false); | ||
expect(projectStates.app1.affected).toEqual(true); | ||
@@ -467,3 +467,3 @@ expect(projectStates['app1-e2e'].affected).toEqual(true); | ||
it('should set dependents of touched projects as affected (2)', () => { | ||
const { projectStates } = shared_1.createAffectedMetadata(projectNodes, dependencies, ['lib1'], false); | ||
const { projectStates } = shared_1.createProjectMetadata(projectNodes, dependencies, ['lib1'], false); | ||
expect(projectStates.app1.affected).toEqual(true); | ||
@@ -477,3 +477,3 @@ expect(projectStates['app1-e2e'].affected).toEqual(true); | ||
it('should not set any projects as affected when none are touched', () => { | ||
const { projectStates } = shared_1.createAffectedMetadata(projectNodes, dependencies, [], false); | ||
const { projectStates } = shared_1.createProjectMetadata(projectNodes, dependencies, [], false); | ||
expect(projectStates.app1.affected).toEqual(false); | ||
@@ -491,3 +491,3 @@ expect(projectStates.app2.affected).toEqual(false); | ||
}); | ||
const metadata = shared_1.createAffectedMetadata(projectNodes, dependencies, ['lib2'], false); | ||
const metadata = shared_1.createProjectMetadata(projectNodes, dependencies, ['lib2'], false); | ||
const { dependencyGraph, projectStates } = metadata; | ||
@@ -511,3 +511,3 @@ expect(dependencyGraph.roots).toEqual(['app1-e2e', 'customName-e2e']); | ||
}); | ||
const metadata = shared_1.createAffectedMetadata(projectNodes, dependencies, ['app1-e2e', 'customName-e2e'], false); | ||
const metadata = shared_1.createProjectMetadata(projectNodes, dependencies, ['app1-e2e', 'customName-e2e'], false); | ||
const { dependencyGraph, projectStates } = metadata; | ||
@@ -514,0 +514,0 @@ expect(dependencyGraph.roots).toEqual([]); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.nxVersion = '8.8.0-beta.3'; | ||
exports.nxVersion = '8.8.0-beta.4'; | ||
exports.angularCliVersion = '8.3.14'; | ||
@@ -5,0 +5,0 @@ exports.typescriptVersion = '~3.5.3'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
469962
222
11821
+ Added@nrwl/cli@8.8.0-beta.4(transitive)
+ Added@nrwl/tao@8.8.0-beta.4(transitive)
- Removed@nrwl/cli@8.8.0-beta.3(transitive)
- Removed@nrwl/tao@8.8.0-beta.3(transitive)
Updated@nrwl/cli@8.8.0-beta.4