A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/npm/cli/commit/ec57f5f0831e6e82b87b9ed9ebdfa9fc3d5ba1ee below:

fix dependencies script for circular workspace deps · npm/cli@ec57f5f · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+41

-14

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+41

-14

lines changed Original file line number Diff line number Diff line change

@@ -2,15 +2,10 @@

2 2

[

3 3

"npm"

4 4

],

5 -

[

6 -

"@npmcli/smoke-tests",

7 -

"libnpmaccess",

8 -

"libnpmexec",

9 -

"libnpmpublish"

10 -

],

11 5

[

12 6

"@npmcli/mock-registry",

13 7

"libnpmdiff",

8 +

"libnpmexec",

14 9

"libnpmfund",

15 10

"libnpmpack"

16 11

],

@@ -28,7 +23,9 @@

28 23

[

29 24

"@npmcli/map-workspaces",

30 25

"@npmcli/run-script",

26 +

"libnpmaccess",

31 27

"libnpmorg",

28 +

"libnpmpublish",

32 29

"libnpmsearch",

33 30

"libnpmteam",

34 31

"init-package-json",

@@ -50,6 +47,7 @@

50 47

],

51 48

[

52 49

"@npmcli/docs",

50 +

"@npmcli/smoke-tests",

53 51

"@npmcli/fs",

54 52

"npm-bundled",

55 53

"npm-install-checks",

Original file line number Diff line number Diff line change

@@ -166,6 +166,7 @@ graph LR;

166 166

npmcli-arborist-->npmcli-installed-package-contents["@npmcli/installed-package-contents"];

167 167

npmcli-arborist-->npmcli-map-workspaces["@npmcli/map-workspaces"];

168 168

npmcli-arborist-->npmcli-metavuln-calculator["@npmcli/metavuln-calculator"];

169 +

npmcli-arborist-->npmcli-mock-registry["@npmcli/mock-registry"];

169 170

npmcli-arborist-->npmcli-name-from-folder["@npmcli/name-from-folder"];

170 171

npmcli-arborist-->npmcli-node-gyp["@npmcli/node-gyp"];

171 172

npmcli-arborist-->npmcli-package-json["@npmcli/package-json"];

@@ -578,6 +579,7 @@ graph LR;

578 579

npmcli-arborist-->npmcli-installed-package-contents["@npmcli/installed-package-contents"];

579 580

npmcli-arborist-->npmcli-map-workspaces["@npmcli/map-workspaces"];

580 581

npmcli-arborist-->npmcli-metavuln-calculator["@npmcli/metavuln-calculator"];

582 +

npmcli-arborist-->npmcli-mock-registry["@npmcli/mock-registry"];

581 583

npmcli-arborist-->npmcli-name-from-folder["@npmcli/name-from-folder"];

582 584

npmcli-arborist-->npmcli-node-gyp["@npmcli/node-gyp"];

583 585

npmcli-arborist-->npmcli-package-json["@npmcli/package-json"];

@@ -777,14 +779,13 @@ Each group depends on packages lower down the chain, nothing depends on

777 779

packages higher up the chain.

778 780 779 781

- npm

780 -

- @npmcli/smoke-tests, libnpmaccess, libnpmexec, libnpmpublish

781 -

- @npmcli/mock-registry, libnpmdiff, libnpmfund, libnpmpack

782 +

- @npmcli/mock-registry, libnpmdiff, libnpmexec, libnpmfund, libnpmpack

782 783

- @npmcli/arborist

783 784

- @npmcli/metavuln-calculator

784 785

- pacote, @npmcli/config, libnpmversion

785 -

- @npmcli/map-workspaces, @npmcli/run-script, libnpmorg, libnpmsearch, libnpmteam, init-package-json, npm-profile

786 +

- @npmcli/map-workspaces, @npmcli/run-script, libnpmaccess, libnpmorg, libnpmpublish, libnpmsearch, libnpmteam, init-package-json, npm-profile

786 787

- @npmcli/package-json, npm-registry-fetch

787 788

- @npmcli/git, make-fetch-happen

788 789

- @npmcli/installed-package-contents, npm-pick-manifest, cacache, promzard

789 -

- @npmcli/docs, @npmcli/fs, npm-bundled, npm-install-checks, npm-package-arg, normalize-package-data, unique-filename, npm-packlist, bin-links, nopt, parse-conflict-json, read-package-json-fast, @npmcli/mock-globals, read

790 +

- @npmcli/docs, @npmcli/smoke-tests, @npmcli/fs, npm-bundled, npm-install-checks, npm-package-arg, normalize-package-data, unique-filename, npm-packlist, bin-links, nopt, parse-conflict-json, read-package-json-fast, @npmcli/mock-globals, read

790 791

- @npmcli/eslint-config, @npmcli/template-oss, ignore-walk, semver, npm-normalize-package-bin, @npmcli/name-from-folder, @npmcli/promise-spawn, ini, hosted-git-info, proc-log, validate-npm-package-name, json-parse-even-better-errors, fs-minipass, ssri, unique-slug, @npmcli/node-gyp, @npmcli/redact, @npmcli/agent, minipass-fetch, @npmcli/query, cmd-shim, read-cmd-shim, write-file-atomic, abbrev, proggy, minify-registry-metadata, mute-stream, npm-audit-report, npm-user-validate

Original file line number Diff line number Diff line change

@@ -11,6 +11,31 @@ const { run, CWD, pkg, fs, EOL } = require('./util.js')

11 11

// npx -p @npmcli/stafftools gh repos --json | json -a name | sort > scripts/npm-cli-repos.txt

12 12

const repos = readFileSync(join(CWD, 'scripts', 'npm-cli-repos.txt'), 'utf-8').trim().split(os.EOL)

13 13 14 +

// Packages with known circular dependencies. This is typically something with arborist as a dependency which is also in arborist's dev dependencies. Not a problem if they're workspaces so we ignore repeats

15 +

const circular = new Set(['@npmcli/mock-registry'])

16 + 17 +

// TODO Set.intersection/difference was added in node 22.11.0, once we're above that line we can use the builtin

18 +

// https://node.green/#ES2025-features-Set-methods-Set-prototype-intersection--

19 +

function intersection (set1, set2) {

20 +

const result = new Set()

21 +

for (const item of set1) {

22 +

if (set2.has(item)) {

23 +

result.add(item)

24 +

}

25 +

}

26 +

return result

27 +

}

28 + 29 +

function difference (set1, set2) {

30 +

const result = new Set()

31 +

for (const item of set1) {

32 +

if (!set2.has(item)) {

33 +

result.add(item)

34 +

}

35 +

}

36 +

return result

37 +

}

38 + 14 39

// these have a different package name than the repo name, and are ours.

15 40

const aliases = {

16 41

semver: 'node-semver',

@@ -29,6 +54,7 @@ const namespaced = [

29 54

'git',

30 55

'installed-package-contents',

31 56

'lint',

57 +

'mock-registry',

32 58

'map-workspaces',

33 59

'metavuln-calculator',

34 60

'move-file',

@@ -140,7 +166,11 @@ const walk = function (tree, onlyOurs) {

140 166

log.silly(dep, '::', [...dependedBy[dep]].join(', '))

141 167

log.silly('-'.repeat(80))

142 168 143 -

if (!dependedBy[dep].size) {

169 +

// things that depend on us that are at the same level

170 +

const both = intersection(allDeps, dependedBy[dep])

171 +

// ... minus the known circular dependencies

172 +

const neither = difference(both, circular)

173 +

if (!dependedBy[dep].size || !neither.size) {

144 174

level.push(dep)

145 175

foundDeps.add(dep)

146 176

}

@@ -177,9 +207,7 @@ const iterate = function (node, dependedBy, annotations, onlyOurs) {

177 207

dependedBy[node.packageName] = new Set()

178 208

}

179 209

for (const [name, edge] of node.edgesOut) {

180 -

if (

181 -

(!onlyOurs || isOurs(name)) && !node.dev

182 -

) {

210 +

if ((!onlyOurs || isOurs(name)) && !node.dev) {

183 211

if (!dependedBy[node.packageName].has(edge.name)) {

184 212

dependedBy[node.packageName].add(edge.name)

185 213

annotations.push(` ${stripName(node.packageName)}-->${escapeName(edge.name)};`)

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4