Date: 11/29/2021
Following is the list of steps required to upgrade your project to SharePoint Framework version 1.13.1. Summary of the modifications is included at the end of the report.
Upgrade SharePoint Framework dependency package @microsoft/sp-core-library
Execute the following command:
npm i -SE @microsoft/sp-core-library@1.13.1File: ./package.json:14:5
Upgrade SharePoint Framework dependency package @microsoft/sp-lodash-subset
Execute the following command:
npm i -SE @microsoft/sp-lodash-subset@1.13.1File: ./package.json:15:5
Upgrade SharePoint Framework dependency package @microsoft/sp-office-ui-fabric-core
Execute the following command:
npm i -SE @microsoft/sp-office-ui-fabric-core@1.13.1File: ./package.json:16:5
Upgrade SharePoint Framework dependency package @microsoft/sp-webpart-base
Execute the following command:
npm i -SE @microsoft/sp-webpart-base@1.13.1File: ./package.json:18:5
Upgrade SharePoint Framework dependency package @microsoft/sp-property-pane
Execute the following command:
npm i -SE @microsoft/sp-property-pane@1.13.1File: ./package.json:17:5
Upgrade SharePoint Framework dev dependency package @microsoft/sp-build-web
Execute the following command:
npm i -DE @microsoft/sp-build-web@1.13.1File: ./package.json:36:5
Upgrade SharePoint Framework dev dependency package @microsoft/sp-module-interfaces
Execute the following command:
npm i -DE @microsoft/sp-module-interfaces@1.13.1File: ./package.json:38:5
Upgrade SharePoint Framework dev dependency package @microsoft/sp-tslint-rules
Execute the following command:
npm i -DE @microsoft/sp-tslint-rules@1.13.1File: ./package.json:37:5
In package-solution.json add developer section
{
"solution": {
"developer": {
"name": "",
"privacyUrl": "",
"termsOfUseUrl": "",
"websiteUrl": "",
"mpnId": "Undefined-1.13.1"
}
}
}File: ./config/package-solution.json:3:3
Update version in .yo-rc.json
{
"@microsoft/generator-sharepoint": {
"version": "1.13.1"
}
}File: ./.yo-rc.json:5:5
Upgrade SharePoint Framework dependency package react
Execute the following command:
npm i -SE react@16.13.1File: ./package.json:29:5
Upgrade SharePoint Framework dependency package react-dom
Execute the following command:
npm i -SE react-dom@16.13.1File: ./package.json:30:5
Upgrade SharePoint Framework dependency package office-ui-fabric-react
Execute the following command:
npm i -SE office-ui-fabric-react@7.174.1File: ./package.json:28:5
Remove SharePoint Framework dev dependency package @microsoft/sp-webpart-workbench
Execute the following command:
npm un -D @microsoft/sp-webpart-workbenchFile: ./package.json:39:5
Install SharePoint Framework dev dependency package @types/react
Execute the following command:
npm i -DE @types/react@16.9.51File: ./package.json:35:3
Install SharePoint Framework dev dependency package @microsoft/rush-stack-compiler-3.9
Execute the following command:
npm i -DE @microsoft/rush-stack-compiler-3.9@0.4.47File: ./package.json:35:3
Update serve.json initialPage URL
{
"initialPage": "https://enter-your-SharePoint-site/_layouts/workbench.aspx"
}File: ./config/serve.json:5:3
From serve.json remove the api property
File: ./config/serve.json:6:3
Update tsconfig.json extends property
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.9/includes/tsconfig-web.json"
}File: ./tsconfig.json:2:3
In the .vscode/launch.json file, remove the local workbench launch configuration
File: .vscode/launch.json:11:7
Remove file config/copy-assets.json
Execute the following command:
rm "config/copy-assets.json"File: config/copy-assets.json
Create the .npmignore file
File: ./.npmignore
Update deploy-azure-storage.json workingDir
{
"workingDir": "./release/assets/"
}File: ./config/deploy-azure-storage.json:3:3
To .gitignore add the 'release' folder
File: ./.gitignore
Upgrade SharePoint Framework dev dependency package gulp
Execute the following command:
npm i -DE gulp@4.0.2File: ./package.json:41:5
Remove SharePoint Framework dev dependency package @types/chai
Execute the following command:
npm un -D @types/chaiFile: ./package.json:42:5
Remove SharePoint Framework dev dependency package @types/mocha
Execute the following command:
npm un -D @types/mochaFile: ./package.json:43:5
Install SharePoint Framework dev dependency package @types/react-dom
Execute the following command:
npm i -DE @types/react-dom@16.9.8File: ./package.json:35:3
Remove tsconfig.json exclude property
{
"exclude": []
}File: ./tsconfig.json:34:3
Add es2015.promise lib in tsconfig.json
{
"compilerOptions": {
"lib": [
"es2015.promise"
]
}
}File: ./tsconfig.json:25:5
Remove es6-promise type in tsconfig.json
{
"compilerOptions": {
"types": [
"es6-promise"
]
}
}File: ./tsconfig.json:22:7
Before 'build.initialize(require('gulp'));' add the serve task
var getTasks = build.rig.getTasks;
build.rig.getTasks = function () {
var result = getTasks.call(build.rig);
result.set('serve', result.get('serve-deprecated'));
return result;
};File: ./gulpfile.js
Remove file .editorconfig
Execute the following command:
rm ".editorconfig"File: .editorconfig
Update tslint.json extends property
{
"extends": "./node_modules/@microsoft/sp-tslint-rules/base-tslint.json"
}File: ./tslint.json:2:3
Remove package.json property
{
"engines": "undefined"
}File: ./package.json:5:3
Remove SharePoint Framework dependency package @types/react
Execute the following command:
npm un -S @types/reactFile: ./package.json:25:5
Remove SharePoint Framework dependency package @types/react-dom
Execute the following command:
npm un -S @types/react-domFile: ./package.json:26:5
Remove SharePoint Framework dependency package @types/webpack-env
Execute the following command:
npm un -S @types/webpack-envFile: ./package.json:27:5
Remove SharePoint Framework dependency package @types/es6-promise
Execute the following command:
npm un -S @types/es6-promiseFile: ./package.json:24:5
Install SharePoint Framework dev dependency package @types/webpack-env
Execute the following command:
npm i -DE @types/webpack-env@1.13.1File: ./package.json:35:3
Install SharePoint Framework dev dependency package @types/es6-promise
Execute the following command:
npm i -DE @types/es6-promise@0.0.33File: ./package.json:35:3
Add to the tsconfig.json include property
{
"include": [
"src/**/*.tsx"
]
}File: ./tsconfig.json:31:3
Add resolution for package @types/react
{
"resolutions": {
"@types/react": "16.8.8"
}
}File: ./package.json:33:5
Add package.json property
{
"main": "lib/index.js"
}File: ./package.json:1:1
Remove scss file import
@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss'File: src/components/SearchResultCard/SearchResultCard.module.scss
Remove scss file import
@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss'File: src/components/SearchResultCardCompact/SearchResultCardCompact.module.scss
Remove scss file import
@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss'File: src/webparts/pagedSearch/components/PagedSearch.module.scss
Remove scss file import
@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss'File: src/webparts/productSearch/components/ProductSearch.module.scss
Remove scss file import
@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss'File: src/webparts/spcSearch/components/SpcSearch.module.scss
Add scss file import
@import '~office-ui-fabric-react/dist/sass/References.scss'File: src/components/SearchResultCard/SearchResultCard.module.scss
Add scss file import
@import '~office-ui-fabric-react/dist/sass/References.scss'File: src/components/SearchResultCardCompact/SearchResultCardCompact.module.scss
Add scss file import
@import '~office-ui-fabric-react/dist/sass/References.scss'File: src/webparts/pagedSearch/components/PagedSearch.module.scss
Add scss file import
@import '~office-ui-fabric-react/dist/sass/References.scss'File: src/webparts/productSearch/components/ProductSearch.module.scss
Add scss file import
@import '~office-ui-fabric-react/dist/sass/References.scss'File: src/webparts/spcSearch/components/SpcSearch.module.scss
If, after upgrading npm packages, when building the project you have errors similar to: "error TS2345: Argument of type 'SPHttpClientConfiguration' is not assignable to parameter of type 'SPHttpClientConfiguration'", try running 'npm dedupe' to cleanup npm packages.
Execute the following command:
npm dedupeFile: ./package.json
npm un -S @types/react @types/react-dom @types/webpack-env @types/es6-promise
npm un -D @microsoft/sp-webpart-workbench @types/chai @types/mocha
npm i -SE @microsoft/sp-core-library@1.13.1 @microsoft/sp-lodash-subset@1.13.1 @microsoft/sp-office-ui-fabric-core@1.13.1 @microsoft/sp-webpart-base@1.13.1 @microsoft/sp-property-pane@1.13.1 react@16.13.1 react-dom@16.13.1 office-ui-fabric-react@7.174.1
npm i -DE @microsoft/sp-build-web@1.13.1 @microsoft/sp-module-interfaces@1.13.1 @microsoft/sp-tslint-rules@1.13.1 @types/react@16.9.51 @microsoft/rush-stack-compiler-3.9@0.4.47 gulp@4.0.2 @types/react-dom@16.9.8 @types/webpack-env@1.13.1 @types/es6-promise@0.0.33
npm dedupe
rm "config/copy-assets.json"
rm ".editorconfig"In package-solution.json add developer section:
{
"solution": {
"developer": {
"name": "",
"privacyUrl": "",
"termsOfUseUrl": "",
"websiteUrl": "",
"mpnId": "Undefined-1.13.1"
}
}
}Update version in .yo-rc.json:
{
"@microsoft/generator-sharepoint": {
"version": "1.13.1"
}
}Update serve.json initialPage URL:
{
"initialPage": "https://enter-your-SharePoint-site/_layouts/workbench.aspx"
}From serve.json remove the api property:
Update tsconfig.json extends property:
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.9/includes/tsconfig-web.json"
}Remove tsconfig.json exclude property:
{
"exclude": []
}Add es2015.promise lib in tsconfig.json:
{
"compilerOptions": {
"lib": [
"es2015.promise"
]
}
}Remove es6-promise type in tsconfig.json:
{
"compilerOptions": {
"types": [
"es6-promise"
]
}
}Add to the tsconfig.json include property:
{
"include": [
"src/**/*.tsx"
]
}In the .vscode/launch.json file, remove the local workbench launch configuration:
Create the .npmignore file:
!dist
config
gulpfile.js
release
src
temp
tsconfig.json
tslint.json
*.log
.yo-rc.json
.vscode
Update deploy-azure-storage.json workingDir:
{
"workingDir": "./release/assets/"
}To .gitignore add the 'release' folder:
release
Before 'build.initialize(require('gulp'));' add the serve task:
var getTasks = build.rig.getTasks;
build.rig.getTasks = function () {
var result = getTasks.call(build.rig);
result.set('serve', result.get('serve-deprecated'));
return result;
};Update tslint.json extends property:
{
"extends": "./node_modules/@microsoft/sp-tslint-rules/base-tslint.json"
}Remove package.json property:
{
"engines": "undefined"
}Add resolution for package @types/react:
{
"resolutions": {
"@types/react": "16.8.8"
}
}Add package.json property:
{
"main": "lib/index.js"
}Remove scss file import:
@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss'Add scss file import:
@import '~office-ui-fabric-react/dist/sass/References.scss'Remove scss file import:
@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss'Add scss file import:
@import '~office-ui-fabric-react/dist/sass/References.scss'Remove scss file import:
@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss'Add scss file import:
@import '~office-ui-fabric-react/dist/sass/References.scss'Remove scss file import:
@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss'Add scss file import:
@import '~office-ui-fabric-react/dist/sass/References.scss'Remove scss file import:
@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss'Add scss file import:
@import '~office-ui-fabric-react/dist/sass/References.scss'