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

444 lines
9.4 KiB
Markdown
Raw Normal View History

2022-10-20 12:57:30 -04:00
# Upgrade project react-add-js-css-ref to v1.15.2
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Date: 10/20/2022
2022-10-19 09:23:44 -04:00
## Findings
2022-10-20 12:57:30 -04:00
Following is the list of steps required to upgrade your project to SharePoint Framework version 1.15.2. [Summary](#Summary) of the modifications is included at the end of the report.
2022-10-19 09:23:44 -04:00
### FN001001 @microsoft/sp-core-library | Required
Upgrade SharePoint Framework dependency package @microsoft/sp-core-library
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -SE @microsoft/sp-core-library@1.15.2
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:14:5](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN001021 @microsoft/sp-property-pane | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Upgrade SharePoint Framework dependency package @microsoft/sp-property-pane
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -SE @microsoft/sp-property-pane@1.15.2
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:18:5](./package.json)
2022-10-19 09:23:44 -04:00
### FN001004 @microsoft/sp-webpart-base | Required
Upgrade SharePoint Framework dependency package @microsoft/sp-webpart-base
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -SE @microsoft/sp-webpart-base@1.15.2
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:19:5](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN001002 @microsoft/sp-lodash-subset | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Upgrade SharePoint Framework dependency package @microsoft/sp-lodash-subset
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -SE @microsoft/sp-lodash-subset@1.15.2
2022-10-19 09:23:44 -04:00
```
File: [./package.json:16:5](./package.json)
2022-10-20 12:57:30 -04:00
### FN001003 @microsoft/sp-office-ui-fabric-core | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Upgrade SharePoint Framework dependency package @microsoft/sp-office-ui-fabric-core
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -SE @microsoft/sp-office-ui-fabric-core@1.15.2
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:17:5](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN001034 @microsoft/sp-adaptive-card-extension-base | Optional
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Install SharePoint Framework dependency package @microsoft/sp-adaptive-card-extension-base
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -SE @microsoft/sp-adaptive-card-extension-base@1.15.2
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:11:3](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN001013 @microsoft/decorators | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Upgrade SharePoint Framework dependency package @microsoft/decorators
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -SE @microsoft/decorators@1.15.2
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:12:5](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN001011 @microsoft/sp-dialog | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Upgrade SharePoint Framework dependency package @microsoft/sp-dialog
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -SE @microsoft/sp-dialog@1.15.2
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:15:5](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN001012 @microsoft/sp-application-base | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Upgrade SharePoint Framework dependency package @microsoft/sp-application-base
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -SE @microsoft/sp-application-base@1.15.2
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:13:5](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN002022 @microsoft/eslint-plugin-spfx | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Install SharePoint Framework dev dependency package @microsoft/eslint-plugin-spfx
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -DE @microsoft/eslint-plugin-spfx@1.15.2
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:26:3](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN002023 @microsoft/eslint-config-spfx | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Install SharePoint Framework dev dependency package @microsoft/eslint-config-spfx
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -DE @microsoft/eslint-config-spfx@1.15.2
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:26:3](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN002002 @microsoft/sp-module-interfaces | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Upgrade SharePoint Framework dev dependency package @microsoft/sp-module-interfaces
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -DE @microsoft/sp-module-interfaces@1.15.2
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:30:5](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN002026 typescript | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Install SharePoint Framework dev dependency package typescript
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -DE typescript@4.5.5
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:26:3](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN010001 .yo-rc.json version | Recommended
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Update version in .yo-rc.json
2022-10-19 09:23:44 -04:00
```json
{
2022-10-20 12:57:30 -04:00
"@microsoft/generator-sharepoint": {
"version": "1.15.2"
}
2022-10-19 09:23:44 -04:00
}
```
2022-10-20 12:57:30 -04:00
File: [./.yo-rc.json:5:5](./.yo-rc.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN012020 tsconfig.json noImplicitAny | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Add noImplicitAny in tsconfig.json
2022-10-19 09:23:44 -04:00
```json
{
2022-10-20 12:57:30 -04:00
"compilerOptions": {
"noImplicitAny": true
}
2022-10-19 09:23:44 -04:00
}
```
2022-10-20 12:57:30 -04:00
File: [./tsconfig.json:3:22](./tsconfig.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN007001 serve.json schema | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Update serve.json schema URL
2022-10-19 09:23:44 -04:00
```json
{
2022-10-20 12:57:30 -04:00
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json"
2022-10-19 09:23:44 -04:00
}
```
2022-10-20 12:57:30 -04:00
File: [./config/serve.json:2:3](./config/serve.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN001022 office-ui-fabric-react | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Upgrade SharePoint Framework dependency package office-ui-fabric-react
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -SE office-ui-fabric-react@7.185.7
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:22:5](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN001033 tslib | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Install SharePoint Framework dependency package tslib
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -SE tslib@2.3.1
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:11:3](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN002007 ajv | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Upgrade SharePoint Framework dev dependency package ajv
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -DE ajv@6.12.5
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:36:5](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN002009 @microsoft/sp-tslint-rules | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Remove SharePoint Framework dev dependency package @microsoft/sp-tslint-rules
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm un -D @microsoft/sp-tslint-rules
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:31:5](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN002013 @types/webpack-env | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Upgrade SharePoint Framework dev dependency package @types/webpack-env
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Execute the following command:
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
```sh
npm i -DE @types/webpack-env@1.15.2
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:35:5](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN002020 @microsoft/rush-stack-compiler-4.5 | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Install SharePoint Framework dev dependency package @microsoft/rush-stack-compiler-4.5
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Execute the following command:
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
```sh
npm i -DE @microsoft/rush-stack-compiler-4.5@0.2.2
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:26:3](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN002021 @rushstack/eslint-config | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Install SharePoint Framework dev dependency package @rushstack/eslint-config
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -DE @rushstack/eslint-config@2.5.1
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:26:3](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN002024 eslint | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Install SharePoint Framework dev dependency package eslint
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -DE eslint@8.7.0
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:26:3](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN002025 eslint-plugin-react-hooks | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Install SharePoint Framework dev dependency package eslint-plugin-react-hooks
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
npm i -DE eslint-plugin-react-hooks@4.3.0
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./package.json:26:3](./package.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN012017 tsconfig.json extends property | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Update tsconfig.json extends property
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
```json
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json"
}
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [./tsconfig.json:2:3](./tsconfig.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN015003 tslint.json | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Remove file tslint.json
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
rm "tslint.json"
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [tslint.json](tslint.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN015008 .eslintrc.js | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Add file .eslintrc.js
2022-10-19 09:23:44 -04:00
Execute the following command:
```sh
2022-10-20 12:57:30 -04:00
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
2022-10-19 09:23:44 -04:00
```
2022-10-20 12:57:30 -04:00
File: [.eslintrc.js](.eslintrc.js)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
### FN023002 .gitignore '.heft' folder | Required
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
To .gitignore add the '.heft' folder
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
File: [./.gitignore](./.gitignore)
2022-10-19 09:23:44 -04:00
### 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:
```sh
npm dedupe
```
File: [./package.json](./package.json)
## Summary
### Execute script
```sh
2022-10-20 12:57:30 -04:00
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
2022-10-19 09:23:44 -04:00
npm dedupe
2022-10-20 12:57:30 -04:00
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
2022-10-19 09:23:44 -04:00
```
### Modify files
#### [./.yo-rc.json](./.yo-rc.json)
Update version in .yo-rc.json:
```json
{
"@microsoft/generator-sharepoint": {
2022-10-20 12:57:30 -04:00
"version": "1.15.2"
2022-10-19 09:23:44 -04:00
}
}
```
#### [./tsconfig.json](./tsconfig.json)
2022-10-20 12:57:30 -04:00
Add noImplicitAny in tsconfig.json:
2022-10-19 09:23:44 -04:00
```json
{
"compilerOptions": {
2022-10-20 12:57:30 -04:00
"noImplicitAny": true
2022-10-19 09:23:44 -04:00
}
}
```
2022-10-20 12:57:30 -04:00
Update tsconfig.json extends property:
2022-10-19 09:23:44 -04:00
```json
{
2022-10-20 12:57:30 -04:00
"extends": "./node_modules/@microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json"
2022-10-19 09:23:44 -04:00
}
```
2022-10-20 12:57:30 -04:00
#### [./config/serve.json](./config/serve.json)
2022-10-19 09:23:44 -04:00
2022-10-20 12:57:30 -04:00
Update serve.json schema URL:
2022-10-19 09:23:44 -04:00
```json
{
2022-10-20 12:57:30 -04:00
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json"
2022-10-19 09:23:44 -04:00
}
```
#### [./.gitignore](./.gitignore)
2022-10-20 12:57:30 -04:00
To .gitignore add the '.heft' folder:
2022-10-19 09:23:44 -04:00
```text
2022-10-20 12:57:30 -04:00
.heft
2022-10-19 09:23:44 -04:00
```