Skip to content

Freeze Regex sometimes extracts incorrect module & version number #47

Closed
softwaredoug opened this Issue Jan 8, 2014 · 1 comment

2 participants

@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.

@ekalinin
Owner
ekalinin commented Jan 9, 2014

Great patch! Thanks!

@ekalinin ekalinin closed this Jan 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.