@pnp/cli-microsoft365 11.8.0-beta.ae98113 → 11.9.0-beta.0365d84

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.
Files changed (69) hide show
  1. package/allCommandsFull.json +1 -1
  2. package/dist/cli/cli.js +49 -13
  3. package/dist/index.js +9 -1
  4. package/dist/m365/adaptivecard/commands/adaptivecard-send.js +4 -1
  5. package/dist/m365/app/commands/permission/permission-add.js +4 -1
  6. package/dist/m365/booking/commands/business/business-get.js +5 -1
  7. package/dist/m365/commands/login.js +26 -6
  8. package/dist/m365/entra/commands/administrativeunit/administrativeunit-get.js +5 -1
  9. package/dist/m365/entra/commands/administrativeunit/administrativeunit-remove.js +10 -2
  10. package/dist/m365/entra/commands/organization/organization-set.js +14 -3
  11. package/dist/m365/entra/commands/roleassignment/roleassignment-add.js +10 -2
  12. package/dist/m365/entra/commands/roledefinition/roledefinition-get.js +10 -2
  13. package/dist/m365/entra/commands/roledefinition/roledefinition-remove.js +10 -2
  14. package/dist/m365/entra/commands/roledefinition/roledefinition-set.js +14 -3
  15. package/dist/m365/entra/commands/user/user-session-revoke.js +5 -1
  16. package/dist/m365/exo/commands/approleassignment/approleassignment-add.js +60 -12
  17. package/dist/m365/flow/commands/environment/environment-get.js +5 -1
  18. package/dist/m365/graph/commands/directoryextension/directoryextension-add.js +5 -1
  19. package/dist/m365/graph/commands/directoryextension/directoryextension-get.js +15 -3
  20. package/dist/m365/graph/commands/directoryextension/directoryextension-list.js +5 -1
  21. package/dist/m365/graph/commands/directoryextension/directoryextension-remove.js +15 -3
  22. package/dist/m365/outlook/commands/mail/mail-searchfolder-add.js +5 -1
  23. package/dist/m365/outlook/commands/mailbox/mailbox-settings-get.js +5 -1
  24. package/dist/m365/outlook/commands/mailbox/mailbox-settings-set.js +9 -2
  25. package/dist/m365/pa/commands/environment/environment-get.js +5 -1
  26. package/dist/m365/pp/commands/environment/environment-get.js +5 -1
  27. package/dist/m365/pp/commands/website/website-get.js +5 -1
  28. package/dist/m365/spe/commands/container/container-add.js +5 -1
  29. package/dist/m365/spe/commands/container/container-recyclebinitem-list.js +5 -1
  30. package/dist/m365/spe/commands/container/container-recyclebinitem-remove.js +10 -2
  31. package/dist/m365/spe/commands/container/container-recyclebinitem-restore.js +10 -2
  32. package/dist/m365/spe/commands/container/container-remove.js +10 -2
  33. package/dist/m365/spe/commands/containertype/containertype-get.js +5 -1
  34. package/dist/m365/spe/commands/containertype/containertype-remove.js +5 -1
  35. package/dist/m365/spfx/commands/SpfxCompatibilityMatrix.js +1 -1
  36. package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.23.0-rc.0.js → doctor-1.23.0.js} +1 -1
  37. package/dist/m365/spfx/commands/project/project-doctor.js +7 -1
  38. package/dist/m365/spfx/commands/project/project-upgrade/rules/DependencyRule.js +11 -5
  39. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002035_DEVDEP_types_heft_jest.js +2 -2
  40. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002036_DEVDEP_types_jest.js +10 -0
  41. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027001_OVERRIDES_rushstack_heft.js +33 -0
  42. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.22.0.js +2 -2
  43. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.23.0-rc.0.js → upgrade-1.23.0.js} +39 -31
  44. package/dist/m365/spfx/commands/project/project-upgrade.js +36 -19
  45. package/dist/m365/spo/commands/file/file-version-keep.js +5 -1
  46. package/dist/m365/spo/commands/homesite/homesite-add.js +5 -1
  47. package/dist/m365/spo/commands/homesite/homesite-set.js +9 -2
  48. package/dist/m365/spo/commands/list/list-defaultvalue-clear.js +10 -2
  49. package/dist/m365/spo/commands/list/list-defaultvalue-get.js +5 -1
  50. package/dist/m365/spo/commands/list/list-defaultvalue-list.js +5 -1
  51. package/dist/m365/spo/commands/list/list-defaultvalue-remove.js +5 -1
  52. package/dist/m365/spo/commands/list/list-defaultvalue-set.js +5 -1
  53. package/dist/m365/spo/commands/list/list-view-add.js +17 -4
  54. package/dist/m365/spo/commands/page/page-get.js +5 -1
  55. package/dist/m365/spo/commands/web/web-alert-list.js +10 -2
  56. package/dist/m365/spp/commands/autofillcolumn/autofillcolumn-set.js +10 -2
  57. package/dist/m365/spp/commands/model/model-apply.js +10 -2
  58. package/dist/m365/teams/commands/callrecord/callrecord-list.js +5 -1
  59. package/dist/m365/viva/commands/engage/engage-community-user-add.js +20 -4
  60. package/dist/m365/viva/commands/engage/engage-community-user-list.js +10 -2
  61. package/dist/m365/viva/commands/engage/engage-community-user-remove.js +16 -7
  62. package/dist/m365/viva/commands/engage/engage-role-member-list.js +5 -1
  63. package/dist/request.js +1 -1
  64. package/dist/utils/packageManager.js +38 -7
  65. package/dist/utils/prompt.js +1 -7
  66. package/docs/docs/cmd/spfx/project/project-upgrade.mdx +2 -2
  67. package/npm-shrinkwrap.json +1579 -503
  68. package/package.json +37 -19
  69. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021009_PKG_overrides_rushstack_heft.js +0 -45
@@ -38,7 +38,11 @@ class SpoHomeSiteSetCommand extends SpoCommand {
38
38
  getRefinedSchema(schema) {
39
39
  return schema
40
40
  .refine((options) => [options.audienceIds, options.audienceNames].filter(o => o !== undefined).length <= 1, {
41
- message: 'You must specify either audienceIds or audienceNames but not both.'
41
+ message: 'You must specify either audienceIds or audienceNames but not both.',
42
+ params: {
43
+ customCode: 'optionSet',
44
+ options: ['audienceIds', 'audienceNames']
45
+ }
42
46
  })
43
47
  .refine((options) => options.vivaConnectionsDefaultStart !== undefined ||
44
48
  options.draftMode !== undefined ||
@@ -46,7 +50,10 @@ class SpoHomeSiteSetCommand extends SpoCommand {
46
50
  options.audienceNames !== undefined ||
47
51
  options.targetedLicenseType !== undefined ||
48
52
  options.order !== undefined, {
49
- message: 'You must specify at least one option to configure.'
53
+ message: 'You must specify at least one option to configure.',
54
+ params: {
55
+ customCode: 'required'
56
+ }
50
57
  });
51
58
  }
52
59
  async commandAction(logger, args) {
@@ -35,10 +35,18 @@ class SpoListDefaultValueClearCommand extends SpoCommand {
35
35
  getRefinedSchema(schema) {
36
36
  return schema
37
37
  .refine(options => [options.listId, options.listTitle, options.listUrl].filter(o => o !== undefined).length === 1, {
38
- error: 'Use one of the following options: listId, listTitle, listUrl.'
38
+ error: 'Use one of the following options: listId, listTitle, listUrl.',
39
+ params: {
40
+ customCode: 'optionSet',
41
+ options: ['listId', 'listTitle', 'listUrl']
42
+ }
39
43
  })
40
44
  .refine(options => (options.fieldName !== undefined) !== (options.folderUrl !== undefined) || (options.fieldName === undefined && options.folderUrl === undefined), {
41
- error: `Specify 'fieldName' or 'folderUrl', but not both.`
45
+ error: `Specify 'fieldName' or 'folderUrl', but not both.`,
46
+ params: {
47
+ customCode: 'optionSet',
48
+ options: ['fieldName', 'folderUrl']
49
+ }
42
50
  });
43
51
  }
44
52
  async commandAction(logger, args) {
@@ -33,7 +33,11 @@ class SpoListDefaultValueGetCommand extends SpoCommand {
33
33
  getRefinedSchema(schema) {
34
34
  return schema
35
35
  .refine(options => [options.listId, options.listTitle, options.listUrl].filter(o => o !== undefined).length === 1, {
36
- error: 'Use one of the following options: listId, listTitle, listUrl.'
36
+ error: 'Use one of the following options: listId, listTitle, listUrl.',
37
+ params: {
38
+ customCode: 'optionSet',
39
+ options: ['listId', 'listTitle', 'listUrl']
40
+ }
37
41
  });
38
42
  }
39
43
  async commandAction(logger, args) {
@@ -32,7 +32,11 @@ class SpoListDefaultValueListCommand extends SpoCommand {
32
32
  getRefinedSchema(schema) {
33
33
  return schema
34
34
  .refine(options => [options.listId, options.listTitle, options.listUrl].filter(o => o !== undefined).length === 1, {
35
- error: 'Use one of the following options: listId, listTitle, listUrl.'
35
+ error: 'Use one of the following options: listId, listTitle, listUrl.',
36
+ params: {
37
+ customCode: 'optionSet',
38
+ options: ['listId', 'listTitle', 'listUrl']
39
+ }
36
40
  });
37
41
  }
38
42
  async commandAction(logger, args) {
@@ -35,7 +35,11 @@ class SpoListDefaultValueRemoveCommand extends SpoCommand {
35
35
  getRefinedSchema(schema) {
36
36
  return schema
37
37
  .refine(options => [options.listId, options.listTitle, options.listUrl].filter(o => o !== undefined).length === 1, {
38
- error: 'Use one of the following options: listId, listTitle, listUrl.'
38
+ error: 'Use one of the following options: listId, listTitle, listUrl.',
39
+ params: {
40
+ customCode: 'optionSet',
41
+ options: ['listId', 'listTitle', 'listUrl']
42
+ }
39
43
  });
40
44
  }
41
45
  async commandAction(logger, args) {
@@ -36,7 +36,11 @@ class SpoListDefaultValueSetCommand extends SpoCommand {
36
36
  getRefinedSchema(schema) {
37
37
  return schema
38
38
  .refine(options => [options.listId, options.listTitle, options.listUrl].filter(o => o !== undefined).length === 1, {
39
- error: 'Use one of the following options: listId, listTitle, listUrl.'
39
+ error: 'Use one of the following options: listId, listTitle, listUrl.',
40
+ params: {
41
+ customCode: 'optionSet',
42
+ options: ['listId', 'listTitle', 'listUrl']
43
+ }
40
44
  });
41
45
  }
42
46
  async commandAction(logger, args) {
@@ -57,25 +57,38 @@ class SpoListViewAddCommand extends SpoCommand {
57
57
  getRefinedSchema(schema) {
58
58
  return schema
59
59
  .refine((options) => [options.listId, options.listTitle, options.listUrl].filter(o => o !== undefined).length === 1, {
60
- error: 'Use one of the following options: listId, listTitle, or listUrl.'
60
+ error: 'Use one of the following options: listId, listTitle, or listUrl.',
61
+ params: {
62
+ customCode: 'optionSet',
63
+ options: ['listId', 'listTitle', 'listUrl']
64
+ }
61
65
  })
62
66
  .refine((options) => !options.personal || !options.default, {
63
67
  error: 'Default view cannot be a personal view.'
64
68
  })
65
69
  .refine((options) => options.type !== 'calendar' || [options.calendarStartDateField, options.calendarEndDateField, options.calendarTitleField].filter(o => o === undefined).length === 0, {
66
- error: 'When type is calendar, do specify calendarStartDateField, calendarEndDateField, and calendarTitleField.'
70
+ error: 'When type is calendar, do specify calendarStartDateField, calendarEndDateField, and calendarTitleField.',
71
+ params: {
72
+ customCode: 'required'
73
+ }
67
74
  })
68
75
  .refine((options) => options.type === 'calendar' || [options.calendarStartDateField, options.calendarEndDateField, options.calendarTitleField].filter(o => o === undefined).length === 3, {
69
76
  error: 'When type is not calendar, do not specify calendarStartDateField, calendarEndDateField, and calendarTitleField.'
70
77
  })
71
78
  .refine((options) => options.type !== 'kanban' || options.kanbanBucketField !== undefined, {
72
- error: 'When type is kanban, do specify kanbanBucketField.'
79
+ error: 'When type is kanban, do specify kanbanBucketField.',
80
+ params: {
81
+ customCode: 'required'
82
+ }
73
83
  })
74
84
  .refine((options) => options.type === 'kanban' || options.kanbanBucketField === undefined, {
75
85
  error: 'When type is not kanban, do not specify kanbanBucketField.'
76
86
  })
77
87
  .refine((options) => options.type === 'calendar' || options.fields !== undefined, {
78
- error: 'When type is not calendar, do specify fields.'
88
+ error: 'When type is not calendar, do specify fields.',
89
+ params: {
90
+ customCode: 'required'
91
+ }
79
92
  });
80
93
  }
81
94
  async commandAction(logger, args) {
@@ -30,7 +30,11 @@ class SpoPageGetCommand extends SpoCommand {
30
30
  getRefinedSchema(schema) {
31
31
  return schema
32
32
  .refine(options => [options.name, options.default].filter(x => x !== undefined).length === 1, {
33
- error: `Specify either name or default, but not both.`
33
+ error: `Specify either name or default, but not both.`,
34
+ params: {
35
+ customCode: 'optionSet',
36
+ options: ['name', 'default']
37
+ }
34
38
  });
35
39
  }
36
40
  async commandAction(logger, args) {
@@ -38,10 +38,18 @@ class SpoWebAlertListCommand extends SpoCommand {
38
38
  getRefinedSchema(schema) {
39
39
  return schema
40
40
  .refine(options => [options.listId, options.listUrl, options.listTitle].filter(x => x !== undefined).length <= 1, {
41
- error: `Specify either listId, listUrl, or listTitle, but not more than one.`
41
+ error: `Specify either listId, listUrl, or listTitle, but not more than one.`,
42
+ params: {
43
+ customCode: 'optionSet',
44
+ options: ['listId', 'listUrl', 'listTitle']
45
+ }
42
46
  })
43
47
  .refine(options => [options.userName, options.userId].filter(x => x !== undefined).length <= 1, {
44
- error: `Specify either userName or userId, but not both.`
48
+ error: `Specify either userName or userId, but not both.`,
49
+ params: {
50
+ customCode: 'optionSet',
51
+ options: ['userName', 'userId']
52
+ }
45
53
  });
46
54
  }
47
55
  async commandAction(logger, args) {
@@ -55,10 +55,18 @@ class SppAutofillColumnSetCommand extends SpoCommand {
55
55
  getRefinedSchema(schema) {
56
56
  return schema
57
57
  .refine(options => [options.columnId, options.columnTitle, options.columnInternalName].filter(Boolean).length === 1, {
58
- message: `Specify exactly one of the following options: 'columnId', 'columnTitle' or 'columnInternalName'.`
58
+ message: `Specify exactly one of the following options: 'columnId', 'columnTitle' or 'columnInternalName'.`,
59
+ params: {
60
+ customCode: 'optionSet',
61
+ options: ['columnId', 'columnTitle', 'columnInternalName']
62
+ }
59
63
  })
60
64
  .refine(options => [options.listTitle, options.listId, options.listUrl].filter(Boolean).length === 1, {
61
- message: `Specify exactly one of the following options: 'listTitle', 'listId' or 'listUrl'.`
65
+ message: `Specify exactly one of the following options: 'listTitle', 'listId' or 'listUrl'.`,
66
+ params: {
67
+ customCode: 'optionSet',
68
+ options: ['listTitle', 'listId', 'listUrl']
69
+ }
62
70
  });
63
71
  }
64
72
  async commandAction(logger, args) {
@@ -39,10 +39,18 @@ class SppModelApplyCommand extends SpoCommand {
39
39
  getRefinedSchema(schema) {
40
40
  return schema
41
41
  .refine(options => [options.id, options.title].filter(x => x !== undefined).length === 1, {
42
- error: `Specify exactly one of the following options: 'id' or 'title'.`
42
+ error: `Specify exactly one of the following options: 'id' or 'title'.`,
43
+ params: {
44
+ customCode: 'optionSet',
45
+ options: ['id', 'title']
46
+ }
43
47
  })
44
48
  .refine(options => [options.listTitle, options.listId, options.listUrl].filter(x => x !== undefined).length === 1, {
45
- error: `Specify exactly one of the following options: 'listTitle', 'listId' or 'listUrl'.`
49
+ error: `Specify exactly one of the following options: 'listTitle', 'listId' or 'listUrl'.`,
50
+ params: {
51
+ customCode: 'optionSet',
52
+ options: ['listTitle', 'listId', 'listUrl']
53
+ }
46
54
  });
47
55
  }
48
56
  async commandAction(logger, args) {
@@ -55,7 +55,11 @@ class TeamsCallRecordListCommand extends GraphApplicationCommand {
55
55
  getRefinedSchema(schema) {
56
56
  return schema
57
57
  .refine((options) => [options.userId, options.userName].filter(o => o !== undefined).length <= 1, {
58
- error: 'Use one of the following options: userId or userName but not both.'
58
+ error: 'Use one of the following options: userId or userName but not both.',
59
+ params: {
60
+ customCode: 'optionSet',
61
+ options: ['userId', 'userName']
62
+ }
59
63
  })
60
64
  .refine((options) => [options.startDateTime, options.endDateTime].filter(o => o !== undefined).length <= 1 || new Date(options.startDateTime) < new Date(options.endDateTime), {
61
65
  message: 'Value of startDateTime, must be before endDateTime.'
@@ -35,16 +35,32 @@ class VivaEngageCommunityUserAddCommand extends GraphCommand {
35
35
  getRefinedSchema(schema) {
36
36
  return schema
37
37
  .refine(options => [options.communityId, options.communityDisplayName, options.entraGroupId].filter(x => x !== undefined).length === 1, {
38
- error: 'Specify either communityId, communityDisplayName, or entraGroupId, but not multiple.'
38
+ error: 'Specify either communityId, communityDisplayName, or entraGroupId, but not multiple.',
39
+ params: {
40
+ customCode: 'optionSet',
41
+ options: ['communityId', 'communityDisplayName', 'entraGroupId']
42
+ }
39
43
  })
40
44
  .refine(options => options.communityId || options.communityDisplayName || options.entraGroupId, {
41
- error: 'Specify at least one of communityId, communityDisplayName, or entraGroupId.'
45
+ error: 'Specify at least one of communityId, communityDisplayName, or entraGroupId.',
46
+ params: {
47
+ customCode: 'optionSet',
48
+ options: ['communityId', 'communityDisplayName', 'entraGroupId']
49
+ }
42
50
  })
43
51
  .refine(options => options.ids || options.userNames, {
44
- error: 'Specify either of ids or userNames.'
52
+ error: 'Specify either of ids or userNames.',
53
+ params: {
54
+ customCode: 'optionSet',
55
+ options: ['ids', 'userNames']
56
+ }
45
57
  })
46
58
  .refine(options => typeof options.userNames !== 'undefined' || typeof options.ids !== 'undefined', {
47
- error: 'Specify either ids or userNames, but not both.'
59
+ error: 'Specify either ids or userNames, but not both.',
60
+ params: {
61
+ customCode: 'optionSet',
62
+ options: ['ids', 'userNames']
63
+ }
48
64
  });
49
65
  }
50
66
  async commandAction(logger, args) {
@@ -24,10 +24,18 @@ class VivaEngageCommunityUserListCommand extends GraphCommand {
24
24
  getRefinedSchema(schema) {
25
25
  return schema
26
26
  .refine(options => [options.communityId, options.communityDisplayName, options.entraGroupId].filter(x => x !== undefined).length === 1, {
27
- error: 'Specify either communityId, communityDisplayName, or entraGroupId, but not multiple.'
27
+ error: 'Specify either communityId, communityDisplayName, or entraGroupId, but not multiple.',
28
+ params: {
29
+ customCode: 'optionSet',
30
+ options: ['communityId', 'communityDisplayName', 'entraGroupId']
31
+ }
28
32
  })
29
33
  .refine(options => options.communityId || options.communityDisplayName || options.entraGroupId, {
30
- error: 'Specify at least one of communityId, communityDisplayName, or entraGroupId.'
34
+ error: 'Specify at least one of communityId, communityDisplayName, or entraGroupId.',
35
+ params: {
36
+ customCode: 'optionSet',
37
+ options: ['communityId', 'communityDisplayName', 'entraGroupId']
38
+ }
31
39
  });
32
40
  }
33
41
  defaultProperties() {
@@ -32,16 +32,25 @@ class VivaEngageCommunityUserRemoveCommand extends GraphCommand {
32
32
  getRefinedSchema(schema) {
33
33
  return schema
34
34
  .refine(options => [options.communityId, options.communityDisplayName, options.entraGroupId].filter(x => x !== undefined).length === 1, {
35
- error: 'Specify either communityId, communityDisplayName, or entraGroupId, but not multiple.'
35
+ error: 'Specify either communityId, communityDisplayName, or entraGroupId, but not multiple.',
36
+ params: {
37
+ customCode: 'optionSet',
38
+ options: ['communityId', 'communityDisplayName', 'entraGroupId']
39
+ }
36
40
  })
37
41
  .refine(options => options.communityId || options.communityDisplayName || options.entraGroupId, {
38
- error: 'Specify at least one of communityId, communityDisplayName, or entraGroupId.'
39
- })
40
- .refine(options => options.id || options.userName, {
41
- error: 'Specify either of id or userName.'
42
+ error: 'Specify at least one of communityId, communityDisplayName, or entraGroupId.',
43
+ params: {
44
+ customCode: 'optionSet',
45
+ options: ['communityId', 'communityDisplayName', 'entraGroupId']
46
+ }
42
47
  })
43
- .refine(options => typeof options.userName !== 'undefined' || typeof options.id !== 'undefined', {
44
- error: 'Specify either id or userName, but not both.'
48
+ .refine(options => [options.id, options.userName].filter(o => o !== undefined).length === 1, {
49
+ error: 'Specify either id or userName, but not both.',
50
+ params: {
51
+ customCode: 'optionSet',
52
+ options: ['id', 'userName']
53
+ }
45
54
  });
46
55
  }
47
56
  async commandAction(logger, args) {
@@ -22,7 +22,11 @@ class VivaEngageRoleMemberListCommand extends GraphCommand {
22
22
  getRefinedSchema(schema) {
23
23
  return schema
24
24
  .refine(options => [options.roleId, options.roleName].filter(x => x !== undefined).length === 1, {
25
- error: 'Specify either roleId, or roleName, but not both.'
25
+ error: 'Specify either roleId, or roleName, but not both.',
26
+ params: {
27
+ customCode: 'optionSet',
28
+ options: ['roleId', 'roleName']
29
+ }
26
30
  });
27
31
  }
28
32
  defaultProperties() {
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
- // uninstall commands must come first otherwise there is a chance that
47
- // whatever we recommended to install, will be immediately uninstalled
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
  };
@@ -13,13 +13,7 @@ export const prompt = {
13
13
  }
14
14
  const errorOutput = cli.getSettingWithDefaultValue(settingsNames.errorOutput, 'stderr');
15
15
  return inquirerInput
16
- .default(config, { output: errorOutput === 'stderr' ? process.stderr : process.stdout })
17
- .catch(error => {
18
- if (error instanceof Error && error.name === 'ExitPromptError') {
19
- return ''; // noop; handle Ctrl + C
20
- }
21
- throw error;
22
- });
16
+ .default(config, { output: errorOutput === 'stderr' ? process.stderr : process.stdout });
23
17
  },
24
18
  /* c8 ignore next 9 */
25
19
  async forConfirmation(config) {
@@ -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`, `pnpm`, `yarn`. Default `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-rc.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