This post has been cross-posted to the Voitanos blog here: SharePoint Framework Generator Updated to v1.5.0: Inspecting the Changes.
Yesterday Microsoft released a new version of the SharePoint Framework (SPFx) generator to version 1.5. I took some time picking apart the update and in this post, I will show you what these changes have in store for you.
What’s in this update?
- New stuff
- Dynamic Data (developer preview)
- More Package Manager support (Yarn & PNPM)
- Opt-in to trying new features
- Updates & changes
There are a few other updates you can read about in the release notes for v1.5:
The good news is that it doesn’t appear that there is too much work to upgrade your existing projects from v1.4.1 to v1.5.
Check if your currently installed generator is outdated:
npm outdated --global
If the generator is listed in the results of that command, then you are outdated.
Grab the latest version by running:
npm install @microsoft/generator-sharepoint --global
Let’s start by looking at what’s in this update.
Seasoned SharePoint developers are familiar with the concept of web part connections. This is a feature, until today, that we haven’t had in the SPFx. Dynamic Data is a feature in SPFx that effectively creates a client-side service bus service that implements the pub-sub model.
One SPFx component publishes data and another component can consume that data. This can be any type of SPFx component including web parts and extensions!
Note that this feature is released as a developer preview, not straight to generally available (GA).
You can see more details on dynamic data in the docs: Connect SharePoint Framework components using dynamic data
More package manager support
In the past I’ve blogged how I prefer Yarn over NPM for my package manager of choice. Unfortunately, this means that every time I generate a new project, I have to include
--skip-install every time I ran the generator.
With this update, you can include the
--package-manager switch and pass in npm, yarn or pnpm to use the package manager you want to use.
Opt-in to trying new features
In the past, every release of the SPFx Yeoman generator would include not only features that were available in production, but also features that were in a preview state. Unless you stay on top of things, it is sometimes hard to know what’s in preview and what isn’t.
New to the latest generator for SPFx v1.5, if you include the
--plusbeta flag when running the generator, different NPM packages will be used that include packages that include features not currently in production.
Packages reference specific versions
This is a big change from the past… and one I love! Now when you create a new project, you won’t have wildcards in the NPM package versions that will be automatically updated to new versions if they are available.
Personally, I want to have full control over my versions and decide when I want to update them so one step I’ve always done is to remove the ranges or other indicators in the versions.
While this doesn’t really impact the SPFx packages, it does impact the TypeScript type declaration packages… these have been the root cause for build errors for many React-based projects in the past.
React Web Parts are unmounted when disposed by default
This is a small, but welcomed update. Now when you use the generator to create new React based web parts, when the web part is disposed on the page, it will unmount the React component.
We could have added this code ourselves, but it’s nice to have that step removed for us.
Heads up if you use command line switches with the generator
It seems someone decided to rename some of the internal properties in the generator that are set by the prompts we get when running it. Well, this means that the automatically generated command line arguments were also renamed, so things like
--componentName are now
» See the full list of switches in the official SPFx docs.
What’s Not in SPFx v1.5
I have to admit, I had higher expectations for this release. There were a few things we saw at the Build conference & SharePoint Conference last month that I expected we’d see in this release… at least in a preview state.
- No GA for the Microsoft Graph API
- NO GA for the Azure AD API
- No update for React v16 in SPO… still on v15
- No preview for client side list notifications via socket.io
- No update on the tenant-wide deployment of SPFx extensions
All in all, v1.5 is a good release, I guess my sights were set a bit too high. Here’s to seeing what comes in v1.6!comments powered by Disqus