@pnp/cli-microsoft365 11.8.0-beta.ae98113 → 11.9.0-beta.606e85e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/allCommandsFull.json +1 -1
- package/dist/m365/spfx/commands/SpfxCompatibilityMatrix.js +1 -1
- package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.23.0-rc.0.js → doctor-1.23.0.js} +1 -1
- package/dist/m365/spfx/commands/project/project-doctor.js +7 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/DependencyRule.js +11 -5
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002035_DEVDEP_types_heft_jest.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002036_DEVDEP_types_jest.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027001_OVERRIDES_rushstack_heft.js +33 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.22.0.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.23.0-rc.0.js → upgrade-1.23.0.js} +39 -31
- package/dist/m365/spfx/commands/project/project-upgrade.js +36 -19
- package/dist/request.js +1 -1
- package/dist/utils/packageManager.js +38 -7
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +2 -2
- package/npm-shrinkwrap.json +1579 -503
- package/package.json +37 -19
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021009_PKG_overrides_rushstack_heft.js +0 -45
|
@@ -77,7 +77,7 @@ class SpfxProjectDoctorCommand extends BaseProjectCommand {
|
|
|
77
77
|
'1.22.0',
|
|
78
78
|
'1.22.1',
|
|
79
79
|
'1.22.2',
|
|
80
|
-
'1.23.0
|
|
80
|
+
'1.23.0'
|
|
81
81
|
];
|
|
82
82
|
__classPrivateFieldGet(this, _SpfxProjectDoctorCommand_instances, "m", _SpfxProjectDoctorCommand_initTelemetry).call(this);
|
|
83
83
|
__classPrivateFieldGet(this, _SpfxProjectDoctorCommand_instances, "m", _SpfxProjectDoctorCommand_initOptions).call(this);
|
|
@@ -308,6 +308,8 @@ ${f.resolution}
|
|
|
308
308
|
const packagesDepExact = [];
|
|
309
309
|
const packagesDepUn = [];
|
|
310
310
|
const packagesDevUn = [];
|
|
311
|
+
const packagesOverride = [];
|
|
312
|
+
const packagesOverrideRemove = [];
|
|
311
313
|
findings.forEach(f => {
|
|
312
314
|
packageManager.mapPackageManagerCommand({
|
|
313
315
|
command: f.resolution,
|
|
@@ -315,6 +317,8 @@ ${f.resolution}
|
|
|
315
317
|
packagesDepExact,
|
|
316
318
|
packagesDepUn,
|
|
317
319
|
packagesDevUn,
|
|
320
|
+
packagesOverride,
|
|
321
|
+
packagesOverrideRemove,
|
|
318
322
|
packageMgr: this.packageManager
|
|
319
323
|
});
|
|
320
324
|
});
|
|
@@ -323,6 +327,8 @@ ${f.resolution}
|
|
|
323
327
|
packagesDevExact,
|
|
324
328
|
packagesDepUn,
|
|
325
329
|
packagesDevUn,
|
|
330
|
+
packagesOverride,
|
|
331
|
+
packagesOverrideRemove,
|
|
326
332
|
packageMgr: this.packageManager
|
|
327
333
|
});
|
|
328
334
|
if (this.packageManager === 'npm') {
|
|
@@ -7,7 +7,7 @@ var _DependencyRule_instances, _DependencyRule_needsUpdate, _DependencyRule_getM
|
|
|
7
7
|
import semver from 'semver';
|
|
8
8
|
import { JsonRule } from '../../JsonRule.js';
|
|
9
9
|
export class DependencyRule extends JsonRule {
|
|
10
|
-
constructor(packageName, packageVersion, isDevDep = false, isOptional = false, add = true) {
|
|
10
|
+
constructor(packageName, packageVersion, isDevDep = false, isOptional = false, add = true, isOverride = false) {
|
|
11
11
|
super();
|
|
12
12
|
_DependencyRule_instances.add(this);
|
|
13
13
|
this.packageName = packageName;
|
|
@@ -15,14 +15,20 @@ export class DependencyRule extends JsonRule {
|
|
|
15
15
|
this.isDevDep = isDevDep;
|
|
16
16
|
this.isOptional = isOptional;
|
|
17
17
|
this.add = add;
|
|
18
|
+
this.isOverride = isOverride;
|
|
18
19
|
}
|
|
19
20
|
get title() {
|
|
20
21
|
return this.packageName;
|
|
21
22
|
}
|
|
22
23
|
get description() {
|
|
23
|
-
return `${(this.add ? 'Upgrade' : 'Remove')} SharePoint Framework ${(this.isDevDep ? 'dev ' : '')}dependency package ${this.packageName}`;
|
|
24
|
+
return `${(this.add ? 'Upgrade' : 'Remove')} SharePoint Framework ${(this.isOverride ? 'override ' : this.isDevDep ? 'dev ' : '')}dependency package ${this.packageName}`;
|
|
24
25
|
}
|
|
25
26
|
get resolution() {
|
|
27
|
+
if (this.isOverride) {
|
|
28
|
+
return this.add ?
|
|
29
|
+
`override overrides.${this.packageName}=${this.packageVersion}` :
|
|
30
|
+
`removeOverride overrides.${this.packageName}`;
|
|
31
|
+
}
|
|
26
32
|
return this.add ?
|
|
27
33
|
`${(this.isDevDep ? 'installDev' : 'install')} ${this.packageName}@${this.packageVersion}` :
|
|
28
34
|
`${(this.isDevDep ? 'uninstallDev' : 'uninstall')} ${this.packageName}`;
|
|
@@ -44,10 +50,10 @@ export class DependencyRule extends JsonRule {
|
|
|
44
50
|
if (!project.packageJson) {
|
|
45
51
|
return;
|
|
46
52
|
}
|
|
47
|
-
const projectDependencies = this.isDevDep ? project.packageJson.devDependencies : project.packageJson.dependencies;
|
|
53
|
+
const projectDependencies = this.isOverride ? project.packageJson.overrides : this.isDevDep ? project.packageJson.devDependencies : project.packageJson.dependencies;
|
|
48
54
|
const versionEntry = projectDependencies ? projectDependencies[this.packageName] : '';
|
|
49
55
|
if (this.add) {
|
|
50
|
-
let jsonProperty = this.isDevDep ? 'devDependencies' : 'dependencies';
|
|
56
|
+
let jsonProperty = this.isOverride ? 'overrides' : this.isDevDep ? 'devDependencies' : 'dependencies';
|
|
51
57
|
if (versionEntry) {
|
|
52
58
|
jsonProperty += `.${this.packageName}`;
|
|
53
59
|
if (__classPrivateFieldGet(this, _DependencyRule_instances, "m", _DependencyRule_needsUpdate).call(this, this.packageVersion, versionEntry)) {
|
|
@@ -67,7 +73,7 @@ export class DependencyRule extends JsonRule {
|
|
|
67
73
|
}
|
|
68
74
|
}
|
|
69
75
|
else {
|
|
70
|
-
const jsonProperty = `${(this.isDevDep ? 'devDependencies' : 'dependencies')}.${this.packageName}`;
|
|
76
|
+
const jsonProperty = `${(this.isOverride ? 'overrides' : this.isDevDep ? 'devDependencies' : 'dependencies')}.${this.packageName}`;
|
|
71
77
|
if (versionEntry) {
|
|
72
78
|
const node = this.getAstNodeFromFile(project.packageJson, jsonProperty);
|
|
73
79
|
this.addFindingWithPosition(findings, node);
|
package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002035_DEVDEP_types_heft_jest.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DependencyRule } from "./DependencyRule.js";
|
|
2
2
|
export class FN002035_DEVDEP_types_heft_jest extends DependencyRule {
|
|
3
|
-
constructor(packageVersion) {
|
|
4
|
-
super('@types/heft-jest', packageVersion, true);
|
|
3
|
+
constructor(packageVersion, add = true) {
|
|
4
|
+
super('@types/heft-jest', packageVersion, true, false, add);
|
|
5
5
|
}
|
|
6
6
|
get id() {
|
|
7
7
|
return 'FN002035';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DependencyRule } from "./DependencyRule.js";
|
|
2
|
+
export class FN002036_DEVDEP_types_jest extends DependencyRule {
|
|
3
|
+
constructor(packageVersion) {
|
|
4
|
+
super('@types/jest', packageVersion, true);
|
|
5
|
+
}
|
|
6
|
+
get id() {
|
|
7
|
+
return 'FN002036';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=FN002036_DEVDEP_types_jest.js.map
|
package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027001_OVERRIDES_rushstack_heft.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DependencyRule } from "./DependencyRule.js";
|
|
2
|
+
export class FN027001_OVERRIDES_rushstack_heft extends DependencyRule {
|
|
3
|
+
constructor(version) {
|
|
4
|
+
super('@rushstack/heft', version, false, false, true, true);
|
|
5
|
+
}
|
|
6
|
+
get id() {
|
|
7
|
+
return 'FN027001';
|
|
8
|
+
}
|
|
9
|
+
visit(project, findings) {
|
|
10
|
+
// If an override entry for the package already exists in package.json,
|
|
11
|
+
// emit an extra finding to remove the existing override first. This avoids
|
|
12
|
+
// having to use a separate remove-override rule (e.g. FN027002) in the upgrade scripts.
|
|
13
|
+
if (project.packageJson?.overrides?.[this.packageName] &&
|
|
14
|
+
project.packageJson.overrides[this.packageName] !== this.packageVersion) {
|
|
15
|
+
const node = this.getAstNodeFromFile(project.packageJson, `overrides.${this.packageName}`);
|
|
16
|
+
findings.push({
|
|
17
|
+
id: `${this.id}_REMOVE`,
|
|
18
|
+
title: this.packageName,
|
|
19
|
+
description: `Remove existing SharePoint Framework override dependency package ${this.packageName}`,
|
|
20
|
+
occurrences: [{
|
|
21
|
+
file: this.file,
|
|
22
|
+
resolution: `removeOverride overrides.${this.packageName}`,
|
|
23
|
+
position: this.getPositionFromNode(node)
|
|
24
|
+
}],
|
|
25
|
+
resolutionType: 'cmd',
|
|
26
|
+
severity: 'Required',
|
|
27
|
+
supersedes: []
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
super.visit(project, findings);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=FN027001_OVERRIDES_rushstack_heft.js.map
|
|
@@ -48,7 +48,7 @@ import { FN021005_PKG_scripts_test } from './rules/FN021005_PKG_scripts_test.js'
|
|
|
48
48
|
import { FN021006_PKG_scripts_clean } from './rules/FN021006_PKG_scripts_clean.js';
|
|
49
49
|
import { FN021007_PKG_scripts_start } from './rules/FN021007_PKG_scripts_start.js';
|
|
50
50
|
import { FN021008_PKG_scripts_eject_webpack } from './rules/FN021008_PKG_scripts_eject_webpack.js';
|
|
51
|
-
import {
|
|
51
|
+
import { FN027001_OVERRIDES_rushstack_heft } from './rules/FN027001_OVERRIDES_rushstack_heft.js';
|
|
52
52
|
import { FN023003_GITIGNORE_libdts } from './rules/FN023003_GITIGNORE_libdts.js';
|
|
53
53
|
import { FN023004_GITIGNORE_libcommonjs } from './rules/FN023004_GITIGNORE_libcommonjs.js';
|
|
54
54
|
import { FN023005_GITIGNORE_libesm } from './rules/FN023005_GITIGNORE_libesm.js';
|
|
@@ -151,7 +151,7 @@ export default [
|
|
|
151
151
|
new FN021006_PKG_scripts_clean('heft clean'),
|
|
152
152
|
new FN021007_PKG_scripts_start('heft start --clean'),
|
|
153
153
|
new FN021008_PKG_scripts_eject_webpack('heft eject-webpack'),
|
|
154
|
-
new
|
|
154
|
+
new FN027001_OVERRIDES_rushstack_heft('1.1.2'),
|
|
155
155
|
new FN023003_GITIGNORE_libdts(),
|
|
156
156
|
new FN023004_GITIGNORE_libcommonjs(),
|
|
157
157
|
new FN023005_GITIGNORE_libesm(),
|
package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.23.0-rc.0.js → upgrade-1.23.0.js}
RENAMED
|
@@ -28,39 +28,43 @@ import { FN002030_DEVDEP_microsoft_spfx_web_build_rig } from './rules/FN002030_D
|
|
|
28
28
|
import { FN002031_DEVDEP_rushstack_heft } from './rules/FN002031_DEVDEP_rushstack_heft.js';
|
|
29
29
|
import { FN002032_DEVDEP_typescript_eslint_parser } from './rules/FN002032_DEVDEP_typescript_eslint_parser.js';
|
|
30
30
|
import { FN002034_DEVDEP_microsoft_spfx_heft_plugins } from './rules/FN002034_DEVDEP_microsoft_spfx_heft_plugins.js';
|
|
31
|
+
import { FN002035_DEVDEP_types_heft_jest } from './rules/FN002035_DEVDEP_types_heft_jest.js';
|
|
32
|
+
import { FN002036_DEVDEP_types_jest } from './rules/FN002036_DEVDEP_types_jest.js';
|
|
31
33
|
import { FN010001_YORC_version } from './rules/FN010001_YORC_version.js';
|
|
32
34
|
import { FN015008_FILE_eslintrc_js } from './rules/FN015008_FILE_eslintrc_js.js';
|
|
33
35
|
import { FN015016_FILE_eslint_config_js } from './rules/FN015016_FILE_eslint_config_js.js';
|
|
34
|
-
import {
|
|
36
|
+
import { FN022001_SCSS_remove_fabric_react } from './rules/FN022001_SCSS_remove_fabric_react.js';
|
|
37
|
+
import { FN022002_SCSS_add_fabric_react } from './rules/FN022002_SCSS_add_fabric_react.js';
|
|
38
|
+
import { FN027001_OVERRIDES_rushstack_heft } from './rules/FN027001_OVERRIDES_rushstack_heft.js';
|
|
35
39
|
export default [
|
|
36
|
-
new FN001001_DEP_microsoft_sp_core_library('1.23.0
|
|
37
|
-
new FN001002_DEP_microsoft_sp_lodash_subset('1.23.0
|
|
38
|
-
new FN001003_DEP_microsoft_sp_office_ui_fabric_core('1.23.0
|
|
39
|
-
new FN001004_DEP_microsoft_sp_webpart_base('1.23.0
|
|
40
|
-
new FN001011_DEP_microsoft_sp_dialog('1.23.0
|
|
41
|
-
new FN001012_DEP_microsoft_sp_application_base('1.23.0
|
|
42
|
-
new FN001014_DEP_microsoft_sp_listview_extensibility('1.23.0
|
|
43
|
-
new FN001021_DEP_microsoft_sp_property_pane('1.23.0
|
|
44
|
-
new FN001023_DEP_microsoft_sp_component_base('1.23.0
|
|
45
|
-
new FN001024_DEP_microsoft_sp_diagnostics('1.23.0
|
|
46
|
-
new FN001025_DEP_microsoft_sp_dynamic_data('1.23.0
|
|
47
|
-
new FN001026_DEP_microsoft_sp_extension_base('1.23.0
|
|
48
|
-
new FN001027_DEP_microsoft_sp_http('1.23.0
|
|
49
|
-
new FN001028_DEP_microsoft_sp_list_subscription('1.23.0
|
|
50
|
-
new FN001029_DEP_microsoft_sp_loader('1.23.0
|
|
51
|
-
new FN001030_DEP_microsoft_sp_module_interfaces('1.23.0
|
|
52
|
-
new FN001031_DEP_microsoft_sp_odata_types('1.23.0
|
|
53
|
-
new FN001032_DEP_microsoft_sp_page_context('1.23.0
|
|
54
|
-
new FN001013_DEP_microsoft_decorators('1.23.0
|
|
55
|
-
new FN001034_DEP_microsoft_sp_adaptive_card_extension_base('1.23.0
|
|
56
|
-
new FN002002_DEVDEP_microsoft_sp_module_interfaces('1.23.0
|
|
57
|
-
new FN002022_DEVDEP_microsoft_eslint_plugin_spfx('1.23.0
|
|
58
|
-
new FN002023_DEVDEP_microsoft_eslint_config_spfx('1.23.0
|
|
59
|
-
new FN002030_DEVDEP_microsoft_spfx_web_build_rig('1.23.0
|
|
60
|
-
new FN002034_DEVDEP_microsoft_spfx_heft_plugins('1.23.0
|
|
61
|
-
new FN010001_YORC_version('1.23.0
|
|
62
|
-
new FN002031_DEVDEP_rushstack_heft('1.2.
|
|
63
|
-
new
|
|
40
|
+
new FN001001_DEP_microsoft_sp_core_library('1.23.0'),
|
|
41
|
+
new FN001002_DEP_microsoft_sp_lodash_subset('1.23.0'),
|
|
42
|
+
new FN001003_DEP_microsoft_sp_office_ui_fabric_core('1.23.0'),
|
|
43
|
+
new FN001004_DEP_microsoft_sp_webpart_base('1.23.0'),
|
|
44
|
+
new FN001011_DEP_microsoft_sp_dialog('1.23.0'),
|
|
45
|
+
new FN001012_DEP_microsoft_sp_application_base('1.23.0'),
|
|
46
|
+
new FN001014_DEP_microsoft_sp_listview_extensibility('1.23.0'),
|
|
47
|
+
new FN001021_DEP_microsoft_sp_property_pane('1.23.0'),
|
|
48
|
+
new FN001023_DEP_microsoft_sp_component_base('1.23.0'),
|
|
49
|
+
new FN001024_DEP_microsoft_sp_diagnostics('1.23.0'),
|
|
50
|
+
new FN001025_DEP_microsoft_sp_dynamic_data('1.23.0'),
|
|
51
|
+
new FN001026_DEP_microsoft_sp_extension_base('1.23.0'),
|
|
52
|
+
new FN001027_DEP_microsoft_sp_http('1.23.0'),
|
|
53
|
+
new FN001028_DEP_microsoft_sp_list_subscription('1.23.0'),
|
|
54
|
+
new FN001029_DEP_microsoft_sp_loader('1.23.0'),
|
|
55
|
+
new FN001030_DEP_microsoft_sp_module_interfaces('1.23.0'),
|
|
56
|
+
new FN001031_DEP_microsoft_sp_odata_types('1.23.0'),
|
|
57
|
+
new FN001032_DEP_microsoft_sp_page_context('1.23.0'),
|
|
58
|
+
new FN001013_DEP_microsoft_decorators('1.23.0'),
|
|
59
|
+
new FN001034_DEP_microsoft_sp_adaptive_card_extension_base('1.23.0'),
|
|
60
|
+
new FN002002_DEVDEP_microsoft_sp_module_interfaces('1.23.0'),
|
|
61
|
+
new FN002022_DEVDEP_microsoft_eslint_plugin_spfx('1.23.0'),
|
|
62
|
+
new FN002023_DEVDEP_microsoft_eslint_config_spfx('1.23.0'),
|
|
63
|
+
new FN002030_DEVDEP_microsoft_spfx_web_build_rig('1.23.0'),
|
|
64
|
+
new FN002034_DEVDEP_microsoft_spfx_heft_plugins('1.23.0'),
|
|
65
|
+
new FN010001_YORC_version('1.23.0'),
|
|
66
|
+
new FN002031_DEVDEP_rushstack_heft('1.2.17'),
|
|
67
|
+
new FN027001_OVERRIDES_rushstack_heft('1.2.17'),
|
|
64
68
|
new FN002025_DEVDEP_eslint_plugin_react_hooks('5.2.0'),
|
|
65
69
|
new FN002024_DEVDEP_eslint('9.37.0'),
|
|
66
70
|
new FN015016_FILE_eslint_config_js(true, `const spfxProfile = require('@microsoft/eslint-config-spfx/lib/flat-profiles/react');
|
|
@@ -79,6 +83,10 @@ module.exports = [
|
|
|
79
83
|
];`),
|
|
80
84
|
new FN015008_FILE_eslintrc_js(false),
|
|
81
85
|
new FN002021_DEVDEP_rushstack_eslint_config('4.5.2', false),
|
|
82
|
-
new FN002032_DEVDEP_typescript_eslint_parser('8.46.2', false)
|
|
86
|
+
new FN002032_DEVDEP_typescript_eslint_parser('8.46.2', false),
|
|
87
|
+
new FN002035_DEVDEP_types_heft_jest('1.0.2', false),
|
|
88
|
+
new FN002036_DEVDEP_types_jest('30.0.0'),
|
|
89
|
+
new FN022001_SCSS_remove_fabric_react('~@fluentui/react/dist/sass/References.scss'),
|
|
90
|
+
new FN022002_SCSS_add_fabric_react('pkg:@fluentui/react/dist/sass/References.scss')
|
|
83
91
|
];
|
|
84
|
-
//# sourceMappingURL=upgrade-1.23.0
|
|
92
|
+
//# sourceMappingURL=upgrade-1.23.0.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import os from 'os';
|
|
3
3
|
import path from 'path';
|
|
4
|
-
//
|
|
5
|
-
import { prerelease } from 'semver';
|
|
4
|
+
// Uncomment to support upgrading to preview releases
|
|
5
|
+
// import { prerelease } from 'semver';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { CommandError, globalOptionsZod } from '../../../../Command.js';
|
|
8
8
|
import { fsUtil } from '../../../../utils/fsUtil.js';
|
|
@@ -12,7 +12,7 @@ import { BaseProjectCommand } from './base-project-command.js';
|
|
|
12
12
|
import { FN017001_MISC_npm_dedupe } from './project-upgrade/rules/FN017001_MISC_npm_dedupe.js';
|
|
13
13
|
export const options = z.strictObject({
|
|
14
14
|
...globalOptionsZod.shape,
|
|
15
|
-
packageManager: z.enum(['npm', 'pnpm'
|
|
15
|
+
packageManager: z.enum(['npm', 'pnpm']).default('npm'),
|
|
16
16
|
preview: z.boolean().optional(),
|
|
17
17
|
toVersion: z.string().optional().alias('v'),
|
|
18
18
|
shell: z.enum(['bash', 'powershell', 'cmd']).default('powershell'),
|
|
@@ -86,7 +86,7 @@ class SpfxProjectUpgradeCommand extends BaseProjectCommand {
|
|
|
86
86
|
'1.22.0',
|
|
87
87
|
'1.22.1',
|
|
88
88
|
'1.22.2',
|
|
89
|
-
'1.23.0
|
|
89
|
+
'1.23.0'
|
|
90
90
|
];
|
|
91
91
|
}
|
|
92
92
|
async commandAction(logger, args) {
|
|
@@ -95,16 +95,16 @@ class SpfxProjectUpgradeCommand extends BaseProjectCommand {
|
|
|
95
95
|
throw new CommandError(`Couldn't find project root folder`, SpfxProjectUpgradeCommand.ERROR_NO_PROJECT_ROOT_FOLDER);
|
|
96
96
|
}
|
|
97
97
|
this.toVersion = args.options.toVersion ? args.options.toVersion : this.supportedVersions[this.supportedVersions.length - 1];
|
|
98
|
-
//
|
|
99
|
-
if (!args.options.toVersion &&
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
98
|
+
// Uncomment to support upgrading to preview releases
|
|
99
|
+
// if (!args.options.toVersion &&
|
|
100
|
+
// !args.options.preview &&
|
|
101
|
+
// prerelease(this.toVersion)) {
|
|
102
|
+
// // no version and no preview specified while the current version to
|
|
103
|
+
// // upgrade to is a prerelease so let's grab the first non-preview version
|
|
104
|
+
// // since we're supporting only one preview version, it's sufficient for
|
|
105
|
+
// // us to take second to last version
|
|
106
|
+
// this.toVersion = this.supportedVersions[this.supportedVersions.length - 2];
|
|
107
|
+
// }
|
|
108
108
|
this.packageManager = args.options.packageManager || 'npm';
|
|
109
109
|
this.shell = args.options.shell || 'powershell';
|
|
110
110
|
if (this.supportedVersions.indexOf(this.toVersion) < 0) {
|
|
@@ -201,7 +201,15 @@ class SpfxProjectUpgradeCommand extends BaseProjectCommand {
|
|
|
201
201
|
// replace package operation tokens with command for the specific package manager
|
|
202
202
|
findingsToReport.forEach(f => {
|
|
203
203
|
// matches must be in this particular order to avoid false matches, eg.
|
|
204
|
-
// uninstallDev contains install
|
|
204
|
+
// uninstallDev contains install, removeOverride contains override
|
|
205
|
+
if (f.resolution.startsWith('removeOverride')) {
|
|
206
|
+
f.resolution = f.resolution.replace('removeOverride', packageManager.getPackageManagerCommand('removeOverride', this.packageManager));
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (f.resolution.startsWith('override')) {
|
|
210
|
+
f.resolution = f.resolution.replace('override', packageManager.getPackageManagerCommand('override', this.packageManager));
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
205
213
|
if (f.resolution.startsWith('uninstallDev')) {
|
|
206
214
|
f.resolution = f.resolution.replace('uninstallDev', packageManager.getPackageManagerCommand('uninstallDev', this.packageManager));
|
|
207
215
|
return;
|
|
@@ -296,7 +304,9 @@ class SpfxProjectUpgradeCommand extends BaseProjectCommand {
|
|
|
296
304
|
.filter((command) => command.indexOf(packageManager.getPackageManagerCommand('install', this.packageManager)) === -1 &&
|
|
297
305
|
command.indexOf(packageManager.getPackageManagerCommand('installDev', this.packageManager)) === -1 &&
|
|
298
306
|
command.indexOf(packageManager.getPackageManagerCommand('uninstall', this.packageManager)) === -1 &&
|
|
299
|
-
command.indexOf(packageManager.getPackageManagerCommand('uninstallDev', this.packageManager)) === -1
|
|
307
|
+
command.indexOf(packageManager.getPackageManagerCommand('uninstallDev', this.packageManager)) === -1 &&
|
|
308
|
+
command.indexOf(packageManager.getPackageManagerCommand('override', this.packageManager)) === -1 &&
|
|
309
|
+
command.indexOf(packageManager.getPackageManagerCommand('removeOverride', this.packageManager)) === -1))).join(os.EOL), os.EOL,
|
|
300
310
|
os.EOL,
|
|
301
311
|
Object.keys(reportData.modificationPerFile).map(file => {
|
|
302
312
|
return [
|
|
@@ -356,7 +366,9 @@ ${f.resolution}
|
|
|
356
366
|
.filter((command) => command.indexOf(packageManager.getPackageManagerCommand('install', this.packageManager)) === -1 &&
|
|
357
367
|
command.indexOf(packageManager.getPackageManagerCommand('installDev', this.packageManager)) === -1 &&
|
|
358
368
|
command.indexOf(packageManager.getPackageManagerCommand('uninstall', this.packageManager)) === -1 &&
|
|
359
|
-
command.indexOf(packageManager.getPackageManagerCommand('uninstallDev', this.packageManager)) === -1
|
|
369
|
+
command.indexOf(packageManager.getPackageManagerCommand('uninstallDev', this.packageManager)) === -1 &&
|
|
370
|
+
command.indexOf(packageManager.getPackageManagerCommand('override', this.packageManager)) === -1 &&
|
|
371
|
+
command.indexOf(packageManager.getPackageManagerCommand('removeOverride', this.packageManager)) === -1))).join(os.EOL), os.EOL,
|
|
360
372
|
'```', os.EOL,
|
|
361
373
|
os.EOL,
|
|
362
374
|
'### Modify files', os.EOL,
|
|
@@ -433,16 +445,19 @@ ${f.resolution}
|
|
|
433
445
|
const packagesDepExact = [];
|
|
434
446
|
const packagesDepUn = [];
|
|
435
447
|
const packagesDevUn = [];
|
|
448
|
+
const packagesOverride = [];
|
|
449
|
+
const packagesOverrideRemove = [];
|
|
436
450
|
findings.forEach(f => {
|
|
437
451
|
if (f.resolutionType === 'cmd') {
|
|
438
|
-
if (f.resolution.indexOf('npm') > -1
|
|
439
|
-
f.resolution.indexOf('yarn') > -1) {
|
|
452
|
+
if (f.resolution.indexOf('npm') > -1) {
|
|
440
453
|
packageManager.mapPackageManagerCommand({
|
|
441
454
|
command: f.resolution,
|
|
442
455
|
packagesDevExact,
|
|
443
456
|
packagesDepExact,
|
|
444
457
|
packagesDepUn,
|
|
445
458
|
packagesDevUn,
|
|
459
|
+
packagesOverride,
|
|
460
|
+
packagesOverrideRemove,
|
|
446
461
|
packageMgr: this.packageManager
|
|
447
462
|
});
|
|
448
463
|
}
|
|
@@ -468,6 +483,8 @@ ${f.resolution}
|
|
|
468
483
|
packagesDevExact,
|
|
469
484
|
packagesDepUn,
|
|
470
485
|
packagesDevUn,
|
|
486
|
+
packagesOverride,
|
|
487
|
+
packagesOverrideRemove,
|
|
471
488
|
packageMgr: this.packageManager
|
|
472
489
|
});
|
|
473
490
|
if (this.packageManager === 'npm') {
|
package/dist/request.js
CHANGED
|
@@ -34,7 +34,7 @@ class Request {
|
|
|
34
34
|
await this._logger.logToStderr('Response:');
|
|
35
35
|
const properties = ['status', 'statusText', 'headers'];
|
|
36
36
|
if (response.headers['content-type'] &&
|
|
37
|
-
response.headers['content-type'].indexOf('json') > -1) {
|
|
37
|
+
response.headers['content-type'].toString().indexOf('json') > -1) {
|
|
38
38
|
properties.push('data');
|
|
39
39
|
}
|
|
40
40
|
await this._logger.logToStderr(JSON.stringify({
|
|
@@ -2,29 +2,44 @@ const packageCommands = {
|
|
|
2
2
|
npm: {
|
|
3
3
|
install: 'npm i -SE',
|
|
4
4
|
installDev: 'npm i -DE',
|
|
5
|
+
installLockFile: 'npm i',
|
|
5
6
|
uninstall: 'npm un -S',
|
|
6
|
-
uninstallDev: 'npm un -D'
|
|
7
|
+
uninstallDev: 'npm un -D',
|
|
8
|
+
override: 'npm pkg set',
|
|
9
|
+
removeOverride: 'npm pkg delete'
|
|
7
10
|
},
|
|
8
11
|
pnpm: {
|
|
9
12
|
install: 'pnpm i -E',
|
|
10
13
|
installDev: 'pnpm i -DE',
|
|
14
|
+
installLockFile: 'pnpm i',
|
|
11
15
|
uninstall: 'pnpm un',
|
|
12
|
-
uninstallDev: 'pnpm un'
|
|
16
|
+
uninstallDev: 'pnpm un',
|
|
17
|
+
override: 'pnpm pkg set',
|
|
18
|
+
removeOverride: 'pnpm pkg delete'
|
|
13
19
|
},
|
|
14
20
|
yarn: {
|
|
15
21
|
install: 'yarn add -E',
|
|
16
22
|
installDev: 'yarn add -DE',
|
|
17
23
|
uninstall: 'yarn remove',
|
|
18
24
|
uninstallDev: 'yarn remove'
|
|
25
|
+
// Yarn is not supported for project upgrade since their CLI does not support setting overrides.
|
|
19
26
|
}
|
|
20
27
|
};
|
|
21
28
|
export const packageManager = {
|
|
22
29
|
getPackageManagerCommand(command, packageManager) {
|
|
23
30
|
return packageCommands[packageManager][command];
|
|
24
31
|
},
|
|
25
|
-
mapPackageManagerCommand({ command, packagesDepExact, packagesDevExact, packagesDepUn, packagesDevUn, packageMgr }) {
|
|
32
|
+
mapPackageManagerCommand({ command, packagesDepExact, packagesDevExact, packagesDepUn, packagesDevUn, packagesOverride, packagesOverrideRemove, packageMgr }) {
|
|
26
33
|
// matches must be in this particular order to avoid false matches, eg.
|
|
27
|
-
// uninstallDev contains install
|
|
34
|
+
// uninstallDev contains install, removeOverride contains override
|
|
35
|
+
if (command.startsWith(`${packageManager.getPackageManagerCommand('removeOverride', packageMgr)} `)) {
|
|
36
|
+
packagesOverrideRemove.push(command.replace(packageManager.getPackageManagerCommand('removeOverride', packageMgr), '').trim());
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (command.startsWith(`${packageManager.getPackageManagerCommand('override', packageMgr)} `)) {
|
|
40
|
+
packagesOverride.push(command.replace(packageManager.getPackageManagerCommand('override', packageMgr), '').trim());
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
28
43
|
if (command.startsWith(`${packageManager.getPackageManagerCommand('uninstallDev', packageMgr)} `)) {
|
|
29
44
|
packagesDevUn.push(command.replace(packageManager.getPackageManagerCommand('uninstallDev', packageMgr), '').trim());
|
|
30
45
|
return;
|
|
@@ -41,10 +56,21 @@ export const packageManager = {
|
|
|
41
56
|
packagesDepExact.push(command.replace(packageManager.getPackageManagerCommand('install', packageMgr), '').trim());
|
|
42
57
|
}
|
|
43
58
|
},
|
|
44
|
-
reducePackageManagerCommand({ packagesDepExact, packagesDevExact, packagesDepUn, packagesDevUn, packageMgr }) {
|
|
59
|
+
reducePackageManagerCommand({ packagesDepExact, packagesDevExact, packagesDepUn, packagesDevUn, packagesOverride, packagesOverrideRemove, packageMgr }) {
|
|
45
60
|
const commandsToExecute = [];
|
|
46
|
-
//
|
|
47
|
-
//
|
|
61
|
+
// removeOverride comes first to clear stale overrides before any install/uninstall
|
|
62
|
+
// uninstall commands must come before install commands otherwise there is a
|
|
63
|
+
// chance that whatever we recommended to install will be immediately uninstalled
|
|
64
|
+
// override (add) comes last so it is applied after all
|
|
65
|
+
// install/uninstall operations have completed
|
|
66
|
+
if (packagesOverrideRemove.length > 0) {
|
|
67
|
+
commandsToExecute.push(`${packageManager.getPackageManagerCommand('removeOverride', packageMgr)} ${packagesOverrideRemove.join(' ')}`);
|
|
68
|
+
// removeOverride only updates package.json; run a plain install to update the lock file
|
|
69
|
+
// only needed when no other install/uninstall commands will already update the lock file
|
|
70
|
+
if (packagesDepUn.length === 0 && packagesDevUn.length === 0 && packagesDepExact.length === 0 && packagesDevExact.length === 0 && packagesOverride.length === 0) {
|
|
71
|
+
commandsToExecute.push(packageManager.getPackageManagerCommand('installLockFile', packageMgr));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
48
74
|
if (packagesDepUn.length > 0) {
|
|
49
75
|
commandsToExecute.push(`${packageManager.getPackageManagerCommand('uninstall', packageMgr)} ${packagesDepUn.join(' ')}`);
|
|
50
76
|
}
|
|
@@ -57,6 +83,11 @@ export const packageManager = {
|
|
|
57
83
|
if (packagesDevExact.length > 0) {
|
|
58
84
|
commandsToExecute.push(`${packageManager.getPackageManagerCommand('installDev', packageMgr)} ${packagesDevExact.join(' ')}`);
|
|
59
85
|
}
|
|
86
|
+
if (packagesOverride.length > 0) {
|
|
87
|
+
commandsToExecute.push(`${packageManager.getPackageManagerCommand('override', packageMgr)} ${packagesOverride.join(' ')}`);
|
|
88
|
+
// override only updates package.json; run a plain install to update the lock file
|
|
89
|
+
commandsToExecute.push(packageManager.getPackageManagerCommand('installLockFile', packageMgr));
|
|
90
|
+
}
|
|
60
91
|
return commandsToExecute;
|
|
61
92
|
}
|
|
62
93
|
};
|
|
@@ -19,7 +19,7 @@ m365 spfx project upgrade [options]
|
|
|
19
19
|
: The version of SharePoint Framework to which upgrade the project
|
|
20
20
|
|
|
21
21
|
`--packageManager [packageManager]`
|
|
22
|
-
: The package manager you use. Supported managers `npm
|
|
22
|
+
: The package manager you use. Supported managers `npm` or `pnpm`. Default `npm`
|
|
23
23
|
|
|
24
24
|
`--shell [shell]`
|
|
25
25
|
: The shell you use. Supported shells `bash`, `powershell`, `cmd`. Default `powershell`
|
|
@@ -45,7 +45,7 @@ m365 spfx project upgrade [options]
|
|
|
45
45
|
|
|
46
46
|
## Remarks
|
|
47
47
|
|
|
48
|
-
The `spfx project upgrade` command helps you upgrade your SharePoint Framework project to the specified version. If no version is specified, the command will upgrade to the latest version of the SharePoint Framework it supports (v1.23.0
|
|
48
|
+
The `spfx project upgrade` command helps you upgrade your SharePoint Framework project to the specified version. If no version is specified, the command will upgrade to the latest version of the SharePoint Framework it supports (v1.23.0).
|
|
49
49
|
|
|
50
50
|
This command doesn't change your project files. Instead, it gives you a report with all steps necessary to upgrade your project to the specified version of the SharePoint Framework. Changing project files is error-prone, especially when it comes to updating your solution's code. This is why at this moment, this command produces a report that you can use yourself to perform the necessary updates and verify that everything is working as expected.
|
|
51
51
|
|