@semrel-extra/topo
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -0,1 +1,8 @@ | ||
# [1.1.0](https://github.com/semrel-extra/topo/compare/v1.0.0...v1.1.0) (2021-12-26) | ||
### Features | ||
* add nodes and edges to topoContext ([18f60c0](https://github.com/semrel-extra/topo/commit/18f60c09cbaec005b9110b369ba77053246de3db)) | ||
# 1.0.0 (2021-12-25) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@semrel-extra/topo", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Helper to resolve monorepo dependencies graph", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -23,3 +23,9 @@ # @semrel-extra/topo | ||
{ | ||
queue: ['plk-a', 'pkg-b', 'pkg-x', 'pkg-y', 'pkg-x'] | ||
queue: ['pkg-a', 'pkg-b', 'pkg-z', 'pkg-y', 'pkg-x'], | ||
nodes: ['pkg-a', 'pkg-b', 'pkg-x', 'pkg-y', 'pkg-z'], | ||
edges: [ | ||
['pkg-a', 'pkg-b'], | ||
['pkg-z', 'pkg-y'], | ||
['pkg-y', 'pkg-x'], | ||
] | ||
} | ||
@@ -26,0 +32,0 @@ ``` |
@@ -21,3 +21,9 @@ import toposort from 'toposort' | ||
export const topo = async (otions: ITopoOtions): Promise<{ queue: string[] }> => { | ||
export interface ITopoContext { | ||
queue: string[] | ||
nodes: string[] | ||
edges: [string, string | undefined][] | ||
} | ||
export const topo = async (otions: ITopoOtions): Promise<ITopoContext> => { | ||
const manifestsPaths = await getManifestsPaths(otions) | ||
@@ -27,3 +33,7 @@ const manifests = await Promise.all(manifestsPaths.map(p => readFile(p, 'utf-8').then(JSON.parse))) | ||
return { queue: toposort.array(nodes, edges) } | ||
return { | ||
queue: toposort.array(nodes, edges), | ||
edges, | ||
nodes, | ||
} | ||
} | ||
@@ -30,0 +40,0 @@ |
@@ -23,4 +23,10 @@ import { test } from 'uvu' | ||
const workspaces = ['packages/*'] | ||
const result = (await topo({cwd, workspaces})).queue | ||
const expected = ['a', 'e', 'c'] | ||
const result = await topo({cwd, workspaces}) | ||
const expected = { | ||
queue: ['a', 'e', 'c'], | ||
nodes: ['a', 'c', 'e'], | ||
edges: [ | ||
[ 'e', 'c' ] | ||
], | ||
} | ||
@@ -27,0 +33,0 @@ assert.equal(result, expected) |
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
12927141
25
203
35