Skip to content

Commit

Permalink
chore(repo): wip
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz committed Jan 29, 2025
1 parent 8266785 commit 91e243b
Show file tree
Hide file tree
Showing 28 changed files with 1,813 additions and 833 deletions.
9 changes: 9 additions & 0 deletions docs/generated/devkit/TargetConfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Target's configuration
- [cache](../../devkit/documents/TargetConfiguration#cache): boolean
- [command](../../devkit/documents/TargetConfiguration#command): string
- [configurations](../../devkit/documents/TargetConfiguration#configurations): Object
- [continuous](../../devkit/documents/TargetConfiguration#continuous): boolean
- [defaultConfiguration](../../devkit/documents/TargetConfiguration#defaultconfiguration): string
- [dependsOn](../../devkit/documents/TargetConfiguration#dependson): (string | TargetDependencyConfig)[]
- [executor](../../devkit/documents/TargetConfiguration#executor): string
Expand Down Expand Up @@ -55,6 +56,14 @@ Sets of options

---

### continuous

`Optional` **continuous**: `boolean`

Whether this target runs continuously

---

### defaultConfiguration

`Optional` **defaultConfiguration**: `string`
Expand Down
9 changes: 9 additions & 0 deletions docs/generated/devkit/Task.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ A representation of the invocation of an Executor
### Properties

- [cache](../../devkit/documents/Task#cache): boolean
- [continuous](../../devkit/documents/Task#continuous): boolean
- [endTime](../../devkit/documents/Task#endtime): number
- [hash](../../devkit/documents/Task#hash): string
- [hashDetails](../../devkit/documents/Task#hashdetails): Object
Expand All @@ -28,6 +29,14 @@ Determines if a given task should be cacheable.

---

### continuous

**continuous**: `boolean`

This denotes if the task runs continuously

---

### endTime

`Optional` **endTime**: `number`
Expand Down
7 changes: 7 additions & 0 deletions docs/generated/devkit/TaskGraph.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ Graph of Tasks to be executed

### Properties

- [continuousDependencies](../../devkit/documents/TaskGraph#continuousdependencies): Record<string, string[]>
- [dependencies](../../devkit/documents/TaskGraph#dependencies): Record<string, string[]>
- [roots](../../devkit/documents/TaskGraph#roots): string[]
- [tasks](../../devkit/documents/TaskGraph#tasks): Record<string, Task>

## Properties

### continuousDependencies

**continuousDependencies**: `Record`\<`string`, `string`[]\>

---

### dependencies

**dependencies**: `Record`\<`string`, `string`[]\>
Expand Down
16 changes: 16 additions & 0 deletions packages/js/src/utils/buildable-libs-utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ describe('calculateDependenciesFromTaskGraph', () => {
'lib3:build': [],
'lib4:build': [],
},
continuousDependencies: {},
roots: [],
tasks: {
'lib1:build': {
Expand All @@ -402,34 +403,39 @@ describe('calculateDependenciesFromTaskGraph', () => {
target: { project: 'lib1', target: 'build' },
outputs: [],
parallelism: true,
continuous: false,
},
'lib2:build': {
id: 'lib2:build',
overrides: {},
target: { project: 'lib2', target: 'build' },
outputs: [],
parallelism: true,
continuous: false,
},
'lib2:build-base': {
id: 'lib2:build-base',
overrides: {},
target: { project: 'lib2', target: 'build-base' },
outputs: [],
parallelism: true,
continuous: false,
},
'lib3:build': {
id: 'lib3:build',
overrides: {},
target: { project: 'lib3', target: 'build' },
outputs: [],
parallelism: true,
continuous: false,
},
'lib4:build': {
id: 'lib4:build',
overrides: {},
target: { project: 'lib4', target: 'build' },
outputs: [],
parallelism: true,
continuous: false,
},
},
};
Expand Down Expand Up @@ -569,6 +575,7 @@ describe('calculateDependenciesFromTaskGraph', () => {
'lib4:build': ['lib4:build-base'],
'lib4:build-base': [],
},
continuousDependencies: {},
roots: [],
tasks: {
'lib1:build': {
Expand All @@ -577,55 +584,63 @@ describe('calculateDependenciesFromTaskGraph', () => {
target: { project: 'lib1', target: 'build' },
outputs: [],
parallelism: true,
continuous: false,
},
'lib1:build-base': {
id: 'lib1:build-base',
overrides: {},
target: { project: 'lib1', target: 'build-base' },
outputs: [],
parallelism: true,
continuous: false,
},
'lib2:build': {
id: 'lib2:build',
overrides: {},
target: { project: 'lib2', target: 'build' },
outputs: [],
parallelism: true,
continuous: false,
},
'lib2:build-base': {
id: 'lib2:build-base',
overrides: {},
target: { project: 'lib2', target: 'build-base' },
outputs: [],
parallelism: true,
continuous: false,
},
'lib3:build': {
id: 'lib3:build',
overrides: {},
target: { project: 'lib3', target: 'build' },
outputs: [],
parallelism: true,
continuous: false,
},
'lib3:build-base': {
id: 'lib3:build-base',
overrides: {},
target: { project: 'lib3', target: 'build-base' },
outputs: [],
parallelism: true,
continuous: false,
},
'lib4:build': {
id: 'lib4:build',
overrides: {},
target: { project: 'lib4', target: 'build' },
outputs: [],
parallelism: true,
continuous: false,
},
'lib4:build-base': {
id: 'lib4:build-base',
overrides: {},
target: { project: 'lib4', target: 'build-base' },
outputs: [],
parallelism: true,
continuous: false,
},
},
};
Expand Down Expand Up @@ -717,6 +732,7 @@ describe('calculateDependenciesFromTaskGraph', () => {
// not relevant for this test case
const taskGraph: TaskGraph = {
dependencies: {},
continuousDependencies: {},
roots: [],
tasks: {},
};
Expand Down
1 change: 1 addition & 0 deletions packages/nx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"string-width": "^4.2.3",
"tar-stream": "~2.2.0",
"tmp": "~0.2.1",
"tree-kill": "^1.2.2",
"tsconfig-paths": "^4.1.2",
"tslib": "^2.3.0",
"yaml": "^2.6.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/nx/src/command-line/graph/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,7 @@ function getAllTaskGraphsForWorkspace(projectGraph: ProjectGraph): {
taskGraphs[taskId] = {
tasks: {},
dependencies: {},
continuousDependencies: {},
roots: [],
};

Expand All @@ -1006,6 +1007,7 @@ function getAllTaskGraphsForWorkspace(projectGraph: ProjectGraph): {
taskGraphs[taskId] = {
tasks: {},
dependencies: {},
continuousDependencies: {},
roots: [],
};

Expand Down
33 changes: 32 additions & 1 deletion packages/nx/src/commands-runner/get-command-projects.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
import { removeIdsFromGraph } from '../tasks-runner/utils';
import { NxArgs } from '../utils/command-line-utils';
import { CommandGraph } from './command-graph';
import { createCommandGraph } from './create-command-graph';
Expand Down Expand Up @@ -34,3 +33,35 @@ function getSortedProjects(

return getSortedProjects(newGraph, sortedProjects);
}

function removeIdsFromGraph<T>(
graph: {
roots: string[];
dependencies: Record<string, string[]>;
},
ids: string[],
mapWithIds: Record<string, T>
): {
mapWithIds: Record<string, T>;
roots: string[];
dependencies: Record<string, string[]>;
} {
const filteredMapWithIds = {};
const dependencies = {};
const removedSet = new Set(ids);
for (let id of Object.keys(mapWithIds)) {
if (!removedSet.has(id)) {
filteredMapWithIds[id] = mapWithIds[id];
dependencies[id] = graph.dependencies[id].filter(
(depId) => !removedSet.has(depId)
);
}
}
return {
mapWithIds: filteredMapWithIds,
dependencies: dependencies,
roots: Object.keys(dependencies).filter(
(k) => dependencies[k].length === 0
),
};
}
7 changes: 7 additions & 0 deletions packages/nx/src/config/task-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ export interface Task {
* Determines if a given task should be parallelizable.
*/
parallelism: boolean;

/**
* This denotes if the task runs continuously
*/
continuous: boolean;
}

/**
Expand All @@ -99,4 +104,6 @@ export interface TaskGraph {
* Map of Task IDs to IDs of tasks which the task depends on
*/
dependencies: Record<string, string[]>;

continuousDependencies: Record<string, string[]>;
}
5 changes: 5 additions & 0 deletions packages/nx/src/config/workspace-json-project-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ export interface TargetConfiguration<T = any> {
*/
parallelism?: boolean;

/**
* Whether this target runs continuously
*/
continuous?: boolean;

/**
* List of generators to run before the target to ensure the workspace
* is up to date.
Expand Down
Loading

0 comments on commit 91e243b

Please sign in to comment.