Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 28 23:51

    zkochan on perf-build-modules

    refactor: build-modules (compare)

  • May 28 23:33

    zkochan on v6

    fix: `pnpm add @teambit/bit` sh… (compare)

  • May 28 23:32

    zkochan on memory-issue

    (compare)

  • May 28 23:32

    zkochan on main

    fix: `pnpm add @teambit/bit` sh… (compare)

  • May 28 23:32
    zkochan closed #4813
  • May 28 23:27
    zkochan synchronize #4813
  • May 28 23:27

    zkochan on memory-issue

    test: fix (compare)

  • May 28 23:01
    zkochan synchronize #4813
  • May 28 23:01

    zkochan on memory-issue

    test: deepRecursive.ts (compare)

  • May 28 21:49
    gluxon edited #4814
  • May 28 21:48
    gluxon commented #4814
  • May 28 21:44
    gluxon labeled #4814
  • May 28 21:44
    gluxon labeled #4814
  • May 28 21:44
    gluxon opened #4814
  • May 28 21:26
    zkochan edited #4813
  • May 28 21:25
    zkochan opened #4813
  • May 28 21:22

    zkochan on memory-issue

    fix: pnpm add @teambit/bit shou… (compare)

  • May 28 21:02

    zkochan on memory-issue

    fix: pnpm add @teambit/bit shou… (compare)

  • May 28 17:45
    mc-petry commented #4784
  • May 28 14:29

    zkochan on main

    ci: update setup pnpm action ve… (compare)

Vaughan Rouesnel
@vjpr
export async function makeDependentsMap({cwd, root}) {

  const config = await getWebpackConfig({cwd, root})

  const stats = await promisify(webpack)(config)

  //if (e) throw e
  if (stats.hasErrors()) {
    stats.toJson().errors.map(e => {
      console.log(e)
      console.log('------------------------------------------------------------------------------')
    })
    //return
    throw 'Webpack failed.'
  }

  const json = stats.toJson({modules: true})

  const dependents = {}
  const dependencies = {}

  json.modules.map(mod => {
    //console.log(mod)
    dependents[mod.name] = dependents[mod.name] || []
    //const deps = mod.reasons.map(r => r.module)
    const deps = mod.reasons
    dependents[mod.name].push(...deps)

    mod.reasons.map(reason => {
      dependencies[reason.module] = dependencies[reason.module] || []
      dependencies[reason.module].push({mod, reason})
    })

  })

  return {dependents, dependencies}

}
Zoltan Kochan
@zkochan
thanks, yeah, there are lots of packages like this. there is something from browserify as well. I wondered if there's something that checks the whole package (each module in the package). Probably I'll have to implement that one myself, using one of these
Vaughan Rouesnel
@vjpr
you can use jscodeshift to find requires/imports manually...
function findAndModifyRequires(code, userRequest, newImportPath) {
  return j(code)
    .find(j.CallExpression, {callee: {name: 'require'}})
    .forEach(path => {
      const name = path.value.arguments[0].value
      if (name === userRequest) {
        path.value.arguments[0].value = removeFileExt(newImportPath)
      }
    })
    .toSource({quote: 'single'})
}

function findAndModifyImports(code, userRequest, newImportPath) {
  return j(code)
    .find(j.ImportDeclaration)
    .forEach(path => {
      const name = path.value.source.value
      if (name === userRequest) {
        path.value.source.value = removeFileExt(newImportPath)
      }
    })
    .toSource({quote: 'single'})
}
(this also modified them)
Zoltan Kochan
@zkochan
this is what I was looking for https://github.com/maxogden/dependency-check
Vaughan Rouesnel
@vjpr
Zoltan Kochan
@zkochan
yep, I looked into dependents of detective
that's how I've found it
Vaughan Rouesnel
@vjpr
if i run pnpm i —force will this update my local shrinkwrap?
i think i need something like pnpm i —force-but-dont-modify-my-shrinkwrap.
say i am reusing a node_modules dir, but i have changed branch and want to run pnpm i to use the new shrinkwrap
Zoltan Kochan
@zkochan
I think it won't update the shrinkwrap.
Vaughan Rouesnel
@vjpr
im finding that the new node_modules/.shrinkwrap.yaml is not the same as shrinkwrap.yaml which means its doing an entire deploy each time
Zoltan Kochan
@zkochan
but the outer shrinkwrap is not modified, right?
the inner is rewritten to be the same as the outer
Vaughan Rouesnel
@vjpr
hmm ok it seems like that is the case
but im seeing my shrinkwrap change each time i install
e.g.
  /soap/0.17.0:
    dependencies:
      compress: 0.99.0
      debug: 0.7.4
      ejs: 2.3.4
      lodash: 3.10.1
      node-uuid: 1.4.8
      optional: 0.1.3
      request: 2.81.0
      sax: 1.2.2
      selectn: 0.9.6
      strip-bom: 0.3.1
      ursa: 0.9.4
      xml-crypto: 0.8.5
    resolution: 1fccd7e19031a143ee53dec09afe89ba379e051e
  /soap/0.17.0:
    dependencies:
      compress: 0.99.0
      debug: 0.7.4
      ejs: 2.3.4
      lodash: 3.10.1
      node-uuid: 1.4.8
      optional: v0.1.3
      request: 2.81.0
      sax: 1.2.2
      selectn: 0.9.6
      strip-bom: 0.3.1
      ursa: 0.9.4
      xml-crypto: 0.8.5
    resolution: 1fccd7e19031a143ee53dec09afe89ba379e051e
Zoltan Kochan
@zkochan
when the two shrinkwraps differ?
Vaughan Rouesnel
@vjpr
notice the optional has a v
prefixed
i remember this is an issue i submitted earlier
Zoltan Kochan
@zkochan
yes, I couldn't repro
maybe the difference between inner/outter shrinkwrap causes these
Vaughan Rouesnel
@vjpr
ok so i can reproduce it everytime now
maybe its a corrupt store or something
rm shrinkwrap.yaml
rm -rf node_modules
pnpm i

rm -rf node_modules
pnpm i

shrinkwrap.yaml has changed
react-highcharts and the optional module
the second time it reports these messages and then adds them to the shrinkwrap
  WARN Cannot find resolution of /highcharts-release/v4.2.7 in shrinkwrap file
  WARN Cannot find resolution of /highmaps-release/v1.1.10 in shrinkwrap file
  WARN Cannot find resolution of /highstock-release/v2.1.10 in shrinkwrap file
  WARN Cannot find resolution of /optional/v0.1.3 in shrinkwrap file
Vaughan Rouesnel
@vjpr
i will try find where it happens in the code
Zoltan Kochan
@zkochan
I think I reproduced it.
happens when the shrikwrap.yaml inside node_modules difference from the one outside
so after a branch switch very likely
Vaughan Rouesnel
@vjpr
im seeing it without the inside and outside being different
Vaughan Rouesnel
@vjpr
so in shrinkwrap.ts pkgIdToRef, pkgVersion sometimes can start with a v
i will find the root cause
Zoltan Kochan
@zkochan
thanks
Vaughan Rouesnel
@vjpr
haha so highcharts-release puts of v in its package.json version
is this even valid?
Zoltan Kochan
@zkochan
wow
according to this site it is valid
Vaughan Rouesnel
@vjpr
haha
Zoltan Kochan
@zkochan
TIL
A leading "=" or "v" character is stripped off and ignored.
boom
i think ive seen packages with leading equals too
ah there was a bug related to that
Zoltan Kochan
@zkochan
I see, there's a semver.clean method for stripping off the v and stuff