Skip to content

Freeze Regex sometimes extracts incorrect module & version number #47

@softwaredoug

Description

@softwaredoug

Hey, great project. Love it. I just started using it and I noticed an issue with the freeze command. Specifically if I run this initial part of the freeze regex:

npm ls -g | grep -E '^.{4}\w{1}'

I'll get reasonable top-level packages:

├─┬ bower@1.2.8
├─┬ generator-angular@0.7.1
├─┬ generator-karma@0.6.0
├─┬ grunt@0.4.2
├─┬ grunt-cli@0.1.11
├─┬ grunt-karma@0.6.2
├─┬ karma@0.10.9
├── karma-chrome-launcher@0.1.2
├─┬ karma-coffee-preprocessor@0.1.2
├── karma-firefox-launcher@0.1.3
├── karma-html2js-preprocessor@0.1.0
├── karma-jasmine@0.1.5
├─┬ karma-phantomjs-launcher@0.1.1
├── karma-requirejs@0.2.1
├── karma-script-launcher@0.1.0
├─┬ npm@1.3.21
├─┬ phantomjs@1.9.2-6
├── requirejs@2.1.9
├─┬ socket.io@0.9.16
└─┬ yo@1.1.1

Once I add the regex that gets the version numbers:

npm ls -g | grep -E '^.{4}\w{1}' | grep -o -E '[a-zA-Z0-9\-]+@[0-9]+\.[0-9]+\.[0-9]+'

Notice what happens to "socket.io" as well as the phantomjs version number

bower@1.2.8
generator-angular@0.7.1
generator-karma@0.6.0
grunt@0.4.2
grunt-cli@0.1.11
grunt-karma@0.6.2
karma@0.10.9
karma-chrome-launcher@0.1.2
karma-coffee-preprocessor@0.1.2
karma-firefox-launcher@0.1.3
karma-html2js-preprocessor@0.1.0
karma-jasmine@0.1.5
karma-phantomjs-launcher@0.1.1
karma-requirejs@0.2.1
karma-script-launcher@0.1.0
npm@1.3.21
phantomjs@1.9.2   # -6 stripped
requirejs@2.1.9
io@0.9.16  #socket stripped
yo@1.1.1

Then trying to reuse this requirements file in another venv causes 404s. The workaround is to manually edit the requirements file after performing a freeze.

Perhaps a simpler regex should be used that simply splits on the @ character? I don't know enough about npm versions to comment on an appropriate fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions