@pnp/cli-microsoft365-spfx-toolkit 1.13.0 → 1.15.0

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/dist/Auth.js CHANGED
@@ -123,7 +123,7 @@ class Auth {
123
123
  }
124
124
  });
125
125
  }
126
- ensureAccessToken(resource, logger, debug = false, fetchNew = false) {
126
+ ensureAccessToken(resource, logger, debug = false, fetchNew = false, interactive = true) {
127
127
  return __awaiter(this, void 0, void 0, function* () {
128
128
  const now = new Date();
129
129
  const accessToken = this.service.accessTokens[resource];
@@ -162,6 +162,16 @@ class Auth {
162
162
  }
163
163
  }
164
164
  }
165
+ // when the token can't be retrieved silently, auth types that require
166
+ // user interaction would prompt the user (eg. open the browser) which
167
+ // isn't allowed when the caller only wants to verify the connection
168
+ if (!getTokenPromise && !interactive &&
169
+ (this.service.authType === AuthType.DeviceCode || this.service.authType === AuthType.Browser)) {
170
+ if (debug) {
171
+ logger.logToStderr(`Retrieving a new access token requires user interaction which is not allowed.`);
172
+ }
173
+ throw new Error('Retrieving a new access token requires signing in again');
174
+ }
165
175
  if (!getTokenPromise) {
166
176
  switch (this.service.authType) {
167
177
  case AuthType.DeviceCode:
@@ -24,7 +24,8 @@ class StatusCommand extends Command_1.default {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
25
  if (Auth_1.default.service.connected) {
26
26
  try {
27
- yield Auth_1.default.ensureAccessToken(Auth_1.default.defaultResource, logger, this.debug);
27
+ // status only verifies the connection so it must never prompt the user to sign in
28
+ yield Auth_1.default.ensureAccessToken(Auth_1.default.defaultResource, logger, this.debug, false, false);
28
29
  }
29
30
  catch (err) {
30
31
  if (this.debug) {
@@ -14,16 +14,16 @@ exports.workflow = {
14
14
  "build-and-deploy": {
15
15
  "runs-on": "ubuntu-latest",
16
16
  env: {
17
- NodeVersion: "22.x"
17
+ NodeVersion: ""
18
18
  },
19
19
  steps: [
20
20
  {
21
21
  name: "Checkout",
22
- uses: "actions/checkout@v3.5.3"
22
+ uses: "actions/checkout@v6"
23
23
  },
24
24
  {
25
25
  name: "Use Node.js",
26
- uses: "actions/setup-node@v3.7.0",
26
+ uses: "actions/setup-node@v6",
27
27
  with: {
28
28
  "node-version": "${{ env.NodeVersion }}"
29
29
  }
@@ -33,12 +33,12 @@ exports.workflow = {
33
33
  run: "npm ci"
34
34
  },
35
35
  {
36
- name: "Bundle & Package",
37
- run: "gulp bundle --ship\ngulp package-solution --ship\n"
36
+ name: "Build & Package",
37
+ run: "npm run build"
38
38
  },
39
39
  {
40
40
  name: "CLI for Microsoft 365 Login",
41
- uses: "pnp/action-cli-login@v2.2.4",
41
+ uses: "pnp/action-cli-login@v4",
42
42
  with: {
43
43
  "CERTIFICATE_ENCODED": "${{ secrets.CERTIFICATE_ENCODED }}",
44
44
  "CERTIFICATE_PASSWORD": "${{ secrets.CERTIFICATE_PASSWORD }}",
@@ -48,9 +48,9 @@ exports.workflow = {
48
48
  },
49
49
  {
50
50
  name: "CLI for Microsoft 365 Deploy App",
51
- uses: "pnp/action-cli-deploy@v4.0.0",
51
+ uses: "pnp/action-cli-deploy@v6",
52
52
  with: {
53
- "APP_FILE_PATH": "sharepoint/solution/{{ solutionName }}.sppkg",
53
+ "APP_FILE_PATH": "sharepoint/{{ sppkgPath }}",
54
54
  "SKIP_FEATURE_DEPLOYMENT": false,
55
55
  "OVERWRITE": false
56
56
  }
@@ -108,13 +108,17 @@ exports.pipeline = {
108
108
  name: "PackageName",
109
109
  value: ""
110
110
  },
111
+ {
112
+ name: "SppkgPath",
113
+ value: ""
114
+ },
111
115
  {
112
116
  name: "SiteAppCatalogUrl",
113
117
  value: ""
114
118
  },
115
119
  {
116
120
  name: "NodeVersion",
117
- value: "22.x"
121
+ value: ""
118
122
  }
119
123
  ],
120
124
  stages: [
@@ -139,20 +143,12 @@ exports.pipeline = {
139
143
  }
140
144
  },
141
145
  {
142
- task: "Gulp@0",
143
- displayName: "Gulp bundle",
144
- inputs: {
145
- gulpFile: "./gulpfile.js",
146
- targets: "bundle",
147
- arguments: "--ship"
148
- }
149
- },
150
- {
151
- task: "Gulp@0",
152
- displayName: "Gulp package",
146
+ task: "Npm@1",
147
+ displayName: "Build and package",
153
148
  inputs: {
154
- targets: "package-solution",
155
- arguments: "--ship"
149
+ command: "custom",
150
+ verbose: false,
151
+ customCommand: "run build"
156
152
  }
157
153
  },
158
154
  {
@@ -7,6 +7,7 @@ const formatting_1 = require("../../../../utils/formatting");
7
7
  const fsUtil_1 = require("../../../../utils/fsUtil");
8
8
  const AnonymousCommand_1 = require("../../../base/AnonymousCommand");
9
9
  const project_model_1 = require("./project-model");
10
+ const Command_1 = require("../../../../Command");
10
11
  class BaseProjectCommand extends AnonymousCommand_1.default {
11
12
  constructor() {
12
13
  super(...arguments);
@@ -236,6 +237,27 @@ class BaseProjectCommand extends AnonymousCommand_1.default {
236
237
  catch (_b) { }
237
238
  return undefined;
238
239
  }
240
+ readAndParseJsonFile(filePath, project, keyPath) {
241
+ if (fs.existsSync(filePath)) {
242
+ try {
243
+ const source = formatting_1.formatting.removeSingleLineComments(fs.readFileSync(filePath, 'utf-8'));
244
+ const keys = keyPath.split('.');
245
+ let current = project;
246
+ for (let i = 0; i < keys.length - 1; i++) {
247
+ current = current[keys[i]];
248
+ }
249
+ const finalKey = keys[keys.length - 1];
250
+ current[finalKey] = JSON.parse(source);
251
+ if (typeof current[finalKey] === 'object' && current[finalKey] !== null) {
252
+ current[finalKey].source = source;
253
+ }
254
+ }
255
+ catch (error) {
256
+ throw new Command_1.CommandError(`The file ${filePath} is not a valid JSON file or is not utf-8 encoded. Error: ${error}`);
257
+ }
258
+ }
259
+ return project;
260
+ }
239
261
  }
240
262
  exports.BaseProjectCommand = BaseProjectCommand;
241
263
  //# sourceMappingURL=base-project-command.js.map
@@ -23,6 +23,8 @@ const commands_1 = require("../../commands");
23
23
  const base_project_command_1 = require("./base-project-command");
24
24
  const validation_1 = require("../../../../utils/validation");
25
25
  const fsUtil_1 = require("../../../../utils/fsUtil");
26
+ const SpfxCompatibilityMatrix_1 = require("../SpfxCompatibilityMatrix");
27
+ const spfx_1 = require("../../../../utils/spfx");
26
28
  class SpfxProjectAzureDevOpsPipelineAddCommand extends base_project_command_1.BaseProjectCommand {
27
29
  get name() {
28
30
  return commands_1.default.PROJECT_AZUREDEVOPS_PIPELINE_ADD;
@@ -38,14 +40,12 @@ class SpfxProjectAzureDevOpsPipelineAddCommand extends base_project_command_1.Ba
38
40
  __classPrivateFieldGet(this, _SpfxProjectAzureDevOpsPipelineAddCommand_instances, "m", _SpfxProjectAzureDevOpsPipelineAddCommand_initValidators).call(this);
39
41
  }
40
42
  commandAction(logger, args) {
43
+ var _a, _b;
41
44
  return __awaiter(this, void 0, void 0, function* () {
42
45
  this.projectRootPath = this.getProjectRoot(process.cwd());
43
46
  if (this.projectRootPath === null) {
44
47
  throw new Command_1.CommandError(`Couldn't find project root folder`, SpfxProjectAzureDevOpsPipelineAddCommand.ERROR_NO_PROJECT_ROOT_FOLDER);
45
48
  }
46
- const solutionPackageJsonFile = path.join(this.projectRootPath, 'package.json');
47
- const packageJson = fs.readFileSync(solutionPackageJsonFile, 'utf-8');
48
- const solutionName = JSON.parse(packageJson).name;
49
49
  if (this.debug) {
50
50
  logger.logToStderr(`Adding Azure DevOps pipeline in the current SPFx project`);
51
51
  }
@@ -53,11 +53,15 @@ class SpfxProjectAzureDevOpsPipelineAddCommand extends base_project_command_1.Ba
53
53
  delete require.cache[require.resolve('./DeployWorkflow')];
54
54
  const deployWorkflow = require('./DeployWorkflow');
55
55
  const pipeline = deployWorkflow.pipeline;
56
- this.updatePipeline(solutionName, pipeline, args.options);
57
- this.savePipeline(pipeline);
56
+ const project = { path: this.projectRootPath };
57
+ this.readAndParseJsonFile(path.join(this.projectRootPath, 'config', 'package-solution.json'), project, 'packageSolutionJson');
58
+ const sppkgPath = (_b = (_a = project.packageSolutionJson) === null || _a === void 0 ? void 0 : _a.paths) === null || _b === void 0 ? void 0 : _b.zippedPackage;
59
+ const pipelineToSave = structuredClone(pipeline);
60
+ this.updatePipeline(sppkgPath, pipelineToSave, args.options);
61
+ this.savePipeline(pipelineToSave);
58
62
  }
59
63
  catch (error) {
60
- throw new Command_1.CommandError(error);
64
+ this.handleError(error);
61
65
  }
62
66
  });
63
67
  }
@@ -69,7 +73,7 @@ class SpfxProjectAzureDevOpsPipelineAddCommand extends base_project_command_1.Ba
69
73
  const pipelineFile = path.join(pipelinesPath, 'deploy-spfx-solution.yml');
70
74
  fs.writeFileSync(path.resolve(pipelineFile), yaml.stringify(pipeline), 'utf-8');
71
75
  }
72
- updatePipeline(solutionName, pipeline, options) {
76
+ updatePipeline(sppkgPath, pipeline, options) {
73
77
  if (options.name) {
74
78
  pipeline.name = options.name;
75
79
  }
@@ -79,6 +83,16 @@ class SpfxProjectAzureDevOpsPipelineAddCommand extends base_project_command_1.Ba
79
83
  if (options.branchName) {
80
84
  pipeline.trigger.branches.include[0] = options.branchName;
81
85
  }
86
+ const version = this.getProjectVersion();
87
+ if (!version) {
88
+ throw 'Unable to determine the version of the current SharePoint Framework project. Could not find the correct version based on the version property in the .yo-rc.json file.';
89
+ }
90
+ const versionRequirements = SpfxCompatibilityMatrix_1.versions[version];
91
+ if (!versionRequirements) {
92
+ throw `Could not find Node version for version '${version}' of SharePoint Framework.`;
93
+ }
94
+ const nodeVersion = spfx_1.spfx.getHighestNodeVersion(versionRequirements.node.range);
95
+ this.assignPipelineVariables(pipeline, 'NodeVersion', nodeVersion);
82
96
  const script = this.getScriptAction(pipeline);
83
97
  if (script.script) {
84
98
  if (options.loginMethod === 'user') {
@@ -96,20 +110,48 @@ class SpfxProjectAzureDevOpsPipelineAddCommand extends base_project_command_1.Ba
96
110
  }
97
111
  if (options.scope === 'sitecollection') {
98
112
  script.script = script.script.replace(`{{deploy}}`, `m365 spo app deploy --name '$(PackageName)' --appCatalogScope sitecollection --appCatalogUrl '$(SiteAppCatalogUrl)'`);
99
- script.script = script.script.replace(`{{addApp}}`, `m365 spo app add --filePath '$(Build.SourcesDirectory)/sharepoint/solution/$(PackageName)' --appCatalogScope sitecollection --appCatalogUrl '$(SiteAppCatalogUrl)' --overwrite`);
113
+ script.script = script.script.replace(`{{addApp}}`, `m365 spo app add --filePath '$(Build.SourcesDirectory)/sharepoint/$(SppkgPath)' --appCatalogScope sitecollection --appCatalogUrl '$(SiteAppCatalogUrl)' --overwrite`);
100
114
  this.assignPipelineVariables(pipeline, 'SiteAppCatalogUrl', options.siteUrl);
101
115
  }
102
116
  else {
103
117
  script.script = script.script.replace(`{{deploy}}`, `m365 spo app deploy --name '$(PackageName)' --appCatalogScope 'tenant'`);
104
- script.script = script.script.replace(`{{addApp}}`, `m365 spo app add --filePath '$(Build.SourcesDirectory)/sharepoint/solution/$(PackageName)' --overwrite`);
118
+ script.script = script.script.replace(`{{addApp}}`, `m365 spo app add --filePath '$(Build.SourcesDirectory)/sharepoint/$(SppkgPath)' --overwrite`);
105
119
  pipeline.variables = pipeline.variables.filter(v => v.name !== 'SiteAppCatalogUrl');
106
120
  }
107
- if (solutionName) {
108
- this.assignPipelineVariables(pipeline, 'PackageName', `${solutionName}.sppkg`);
121
+ if (sppkgPath) {
122
+ this.assignPipelineVariables(pipeline, 'SppkgPath', sppkgPath);
123
+ this.assignPipelineVariables(pipeline, 'PackageName', path.basename(sppkgPath));
109
124
  }
110
125
  if (options.skipFeatureDeployment) {
111
126
  script.script = script.script.replace(`m365 spo app deploy `, `m365 spo app deploy --skipFeatureDeployment `);
112
127
  }
128
+ if (versionRequirements.heft === undefined) {
129
+ let steps = this.getPipelineSteps(pipeline);
130
+ const npmBuildScript = steps.find(step => step.task && step.displayName === 'Build and package');
131
+ if (npmBuildScript) {
132
+ pipeline.stages[0].jobs[0].steps = steps.filter(step => step !== npmBuildScript);
133
+ }
134
+ const gulpBundleStep = {
135
+ task: 'Gulp@0',
136
+ displayName: 'Gulp bundle',
137
+ inputs: {
138
+ gulpFile: './gulpfile.js',
139
+ targets: 'bundle',
140
+ arguments: '--ship'
141
+ }
142
+ };
143
+ const gulpPackageStep = {
144
+ task: 'Gulp@0',
145
+ displayName: 'Gulp package',
146
+ inputs: {
147
+ targets: 'package-solution',
148
+ arguments: '--ship'
149
+ }
150
+ };
151
+ steps = this.getPipelineSteps(pipeline);
152
+ const installCLIStepIndex = steps.findIndex(step => step.task === 'Npm@1' && step.displayName === 'Install CLI for Microsoft 365');
153
+ pipeline.stages[0].jobs[0].steps.splice(installCLIStepIndex, 0, gulpBundleStep, gulpPackageStep);
154
+ }
113
155
  }
114
156
  }
115
157
  assignPipelineVariables(pipeline, variableName, newVariableValue) {
@@ -23,6 +23,8 @@ const fsUtil_1 = require("../../../../utils/fsUtil");
23
23
  const validation_1 = require("../../../../utils/validation");
24
24
  const commands_1 = require("../../commands");
25
25
  const base_project_command_1 = require("./base-project-command");
26
+ const SpfxCompatibilityMatrix_1 = require("../SpfxCompatibilityMatrix");
27
+ const spfx_1 = require("../../../../utils/spfx");
26
28
  class SpfxProjectGithubWorkflowAddCommand extends base_project_command_1.BaseProjectCommand {
27
29
  get name() {
28
30
  return commands_1.default.PROJECT_GITHUB_WORKFLOW_ADD;
@@ -38,26 +40,30 @@ class SpfxProjectGithubWorkflowAddCommand extends base_project_command_1.BasePro
38
40
  __classPrivateFieldGet(this, _SpfxProjectGithubWorkflowAddCommand_instances, "m", _SpfxProjectGithubWorkflowAddCommand_initValidators).call(this);
39
41
  }
40
42
  commandAction(logger, args) {
43
+ var _a, _b;
41
44
  return __awaiter(this, void 0, void 0, function* () {
42
45
  this.projectRootPath = this.getProjectRoot(process.cwd());
43
46
  if (this.projectRootPath === null) {
44
47
  throw new Command_1.CommandError(`Couldn't find project root folder`, SpfxProjectGithubWorkflowAddCommand.ERROR_NO_PROJECT_ROOT_FOLDER);
45
48
  }
46
- const solutionPackageJsonFile = path.join(this.projectRootPath, 'package.json');
47
- const packageJson = fs.readFileSync(solutionPackageJsonFile, 'utf-8');
48
- const solutionName = JSON.parse(packageJson).name;
49
- if (this.debug) {
50
- logger.logToStderr(`Adding GitHub workflow in the current SPFx project`);
51
- }
52
49
  try {
50
+ const project = { path: this.projectRootPath };
51
+ this.readAndParseJsonFile(path.join(this.projectRootPath, 'package.json'), project, 'packageJson');
52
+ this.readAndParseJsonFile(path.join(this.projectRootPath, 'config', 'package-solution.json'), project, 'packageSolutionJson');
53
+ const solutionName = project.packageJson.name;
54
+ const sppkgPath = (_b = (_a = project.packageSolutionJson) === null || _a === void 0 ? void 0 : _a.paths) === null || _b === void 0 ? void 0 : _b.zippedPackage;
55
+ if (this.debug) {
56
+ logger.logToStderr(`Adding GitHub workflow in the current SPFx project`);
57
+ }
53
58
  delete require.cache[require.resolve('./DeployWorkflow')];
54
59
  const deployWorkflow = require('./DeployWorkflow');
55
60
  const workflow = deployWorkflow.workflow;
56
- this.updateWorkflow(solutionName, workflow, args.options);
57
- this.saveWorkflow(workflow);
61
+ const workflowToSave = structuredClone(workflow);
62
+ this.updateWorkflow(solutionName, sppkgPath, workflowToSave, args.options);
63
+ this.saveWorkflow(workflowToSave);
58
64
  }
59
65
  catch (error) {
60
- throw new Command_1.CommandError(error);
66
+ this.handleError(error);
61
67
  }
62
68
  });
63
69
  }
@@ -69,11 +75,21 @@ class SpfxProjectGithubWorkflowAddCommand extends base_project_command_1.BasePro
69
75
  const workflowFile = path.join(workflowPath, 'deploy-spfx-solution.yml');
70
76
  fs.writeFileSync(path.resolve(workflowFile), yaml.stringify(workflow), 'utf-8');
71
77
  }
72
- updateWorkflow(solutionName, workflow, options) {
78
+ updateWorkflow(solutionName, sppkgPath, workflow, options) {
73
79
  workflow.name = options.name ? options.name : workflow.name.replace('{{ name }}', solutionName);
74
80
  if (options.branchName) {
75
81
  workflow.on.push.branches[0] = options.branchName;
76
82
  }
83
+ const version = this.getProjectVersion();
84
+ if (!version) {
85
+ throw 'Unable to determine the version of the current SharePoint Framework project. Could not find the correct version based on the version property in the .yo-rc.json file.';
86
+ }
87
+ const versionRequirements = SpfxCompatibilityMatrix_1.versions[version];
88
+ if (!versionRequirements) {
89
+ throw `Could not find Node version for version '${version}' of SharePoint Framework.`;
90
+ }
91
+ const nodeVersion = spfx_1.spfx.getHighestNodeVersion(versionRequirements.node.range);
92
+ this.assignNodeVersion(workflow, nodeVersion);
77
93
  if (options.manuallyTrigger) {
78
94
  // eslint-disable-next-line camelcase
79
95
  workflow.on.workflow_dispatch = null;
@@ -96,11 +112,23 @@ class SpfxProjectGithubWorkflowAddCommand extends base_project_command_1.BasePro
96
112
  deployAction.with.SCOPE = 'sitecollection';
97
113
  deployAction.with.SITE_COLLECTION_URL = options.siteUrl;
98
114
  }
99
- if (solutionName) {
115
+ if (sppkgPath) {
100
116
  const deployAction = this.getDeployAction(workflow);
101
- deployAction.with.APP_FILE_PATH = deployAction.with.APP_FILE_PATH.replace('{{ solutionName }}', solutionName);
117
+ deployAction.with.APP_FILE_PATH = deployAction.with.APP_FILE_PATH.replace('{{ sppkgPath }}', sppkgPath);
118
+ }
119
+ if (versionRequirements.heft === undefined) {
120
+ const buildAndPackageStep = this.getBuildAndPackageStep(workflow);
121
+ buildAndPackageStep.run = `gulp bundle --ship\ngulp package-solution --ship\n`;
122
+ buildAndPackageStep.name = 'Bundle & Package';
102
123
  }
103
124
  }
125
+ assignNodeVersion(workflow, nodeVersion) {
126
+ workflow.jobs['build-and-deploy'].env.NodeVersion = nodeVersion;
127
+ }
128
+ getBuildAndPackageStep(workflow) {
129
+ const steps = this.getWorkFlowSteps(workflow);
130
+ return steps.find(step => step.run && step.name === 'Build & Package');
131
+ }
104
132
  getLoginAction(workflow) {
105
133
  const steps = this.getWorkFlowSteps(workflow);
106
134
  return steps.find(step => step.uses && step.uses.indexOf('action-cli-login') >= 0);
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.spfx = void 0;
4
+ const semver_1 = require("semver");
4
5
  exports.spfx = {
5
6
  isReactProject(project) {
6
7
  var _a, _b;
@@ -16,6 +17,64 @@ exports.spfx = {
16
17
  typeof project.yoRcJson['@microsoft/generator-sharepoint'] !== 'undefined' &&
17
18
  project.yoRcJson["@microsoft/generator-sharepoint"].framework === 'knockout') ||
18
19
  typeof ((_b = (_a = project.packageJson) === null || _a === void 0 ? void 0 : _a.dependencies) === null || _b === void 0 ? void 0 : _b['knockout']) !== 'undefined';
20
+ },
21
+ getHighestNodeVersion(versionRange) {
22
+ if (!versionRange) {
23
+ throw new Error('Node version range was not provided.');
24
+ }
25
+ const ranges = versionRange
26
+ .split('||')
27
+ .map(range => range.trim())
28
+ .filter(range => range.length > 0);
29
+ let highestMajor = null;
30
+ let exactVersion = null;
31
+ const simpleVersionPattern = /^\d+(\.\d+(\.\d+)?)?$/;
32
+ if (ranges.every(r => simpleVersionPattern.test(r))) {
33
+ const highest = ranges.reduce((best, curr) => (0, semver_1.gt)((0, semver_1.coerce)(curr), (0, semver_1.coerce)(best)) ? curr : best);
34
+ const parts = highest.split('.');
35
+ if (parts.length >= 3) {
36
+ return highest;
37
+ }
38
+ if (parts.length === 2) {
39
+ return `${highest}.x`;
40
+ }
41
+ }
42
+ for (const rangeString of ranges) {
43
+ const normalized = (0, semver_1.validRange)(rangeString);
44
+ if (!normalized) {
45
+ continue;
46
+ }
47
+ const rangeObj = new semver_1.Range(normalized);
48
+ let maxMajor = 0;
49
+ // Analyze the range to find the maximum major version
50
+ for (const comparatorSet of rangeObj.set) {
51
+ for (const comparator of comparatorSet) {
52
+ if (comparator.operator === '<') {
53
+ // Exclusive upper bound: <17.0.0 means max major is 16
54
+ maxMajor = Math.max(maxMajor, comparator.semver.major - 1);
55
+ }
56
+ else if (comparator.operator === '<=') {
57
+ // Inclusive upper bound: <=17.0.0 means we can use exactly that version
58
+ maxMajor = Math.max(maxMajor, comparator.semver.major);
59
+ // Store the exact version for <= comparator
60
+ if (highestMajor === null || comparator.semver.major > highestMajor) {
61
+ exactVersion = comparator.semver.version;
62
+ }
63
+ }
64
+ else if (comparator.operator === '>=' || comparator.operator === '>') {
65
+ // For lower bounds use the major version
66
+ maxMajor = Math.max(maxMajor, comparator.semver.major);
67
+ }
68
+ }
69
+ }
70
+ // Track the highest major version across all ranges
71
+ highestMajor = Math.max(highestMajor !== null && highestMajor !== void 0 ? highestMajor : 0, maxMajor);
72
+ }
73
+ if (highestMajor === null) {
74
+ throw new Error(`Unable to resolve the highest Node version for range '${versionRange}'.`);
75
+ }
76
+ // Return exact version if we have a <= comparator, otherwise use .x
77
+ return exactVersion || `${highestMajor}.x`;
19
78
  }
20
79
  };
21
80
  //# sourceMappingURL=spfx.js.map
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365-spfx-toolkit",
3
- "version": "1.13.0",
3
+ "version": "1.15.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@pnp/cli-microsoft365-spfx-toolkit",
9
- "version": "1.13.0",
9
+ "version": "1.15.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@azure/msal-common": "^13.2.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365-spfx-toolkit",
3
- "version": "1.13.0",
3
+ "version": "1.15.0",
4
4
  "description": "CommonJS version of CLI for Microsoft 365 for SPFx Toolkit",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",