… another title for this blog post could be: “How to use SharePoint Framework and share code between projects without Microsoft’s SharePoint Framework Library component or NPM registry.
[Read more]
Tips and Tricks working with SPFx library components
Following the instruction on how to create a library component, get you pretty easy up and running to try out this new feature.
To make it production-ready you have to do some manual steps and tweaks. Here are some suggestions.
What you should know about semantic package versioning in SPFx
There are many blog posts out there that show how you can install packages to your SPFx project. Many of those projects tell you that you have to install exactly this specific version.
To give you an example upgrading your rush stack compiler in an existing project you can use the following line of code.
Use `npm version` to upgrade the version of your SPFx solution
When you like to version your SPFx solutions correctly, then it is not enough to upgrade only the ‘package-solution.json’ in the config folder. You might also want to upgrade the ‘package.json’ file with a corresponding version number too.
How to use specific NodeJS version with your SPFx project
Like I promised yesterday. You can even run a specific SPFx generator version with a specific NodeJS version through the help of NPM.
While it might not is a practical approach it can help you sometimes when you like to run for example an older version of the project to test some behaviour before you fix the issues.
How to create an SPFx project using a specific version
Have you ever wanted to run an older version of the SPFx generator? Maybe on an existing project to add some new assets? It is possible without any installation of the generator at all. Recently a tool was released inside your NPM installation that is named ‘NPX‘.
In short, NPX is a tool that allows you to run npm binaries and packages without having them installed locally. This tool got first released in NPM 5.2.0.
NPM 6.0 and SharePoint Framework – Security Reporting
In case you recently upgrade NPM to Version 6.0 and created a new SharePoint Project through the Yeoman generator. There is a chance that you recognised the following new notification at the end of the NPM installation process.
What there are five vulnerabilities, one with severity low and four with severity high and I can run ‘npm audit’ to get a detailed report?
Don’t start to scream “fire” and run in panic through your office, uninstall all your SPFx projects from all your tenants, clean up your CDN, keep calm and learn the reason why this gets now reported after the installation.
NPM Package for Office UI Fabric colours released – Ok a while back
A while back I wrote about on how to use the theme slots in the SPFx projects through SASS. It allows you to write web parts that reflect the default theme colours of a site. Instead, using fixed colour values, you can use variables in the CSS code of your artefacts.
To make the overall process faster I recently released and NPM packages including all the SASS colours plus some extras.
Keep your SPFX and NPM Packages up-to-date
Now the SharePoint Framework has become general available I expect that it requires only to update only the npm packages mostly. A simple upgrade of the installed packages will be enough in future. During the beta phase you add to do manual step in addition to upgrade your project to the latest drop.