Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make express-minify optional for dev #431

Merged
merged 1 commit into from
Nov 20, 2014
Merged

Conversation

Zren
Copy link
Contributor

@Zren Zren commented Nov 20, 2014

No description provided.

@Martii
Copy link
Member

Martii commented Nov 20, 2014

How about we not invite production to potentially be misconfigured like your machine is and propagate that error by keeping the isPro in, e.g. just do it, but on isDev you do your try..catch instead.

@Martii
Copy link
Member

Martii commented Nov 20, 2014

Just for grins here's my output if it will help you or anyone else:

$ npm install express-minify
npm WARN package.json bootstrap-markdown@2.7.0 'repositories' (plural) Not supported. Please pick one as the 'repository' field
npm WARN package.json mu2@0.5.20 No repository field.
-
> node-sass@0.9.6 install ~/repo/git/oujs/martii/OpenUserJS.org/node_modules/express-minify/node_modules/node-sass
> node build.js

`linux-x64-v8-3.14` exists; testing


  ․․․․․․․․․․․․․․․․․․․․․․․․․․

  26 passing (28ms)

Binary is fine; exiting
express-minify@0.0.11 node_modules/express-minify
├── on-headers@1.0.0
├── cssmin@0.4.2
├── coffee-script@1.8.0 (mkdirp@0.3.5)
├── uglify-js@2.4.15 (uglify-to-browserify@1.0.2, async@0.2.10, optimist@0.3.7, source-map@0.1.34)
├── stylus@0.47.3 (css-parse@1.7.0, mkdirp@0.3.5, sax@0.5.8, debug@2.1.0, glob@3.2.11)
├── less@1.7.5 (graceful-fs@3.0.4, mime@1.2.11, source-map@0.1.40, mkdirp@0.5.0, clean-css@2.2.18, request@2.40.0)
└── node-sass@0.9.6 (get-stdin@3.0.0, object-assign@1.0.0, node-watch@0.3.4, node-sass-middleware@0.3.1, nan@1.3.0, mkdirp@0.5.0, shelljs@0.3.0, yargs@1.3.3, chalk@0.5.1, sinon@1.10.3, mocha@1.21.5)

@Zren
Copy link
Contributor Author

Zren commented Nov 20, 2014

If this removes minification in production, it'll be because nodejitsu doesn't install optionalDependencies, which is possible. I googled this first and found this (nodejitsu/require-analyzer#48). Even if this is the case, it's not going to break the site, it'll just turn off minification temporarily.

If this is the case, it's ridiculously easy to test and confirm. And a quick fix after the fact to stuff it back under the dependencies list.


if (isPro) {
  var minify = require('express-minify');
  app.use(minify());
} else {
  try {
    var minify = require('express-minify');
    app.use(minify());
  } catch (e) {}
}

Good enough?

@Martii
Copy link
Member

Martii commented Nov 20, 2014

That good enough for you?

Almost... isDbg mode doesn't activate express-minify period (but you probably didn't comprehend the message I left explicitly for you on this... and you might be too lazy, which is okay sometimes, to actually learn about debug mode in node in which this entire patch wouldn't be needed for local development but hey I'll compromise). The suggested code block is close to keeping your inability to maintain a working development platform out of OUJS production... and that's exactly what it should be. When toobusy was failing here I found an alternative of equal nature with toobusy-js but still kept the same logic in... you just want to push your problems with your machine to OUJS by changing the logic with Zren@66a7d9c which is not a good idea. I also offered up freely how I fixed it too... but you whined about not wanting to do a Windows reinstall... which even on a very slow machine takes about 40 minutes... and I've done thousands of those wonderfully mundane things for a lot of clients and even in beta testing for other commercial entities.

You're probably gonna complain about not storing the anonymous functions in a variable before calling them... Probably.

What's that saying... don't ASSume... there are exceptions to the current top inclusion for requires... and this can be yet another one from you. You have been complaining more than anyone here lately... so please, once again, leave your bad attitude at your doorstep not here. Thanks. If you can't handle questions then you don't have the necessary skills to be successful in life... learning never stops... just remember not everyone is as stupid as you think they are. :)

Anyhow... if you correct the logic for debug mode (or provide a good reason why we should just apply express-minify all across the board)... I'll give it a thumbs up... as it stands right now it's a thumbs down since you changed the logic for personal reasons.

@Martii
Copy link
Member

Martii commented Nov 20, 2014

...

if (isPro) {
  var minify = require('express-minify');
  app.use(minify());
} else {
  try {
    var minify = require('express-minify');
    app.use(minify());
  } catch (e) {}
}

... now that you've edited your post above and removed what you said about me complaining... you now have a strict mode violation of redeclaring minify... so you might want to put it back to what it was first and fix isDbg mode not to run express-minify.

@Zren
Copy link
Contributor Author

Zren commented Nov 20, 2014

isDbg mode doesn't activate express-minify

Ah yes. Debugging with unminified code helps. Except chrome (and probably firefox) can unminify/prettyprint it for you. Don't really see why debugging the NodeJS v8 runtime helps you debug responses but hey, I'll run with it.

Fixed the PR.

@Martii
Copy link
Member

Martii commented Nov 20, 2014

Fixed the PR.

I see that at Zren/OpenUserJS.org@66a7d9c...ad649d0 however I don't see it here.

Also can we please keep the Ace comment note in... I don't know if it's a stale test result by now but that's kind of a NOTE: thing that would be good to maintain for future testing.

@Martii
Copy link
Member

Martii commented Nov 20, 2014

Except chrome (and probably firefox) can unminify/prettyprint it for you.

As a FYI... That's great that client sides can do this... but not all debugging comes from client side reports... how do you think I resolved #395 so quickly?

@Zren
Copy link
Contributor Author

Zren commented Nov 20, 2014

I see that at Zren/OpenUserJS.org@66a7d9c...ad649d0 however I don't see it here.

Reload the page.

Also can we please keep the Ace comment note in... I don't know if it's a stale test result by now but that's kind of a NOTE: thing that would be good to maintain for future testing.

Done. And since we've established this is done... Merging.

Zren added a commit that referenced this pull request Nov 20, 2014
Make express-minify optional when isDev
@Zren Zren merged commit cf58da0 into OpenUserJS:master Nov 20, 2014
@Martii
Copy link
Member

Martii commented Nov 20, 2014

Reload the page.

GH shows that you didn't do it until just recently... not to mention those are ajaxed in so there is no need for a page refresh.

Done. And since we've established this is done... Merging.

LOL... don't get in trouble with sizzle here... he's temporarily left merging up to me until he says differently... so please respect his wishes... I do... so should you.

@Martii
Copy link
Member

Martii commented Nov 20, 2014

You also ignored the PR READY label and categorization too... but since I'm here we'll let it slide this time.

@Martii Martii added CODE Some other Code related issue and it should clearly describe what it is affecting in a comment. PR READY This is used to indicate that a pull request (PR) is ready for evaluation. enhancement Something we do have implemented already but needs improvement upon to the best of knowledge. and removed PR READY This is used to indicate that a pull request (PR) is ready for evaluation. labels Nov 20, 2014
@Zren
Copy link
Contributor Author

Zren commented Nov 20, 2014

Ah? Figured I was allowed to merge myself since I was added to the OUJS group (not that I have)... but alright.

@Martii
Copy link
Member

Martii commented Nov 20, 2014

Part of project administration is working with each other... sizzle initially didn't mind anyone merging but then they were too fearful to merge things... so then he took over full time on it... then he asked me to take over for a while... this could change the more we all communicate effectively together... I'd prefer the thumbs up thing and +1 and also leaving things to be discussed with other original founders... I will however ask questions when I feel something might be a concern myself as should you... but I'm going to try not to make things personal and keep it on a professional level. We all have our strengths and weaknesses... I've learned a great deal from you and I do appreciate that and I hope that my sharing has enlightened some others including you as well.

@Martii
Copy link
Member

Martii commented Nov 20, 2014

One last diddy... did ./package.json not get updated??? (and yes I refreshed that tab ;)

@Zren
Copy link
Contributor Author

Zren commented Nov 20, 2014

No, because it's not optional on production and didn't feel like dealing with it.

@Martii
Copy link
Member

Martii commented Nov 20, 2014

Alright thank you.

@sizzlemctwizzle
Copy link
Member

Change looks good to me. I remember saying this somewhere else, but when one person submits a PR, someone else should merge it when a consensus has been reached. The only exception is the active maintainer (because some stuff just needs to get done without waiting for input), who is Martii right now.

@Martii
Copy link
Member

Martii commented Nov 20, 2014

I should give some fair warning to everyone especially @Zren ... I just reread express-minify README.md and that project claims to compile less and sass files... so that may affect #249 and #223 ... so it may be important to get express-minify working on your development machines otherwise you might have a CSS issue crop up on those dev machines at a certain point.... I've held off on doing this but it is coming up.

@Martii Martii mentioned this pull request Nov 20, 2014
Martii pushed a commit to Martii/OpenUserJS.org that referenced this pull request Nov 21, 2014
* Apparently order is important again here and OpenUserJS#431 didn't take into account this by skipping regression testing
* Alter the routine to restore the order and the exception of not using `require` at the top is rescinded
* `try..catch` is still used for those devs with misconfigured environments
Martii pushed a commit to Martii/OpenUserJS.org that referenced this pull request Nov 21, 2014
Reapplies to:
* OpenUserJS#434
* OpenUserJS#431

Eventually this test should go away when @Zren takes the necessary time to reinstall his Windows machine instead of making a personal exception since his machine is misconfigured.
@Martii Martii mentioned this pull request Nov 21, 2014
@Zren
Copy link
Contributor Author

Zren commented Nov 23, 2014

Looks like I will be putting express-minify in optionalDependancies as node-sass does not build on heroku (linux-x64 / Node 0.10.33 / NPM 1.4.28) either.

I'm not the only one getting this. See: /sass/node-sass/issues/550

@Martii
Copy link
Member

Martii commented Nov 23, 2014

I think we need to do some diags here... what's your distro name? I'm already getting latest Ubuntu... 12 seems pretty old as mentioned over there.

@Zren
Copy link
Contributor Author

Zren commented Nov 23, 2014

99% sure it works for you because you have npm 2.x

-----> Installing dependencies
       npm WARN package.json mu2@0.5.20 No repository field.

       > kerberos@0.0.4 install /tmp/build_8dc75e935c442f3c08429832e2d30f9a/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
       > (node-gyp rebuild 2> builderror.log) || (exit 0)

       make: Entering directory `/tmp/build_8dc75e935c442f3c08429832e2d30f9a/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos/build'
         SOLINK_MODULE(target) Release/obj.target/kerberos.node
         SOLINK_MODULE(target) Release/obj.target/kerberos.node: Finished
         COPY Release/kerberos.node
       make: Leaving directory `/tmp/build_8dc75e935c442f3c08429832e2d30f9a/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos/build'

       > bson@0.2.15 install /tmp/build_8dc75e935c442f3c08429832e2d30f9a/node_modules/mongoose/node_modules/mongodb/node_modules/bson
       > (node-gyp rebuild 2> builderror.log) || (exit 0)

       make: Entering directory `/tmp/build_8dc75e935c442f3c08429832e2d30f9a/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'
         CXX(target) Release/obj.target/bson/ext/bson.o
         SOLINK_MODULE(target) Release/obj.target/bson.node
         SOLINK_MODULE(target) Release/obj.target/bson.node: Finished
         COPY Release/bson.node
       make: Leaving directory `/tmp/build_8dc75e935c442f3c08429832e2d30f9a/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'

       > node-sass@1.2.3 install /tmp/build_8dc75e935c442f3c08429832e2d30f9a/node_modules/express-minify/node_modules/node-sass
       > node scripts/install.js

       Binary downloaded and installed at /tmp/build_8dc75e935c442f3c08429832e2d30f9a/node_modules/express-minify/node_modules/node-sass/vendor/linux-x64/binding.node

       > node-sass@1.2.3 postinstall /tmp/build_8dc75e935c442f3c08429832e2d30f9a/node_modules/express-minify/node_modules/node-sass
       > node scripts/build.js

       `linux-x64` exists; testing

       module.js:356
         Module._extensions[extension](this, filename);
                                      ^
       Error: /usr/lib/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by /tmp/build_8dc75e935c442f3c08429832e2d30f9a/node_modules/express-minify/node_modules/node-sass/vendor/linux-x64/binding.node)
           at Module.load (module.js:356:32)
           at Function.Module._load (module.js:312:12)
           at Module.require (module.js:364:17)
           at require (module.js:380:17)
           at Object.<anonymous> (/tmp/build_8dc75e935c442f3c08429832e2d30f9a/node_modules/express-minify/node_modules/node-sass/lib/index.js:181:15)
           at Module._compile (module.js:456:26)
           at Object.Module._extensions..js (module.js:474:10)
           at Module.load (module.js:356:32)
           at Function.Module._load (module.js:312:12)
           at Module.require (module.js:364:17)
       npm ERR! node-sass@1.2.3 postinstall: `node scripts/build.js`
       npm ERR! Exit status 8
       npm ERR!
       npm ERR! Failed at the node-sass@1.2.3 postinstall script.
       npm ERR! This is most likely a problem with the node-sass package,
       npm ERR! not with npm itself.
       npm ERR! Tell the author that this fails on your system:
       npm ERR!     node scripts/build.js
       npm ERR! You can get their info via:
       npm ERR!     npm owner ls node-sass
       npm ERR! There is likely additional logging output above.

       npm ERR! System Linux 3.8.11-ec2
       npm ERR! command "/tmp/build_8dc75e935c442f3c08429832e2d30f9a/vendor/node/bin/node" "/tmp/build_8dc75e935c442f3c08429832e2d30f9a/vendor/node/bin/npm" "install" "--userconfig" "/tmp/build_8dc75e935c442f3c08429832e2d30f9a/.npmrc" "--pr
oduction"
       npm ERR! cwd /tmp/build_8dc75e935c442f3c08429832e2d30f9a
       npm ERR! node -v v0.10.33
       npm ERR! npm -v 1.4.28
       npm ERR! code ELIFECYCLE
       npm ERR! not ok code 0

 !     Push rejected, failed to compile Node.js app

To git@heroku.com:nameless-hollows-5487.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:nameless-hollows-5487.git'

Admin@ADMIN-PC ~/Code/Git/OpenUserJS.org (master)
$

@Martii
Copy link
Member

Martii commented Nov 23, 2014

because you have npm 2.x

Does $ sudo npm install npm -g work for you? That's how I did it at one point. npm1 was initially installed on my last years distro and it still did express-minify and all of it's dependencies... I redid this machine just in late Sept where I had 1.x something npm... but of course their dependencies may have updated too since then.

@Martii
Copy link
Member

Martii commented Nov 23, 2014

@Martii Martii changed the title Move express-minify to optionalDependencies Make express-minify optional for dev Nov 23, 2014
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CODE Some other Code related issue and it should clearly describe what it is affecting in a comment. enhancement Something we do have implemented already but needs improvement upon to the best of knowledge.
Development

Successfully merging this pull request may close these issues.

3 participants