sp-dev-fx-webparts/samples/react-add-js-css-ref/upgrade.md

9.4 KiB

Upgrade project react-add-js-css-ref to v1.15.2

Date: 10/20/2022

Findings

Following is the list of steps required to upgrade your project to SharePoint Framework version 1.15.2. Summary of the modifications is included at the end of the report.

FN001001 @microsoft/sp-core-library | Required

Upgrade SharePoint Framework dependency package @microsoft/sp-core-library

Execute the following command:

npm i -SE @microsoft/sp-core-library@1.15.2

File: ./package.json:14:5

FN001021 @microsoft/sp-property-pane | Required

Upgrade SharePoint Framework dependency package @microsoft/sp-property-pane

Execute the following command:

npm i -SE @microsoft/sp-property-pane@1.15.2

File: ./package.json:18:5

FN001004 @microsoft/sp-webpart-base | Required

Upgrade SharePoint Framework dependency package @microsoft/sp-webpart-base

Execute the following command:

npm i -SE @microsoft/sp-webpart-base@1.15.2

File: ./package.json:19:5

FN001002 @microsoft/sp-lodash-subset | Required

Upgrade SharePoint Framework dependency package @microsoft/sp-lodash-subset

Execute the following command:

npm i -SE @microsoft/sp-lodash-subset@1.15.2

File: ./package.json:16:5

FN001003 @microsoft/sp-office-ui-fabric-core | Required

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.15.2

File: ./package.json:17:5

FN001034 @microsoft/sp-adaptive-card-extension-base | Optional

Install SharePoint Framework dependency package @microsoft/sp-adaptive-card-extension-base

Execute the following command:

npm i -SE @microsoft/sp-adaptive-card-extension-base@1.15.2

File: ./package.json:11:3

FN001013 @microsoft/decorators | Required

Upgrade SharePoint Framework dependency package @microsoft/decorators

Execute the following command:

npm i -SE @microsoft/decorators@1.15.2

File: ./package.json:12:5

FN001011 @microsoft/sp-dialog | Required

Upgrade SharePoint Framework dependency package @microsoft/sp-dialog

Execute the following command:

npm i -SE @microsoft/sp-dialog@1.15.2

File: ./package.json:15:5

FN001012 @microsoft/sp-application-base | Required

Upgrade SharePoint Framework dependency package @microsoft/sp-application-base

Execute the following command:

npm i -SE @microsoft/sp-application-base@1.15.2

File: ./package.json:13:5

FN002022 @microsoft/eslint-plugin-spfx | Required

Install SharePoint Framework dev dependency package @microsoft/eslint-plugin-spfx

Execute the following command:

npm i -DE @microsoft/eslint-plugin-spfx@1.15.2

File: ./package.json:26:3

FN002023 @microsoft/eslint-config-spfx | Required

Install SharePoint Framework dev dependency package @microsoft/eslint-config-spfx

Execute the following command:

npm i -DE @microsoft/eslint-config-spfx@1.15.2

File: ./package.json:26:3

FN002002 @microsoft/sp-module-interfaces | Required

Upgrade SharePoint Framework dev dependency package @microsoft/sp-module-interfaces

Execute the following command:

npm i -DE @microsoft/sp-module-interfaces@1.15.2

File: ./package.json:30:5

FN002026 typescript | Required

Install SharePoint Framework dev dependency package typescript

Execute the following command:

npm i -DE typescript@4.5.5

File: ./package.json:26:3

Update version in .yo-rc.json

{
  "@microsoft/generator-sharepoint": {
    "version": "1.15.2"
  }
}

File: ./.yo-rc.json:5:5

FN012020 tsconfig.json noImplicitAny | Required

Add noImplicitAny in tsconfig.json

{
  "compilerOptions": {
    "noImplicitAny": true
  }
}

File: ./tsconfig.json:3:22

FN007001 serve.json schema | Required

Update serve.json schema URL

{
  "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json"
}

File: ./config/serve.json:2:3

FN001022 office-ui-fabric-react | Required

Upgrade SharePoint Framework dependency package office-ui-fabric-react

Execute the following command:

npm i -SE office-ui-fabric-react@7.185.7

File: ./package.json:22:5

FN001033 tslib | Required

Install SharePoint Framework dependency package tslib

Execute the following command:

npm i -SE tslib@2.3.1

File: ./package.json:11:3

FN002007 ajv | Required

Upgrade SharePoint Framework dev dependency package ajv

Execute the following command:

npm i -DE ajv@6.12.5

File: ./package.json:36:5

FN002009 @microsoft/sp-tslint-rules | Required

Remove SharePoint Framework dev dependency package @microsoft/sp-tslint-rules

Execute the following command:

npm un -D @microsoft/sp-tslint-rules

File: ./package.json:31:5

FN002013 @types/webpack-env | Required

Upgrade SharePoint Framework dev dependency package @types/webpack-env

Execute the following command:

npm i -DE @types/webpack-env@1.15.2

File: ./package.json:35:5

FN002020 @microsoft/rush-stack-compiler-4.5 | Required

Install SharePoint Framework dev dependency package @microsoft/rush-stack-compiler-4.5

Execute the following command:

npm i -DE @microsoft/rush-stack-compiler-4.5@0.2.2

File: ./package.json:26:3

FN002021 @rushstack/eslint-config | Required

Install SharePoint Framework dev dependency package @rushstack/eslint-config

Execute the following command:

npm i -DE @rushstack/eslint-config@2.5.1

File: ./package.json:26:3

FN002024 eslint | Required

Install SharePoint Framework dev dependency package eslint

Execute the following command:

npm i -DE eslint@8.7.0

File: ./package.json:26:3

FN002025 eslint-plugin-react-hooks | Required

Install SharePoint Framework dev dependency package eslint-plugin-react-hooks

Execute the following command:

npm i -DE eslint-plugin-react-hooks@4.3.0

File: ./package.json:26:3

FN012017 tsconfig.json extends property | Required

Update tsconfig.json extends property

{
  "extends": "./node_modules/@microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json"
}

File: ./tsconfig.json:2:3

FN015003 tslint.json | Required

Remove file tslint.json

Execute the following command:

rm "tslint.json"

File: tslint.json

FN015008 .eslintrc.js | Required

Add file .eslintrc.js

Execute the following command:

cat > ".eslintrc.js" << EOF 
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
  extends: ['@microsoft/eslint-config-spfx/lib/profiles/react'],
  parserOptions: { tsconfigRootDir: __dirname }
};
EOF

File: .eslintrc.js

FN023002 .gitignore '.heft' folder | Required

To .gitignore add the '.heft' folder

File: ./.gitignore

FN017001 Run npm dedupe | Optional

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 dedupe

File: ./package.json

Summary

Execute script

npm un -D @microsoft/sp-tslint-rules
npm i -SE @microsoft/sp-core-library@1.15.2 @microsoft/sp-property-pane@1.15.2 @microsoft/sp-webpart-base@1.15.2 @microsoft/sp-lodash-subset@1.15.2 @microsoft/sp-office-ui-fabric-core@1.15.2 @microsoft/sp-adaptive-card-extension-base@1.15.2 @microsoft/decorators@1.15.2 @microsoft/sp-dialog@1.15.2 @microsoft/sp-application-base@1.15.2 office-ui-fabric-react@7.185.7 tslib@2.3.1
npm i -DE @microsoft/eslint-plugin-spfx@1.15.2 @microsoft/eslint-config-spfx@1.15.2 @microsoft/sp-module-interfaces@1.15.2 typescript@4.5.5 ajv@6.12.5 @types/webpack-env@1.15.2 @microsoft/rush-stack-compiler-4.5@0.2.2 @rushstack/eslint-config@2.5.1 eslint@8.7.0 eslint-plugin-react-hooks@4.3.0
npm dedupe
rm "tslint.json"
cat > ".eslintrc.js" << EOF 
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
  extends: ['@microsoft/eslint-config-spfx/lib/profiles/react'],
  parserOptions: { tsconfigRootDir: __dirname }
};
EOF

Modify files

./.yo-rc.json

Update version in .yo-rc.json:

{
  "@microsoft/generator-sharepoint": {
    "version": "1.15.2"
  }
}

./tsconfig.json

Add noImplicitAny in tsconfig.json:

{
  "compilerOptions": {
    "noImplicitAny": true
  }
}

Update tsconfig.json extends property:

{
  "extends": "./node_modules/@microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json"
}

./config/serve.json

Update serve.json schema URL:

{
  "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json"
}

./.gitignore

To .gitignore add the '.heft' folder:

.heft