registerguard / bulldog

The official 2013 registerguard.com theme.
http://registerguard.com
1 stars 1 forks source link

Update dependencies #204

Closed robertdenton closed 6 years ago

robertdenton commented 6 years ago

Bulldog is in need of a tuneup. Unfortunately, some of the dependencies have not been updated since 2013 or 2014 and will require a lot of hand holding. I anticipate a variety of syntax changes, different arguments and other issues that cannot be anticipated.

I've explored the idea of swapping to a different system altogether, like Gulp or Webpack, but I'm not sure we should chase the most recent trend. Grunt works, it's solid, it just needs a tune up. If/when we do the next redesign, it will be worth looking into new technology.

Looking ahead:

robertdenton commented 6 years ago

Dependency audit

name bulldog current notes last commit
grunt-cli (global) 0.1.13 1.2.0 4/5/16 (-1.5 years)
grunt ~0.4 1.0.1 ❓ Upgrade guide 7/9/17 (-0.5 years)
grunt-contrib-jshint 0.6.4 1.1.0 5/11/17 (-0.5 years)
grunt-contrib-clean 0.4.1 1.1.0 9/5/17 (-0 years)
grunt-contrib-uglify 0.2.2 3.1.0 10/11/17 (-0 years)
grunt-contrib-copy 0.4.1 1.0.0 4/14/16 (-1.5 years)
grunt-contrib-less ~1 1.4.1 ❓ (close) 10/30/17 (-0 years)
grunt-contrib-watch 0.4.4 1.0.0 8/16/17 (-0 years)
grunt-preprocess 2.3.0 5.1.0 2/21/16 (-1.5 years)
grunt-env 0.4.0 0.4.4 ❓ (close) 5/30/15 (-2.5 years)

Average age is nearly a year old. I have some concern that these dependencies may be sunsetting. Alternative is re-building in Gulp or Webpack, which I'd like to avoid. No need throwing that new tech in. Will try to update these to most modern in Grunt for now and see what happens.

Also, grunt-cli is installed globally so I need to test on my laptop before doing on work machine. Thinking it would be best to duplicate what's there now in a BAK directory elsewhere and can fall back if needed.

NPM and Node.js have both been updated so they match.

robertdenton commented 6 years ago

Notes (testing on laptop)

Updated grunt-cli, let's try an npm install on a clean Bulldog

⚡ npm install
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated minimatch@0.4.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN bulldog@1.0.0 No license field.

added 147 packages in 18.063s

Next step is to do a build and see if there is any difference in the exported files

This was done via BBEdit.

They are identical.


I'm curious as to why grunt-cli is listed as "grunt-cli": "0.1.13", in the package.json file. Going to remove it and node_modules and do a build and see if it works.

Installed well, no warnings other than Bulldog license.

Trying build... They are identical. Grunt-cli should be removed from package.json and installed globally, as Grunt suggests and as we are doing now. Not sure why it was included in the first place.


On a whim, I decided to update everything to current and run it and see what happens. Here's npm install:

⚡ npm install
npm WARN deprecated minimatch@1.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN grunt-contrib-jshint@0.11.0 requires a peer of grunt@~0.4.5 but none is installed. You must install peer dependencies yourself.
npm WARN bulldog@1.0.0 No license field.

added 252 packages in 18.463s

Surprisingly few errors, it appears jshint is actually up to 1.1.0, not 0.11.0 as their release page says. Fixing and updating...

No warnings except Bulldog license. Let's try a build and see what breaks...

⚡ grunt prod
Running "jshint:init" (jshint) task
>> 12 files lint free.

Running "env:prod" (env) task

Running "clean:prod" (clean) task
>> 0 paths cleaned.

Running "uglify:prod" (uglify) task
{ DefaultsError: `except` is not a supported option
  at DefaultsError.get (<anonymous>:79:23)
  at formatError (util.js:642:16)
  at formatValue (util.js:544:18)
  at inspect (util.js:324:10)
  at format (util.js:191:12)
  at Console.log (console.js:127:21)
  at /Users/rdenton/Desktop/bulldog/build/node_modules/grunt-contrib-uglify/tasks/uglify.js:144:17
  at Array.forEach (<anonymous>:null:null)
  at Object.<anonymous> (/Users/rdenton/Desktop/bulldog/build/node_modules/grunt-contrib-uglify/tasks/uglify.js:78:16)
  at Object.<anonymous> (/Users/rdenton/Desktop/bulldog/build/node_modules/grunt/lib/grunt/task.js:255:15)
  at Object.thisTask.fn (/Users/rdenton/Desktop/bulldog/build/node_modules/grunt/lib/grunt/task.js:73:16)
  at Object.<anonymous> (/Users/rdenton/Desktop/bulldog/build/node_modules/grunt/lib/util/task.js:294:30)
  at Task.runTaskFn (/Users/rdenton/Desktop/bulldog/build/node_modules/grunt/lib/util/task.js:244:24)
  at Task.<anonymous> (/Users/rdenton/Desktop/bulldog/build/node_modules/grunt/lib/util/task.js:293:12)
  at /Users/rdenton/Desktop/bulldog/build/node_modules/grunt/lib/util/task.js:220:11
  at _combinedTickCallback (internal/process/next_tick.js:131:7)
  at process._tickCallback (internal/process/next_tick.js:180:9)

  message: '`except` is not a supported option',
  defs: 
   { cache: null,
     eval: false,
     ie8: false,
     keep_fnames: false,
     properties: false,
     reserved: [],
     toplevel: false } }
>> Uglifying source ./files/js/preflight.js failed.
Warning: Uglification failed.
`except` is not a supported option. 
 Use --force to continue.

Aborted due to warnings.

First major issue: uglify does not accept except option. From looking at README of current docs, the except option was changed to reserved. See: https://github.com/gruntjs/grunt-contrib-uglify#reserved-identifiers

Going to try and change that and see what happens.


AND IT WORKED...??? What the heck... I'm shocked... Need to compare output files... And it was too good to be true. Every file is different, in a ton of ways... But the demo page renders correctly. It appears that there is some difference in how white space is rendered (fewer extraneous line breaks and tabbing is correct) and the uglification variables (var a is now e, etc.).

I should do some reading about those two topics and see if I can confirm these changes.

Changelogs are limited and I can't find information about these topics.

Without going one by one through each version of each dependency, I'm not sure how I could track the specific changes.

Not sure how to proceed...

Should I just update everything and do a build and push it to live and check to see if anything breaks? We can always fall back to the last build and with package.json we can fall back to the old dependencies since the updated grunt-cli is fine.

This could be done on my laptop so that my work machine is not infected. Then again, I may as well just do it on there. I'm more concerned with having to remove the 2017/10/31 directory from static. Not sure how that would be possible without a revert on the repo. Then again, we could just ignore that altogether and not worry about it if it doesn't work. Then push the old package.json and a new build from the next day as a "fix".


I thought it would be a good idea to compare file sizes since the BBEdit Find Differences was not successful. All of the files appear to be about the same size, except the index.html file. This is good because the index file is not used in production. Regardless, I'm intrigued as to what the difference is. Going to do a deep dive on the Find Differences for that file.

Also took a look at the changes in the JS files. Preflight is a good place to start because it's so short.

Some of the other files are smaller in the new versions, up to ~600 characters on bulldog.min.js. I looked at respond and that seemed to handle integers differently, or maybe timeouts? There's certainly some code different as it relates to timeouts. It's extremely hard to read uglified so it's tough to tell.


Given that it's getting later in the day, here's my plan for tomorrow:

  1. Create backup of entire bulldog project on work machine
  2. Update package.json to most recent files (mimic what I did on laptop)
  3. npm install
  4. Update 'except' to 'reserved'
  5. Go through build process until we have 2017/11/01 build directory
  6. Push changes to Github
  7. Pull changes from static
  8. Test on projects
  9. Test on go
  10. Test on main site
  11. If all good, update bulldog documentation and you're done

If anything goes sideways, we need to roll back all the places that were changed to 20171025. Then, revert the commit on Github for Mac and pull that revert to static. This should take everything back to the way it was. Then you'd have to npm install the old package.json and change 'reserved' to 'except'.

Here are backup versions of the new and old package.json files, formatted as .txt because Github does not suppoert JSON for some reason. package.BAK.txt package.txt

robertdenton commented 6 years ago

Executed the above plan. No issues that I can tell. This issue should serve as documentation. Closing.