Did you know the SharePoint team at Microsoft updated the Yeoman generator, @microsoft/generator-sharepoint, twice in the last month? Yeah… I didn’t either until yesterday.
The final version was released on February 23, 2017, as version 1.0.0. They then slipped two more updates in early April in quick succession as versions 1.0.1 & 1.0.2. Unfortunately, Microsoft still hasn’t published the repo for the generator or made the homepage for it in the NPMJS registry of any use… just some boilerplate copy… so it’s not easy to figure out what’s changed.
I’ll first explain what changed in each version, then I’ll share how I figured it out so you can do the same in the future.
What Changed in version 1.0.1
Version 1.0.1, published on April 3, 2017, made one small change. It updated the
devDependency in the generated
package.json to include version 1.0.1 of the @microsoft/sp-build-web package.
What Changed in version 1.0.2
Version 1.0.2, published on April 5, 2017, applied an even smaller change than what we saw in version 1.0.1. It simply removed the TSLINT rule prefer-const from the generated
tslint.json that requires variable definitions use the
const keyword instead of
var when possible. For instance, if you set a variable and never intend to change it, you should use const.
This is a good rule to have in your TSLINT settings, but someone convinced Microsoft to not only remove it but ship an update to the package to reflect it. Oh well…
How To Figure Out The Change History
When Microsoft isn’t sharing the repo or providing a useful homepage for the generator (and related packages for that matter), how are you supposed to figure out what changed in new versions?
First, you have to know there’s a new version!
Determine if there are Updated Packages
You first have to figure out if there is a new version available. Use NPM’s outdated command to do this. Make sure you include the global flag since this is a global package:
npm outdated --global
If an installed package has a newer version listed, it will be listed. There are three columns listed:
- Current: the version you currently have installed
- Wanted: the max version of the package that satisfies the semver range specified
- Latest: the version of the package tagged as latest in the NPM registry
To update the package, simply reinstall it. So in the case of the SharePoint Framework generator:
npm i @microsoft/generator-sharepoint -g
What’s in the New Version?
Now, how do you see the changelog? You can first see a list of the published version history from NPM. Do that using the NPM info command:
npm info @microsoft/generator-sharepoint -g
That will output a JSON string… notice the time listing:
That is how I figured out the date of the versions.
But how do you figure out what’s in those new versions? That’s where I had to hope that the engineers at Microsoft were keeping a changelog, which they thankfully did. This is usually found in the root of the project.
First, you have to find the location of the installed global module. Find the location where all your global modules are installed. If you run
npm with no arguments, the last night will tell you where it is.
Because I use NVM (I recently blogged about the merits of NVM if you want to learn more), my path on MacOS is:
~/.nvm/versions/node/v7.7.3/lib/node_modules. Within that folder, there’s a
@microsoft subfolder, and within that, I find the generator, and within that folder, I’ll find the changelog.
Open the changelog, in this case
CHANGELOG.md, and inspect the entries the team has added. In this case, they listed both versions with a mention of what each included:
- 1.0.1: Updating the dependent version of sp-build-web to ensure office-ui-fabric-react can be bundled correctly.
- 1.0.2: Disabled prefer-const rule