Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Leaf nodes declare that they are dependencies of themselves #37

Open
timoxley opened this issue Jan 24, 2015 · 0 comments
Open

Leaf nodes declare that they are dependencies of themselves #37

timoxley opened this issue Jan 24, 2015 · 0 comments

Comments

@timoxley
Copy link

mkdir read-installed-bug && cd read-installed-bug
npm init -f && npm install read-installed --save

index.js

var depth = parseInt(process.argv[2], 10) || 0

read(process.cwd(), {depth: depth, dev: false}, function(err, installed) {
  if (err) throw err
  console.log(inspect(installed, {colors: true, depth: 30}))
})

Now run this with node index.js 0 to print depth 0 and you should get something like the output at the bottom of this issue.

Note that read-installed is reporting that it is a dependency of itself:

{
  name: 'read-installed-bug',
  
  dependencies: {
     'read-installed': {
        name: 'read-installed',
        
        dependencies: {
          'read-installed': [Circular]
        }
      }
   }
}

If you adjust the depth (node index.js 1, node index.js 2) this same pattern occurs in all dependencies at the maximum depth.

Is this somehow a feature?

{ name: 'read-installed-bug',
  version: '1.0.0',
  main: 'index.js',
  scripts: { test: 'echo "Error: no test specified" && exit 1' },
  keywords: [],
  author:
   { name: 'Tim Oxley',
     email: '[email protected]' },
  license: 'ISC',
  dependencies:
   { 'read-installed':
      { name: 'read-installed',
        description: 'Read all the installed packages in a folder, and return a tree structure with all the data.',
        version: '3.1.5',
        repository:
         { type: 'git',
           url: 'git://github.com/isaacs/read-installed' },
        main: 'read-installed.js',
        scripts: { test: 'tap ./test/*.js' },
        dependencies: { 'read-installed': [Circular] }, //  <== ????
        optionalDependencies: { 'graceful-fs': '2 || 3' },
        author:
         { name: 'Isaac Z. Schlueter',
           email: '[email protected]',
           url: 'http://blog.izs.me/' },
        license: 'ISC',
        devDependencies:
         { mkdirp: '^0.5.0',
           rimraf: '^2.2.8',
           tap: '~0.4.8' },
        gitHead: '577c3f3f4f1e435f9bd944b8f99ce3f7552709ef',
        bugs: { url: 'https://github.com/isaacs/read-installed/issues' },
        homepage: 'https://github.com/isaacs/read-installed',
        _id: '[email protected]',
        _shasum: '4ae36081afd3e2204dc2e279807aaa52c30c8c0c',
        _from: 'read-installed@>=3.1.5 <4.0.0',
        _npmVersion: '2.1.15',
        _nodeVersion: '0.10.34',
        _npmUser:
         { name: 'othiym23',
           email: '[email protected]' },
        maintainers: [ [Object], [Object] ],
        dist:
         { shasum: '4ae36081afd3e2204dc2e279807aaa52c30c8c0c',
           tarball: 'http://registry.npmjs.org/read-installed/-/read-installed-3.1.5.tgz' },
        directories: {},
        _resolved: 'https://registry.npmjs.org/read-installed/-/read-installed-3.1.5.tgz',
        readme: 'ERROR: No README data found!',
        realName: 'read-installed',
        _dependencies:
         { debuglog: '^1.0.1',
           'read-package-json': '1',
           'readdir-scoped-modules': '^1.0.0',
           semver: '2 || 3 || 4',
           slide: '~1.1.3',
           'util-extend': '^1.0.1',
           'graceful-fs': '2 || 3' },
        extraneous: false,
        path: '/Users/timoxley/Projects/tests/read-installed-bug/node_modules/read-installed',
        realPath: '/Users/timoxley/Projects/tests/read-installed-bug/node_modules/read-installed',
        link: undefined,
        parent: [Circular],
        depth: 1,
        peerDependencies: {} } },
  devDependencies: {},
  readme: 'ERROR: No README data found!',
  _id: '[email protected]',
  realName: 'read-installed-bug',
  _dependencies: { 'read-installed': '^3.1.5' },
  extraneous: false,
  path: '/Users/timoxley/Projects/tests/read-installed-bug',
  realPath: '/Users/timoxley/Projects/tests/read-installed-bug',
  link: undefined,
  depth: 0,
  peerDependencies: {},
  root: true }
timoxley added a commit to timoxley/pkgrep that referenced this issue Jan 26, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant