@pnp/cli-microsoft365 7.7.0-beta.a12fb3e → 7.7.0-beta.cec4ca2
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/.eslintrc.cjs +1 -0
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Command.js +1 -1
- package/dist/cli/cli.js +9 -4
- package/dist/m365/commands/setup.js +1 -7
- package/dist/m365/entra/commands/user/user-list.js +20 -7
- package/dist/m365/spe/commands/containertype/containertype-add.js +115 -0
- package/dist/m365/spe/commands.js +5 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.0.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.0.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.0.2.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.1.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.1.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.1.3.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.10.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.11.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.12.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.12.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.13.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.13.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.14.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.15.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.15.2.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.16.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.16.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.2.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.3.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.4.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.18.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.18.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.18.2.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.19.0-beta.0.js +25 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.2.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.3.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.3.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.3.2.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.3.4.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.4.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.4.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.5.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.5.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.6.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.7.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.7.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.8.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.8.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.8.2.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.9.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/generic-rules.js +0 -2
- package/dist/m365/spfx/commands/project/project-doctor/rules/FN021001_PKG_spfx_deps_versions_match_project_version.js +3 -2
- package/dist/m365/spfx/commands/project/project-doctor/rules/FN021013_PKG_spfx_devdeps_match_version.js +58 -0
- package/dist/m365/spfx/commands/project/project-doctor/spfx-deps.js +2 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.19.0-beta.0.js +53 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +16 -13
- package/dist/m365/spfx/commands/spfx-doctor.js +212 -92
- package/dist/m365/spo/commands/listitem/listitem-set.js +9 -156
- package/dist/m365/spo/commands/page/page-add.js +6 -24
- package/dist/m365/spo/commands/page/page-set.js +19 -43
- package/dist/m365/spo/commands/site/site-apppermission-remove.js +8 -9
- package/dist/m365/spo/commands/site/site-hubsite-connect.js +3 -3
- package/dist/m365/spo/commands/site/site-hubsite-disconnect.js +2 -5
- package/dist/utils/prompt.js +2 -0
- package/dist/utils/spo.js +188 -0
- package/docs/docs/cmd/entra/user/user-list.mdx +36 -15
- package/docs/docs/cmd/spe/containertype/containertype-add.mdx +140 -0
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
- package/docs/docs/cmd/spfx/spfx-doctor.mdx +108 -2
- package/docs/docs/cmd/spo/page/page-set.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-apppermission-add.mdx +1 -1
- package/npm-shrinkwrap.json +138 -214
- package/package.json +14 -14
|
@@ -19,14 +19,6 @@ var PackageSearchMode;
|
|
|
19
19
|
PackageSearchMode[PackageSearchMode["GlobalOnly"] = 1] = "GlobalOnly";
|
|
20
20
|
PackageSearchMode[PackageSearchMode["LocalAndGlobal"] = 2] = "LocalAndGlobal";
|
|
21
21
|
})(PackageSearchMode || (PackageSearchMode = {}));
|
|
22
|
-
/**
|
|
23
|
-
* Is the particular check optional or required
|
|
24
|
-
*/
|
|
25
|
-
var OptionalOrRequired;
|
|
26
|
-
(function (OptionalOrRequired) {
|
|
27
|
-
OptionalOrRequired[OptionalOrRequired["Optional"] = 0] = "Optional";
|
|
28
|
-
OptionalOrRequired[OptionalOrRequired["Required"] = 1] = "Required";
|
|
29
|
-
})(OptionalOrRequired || (OptionalOrRequired = {}));
|
|
30
22
|
/**
|
|
31
23
|
* Should the method continue or fail on a rejected Promise
|
|
32
24
|
*/
|
|
@@ -47,7 +39,7 @@ var SharePointVersion;
|
|
|
47
39
|
})(SharePointVersion || (SharePointVersion = {}));
|
|
48
40
|
class SpfxDoctorCommand extends BaseProjectCommand {
|
|
49
41
|
get allowedOutputs() {
|
|
50
|
-
return ['text'];
|
|
42
|
+
return ['text', 'json'];
|
|
51
43
|
}
|
|
52
44
|
get name() {
|
|
53
45
|
return commands.DOCTOR;
|
|
@@ -568,8 +560,25 @@ class SpfxDoctorCommand extends BaseProjectCommand {
|
|
|
568
560
|
range: '^4 || ^5',
|
|
569
561
|
fix: 'npm i -g yo@5'
|
|
570
562
|
}
|
|
563
|
+
},
|
|
564
|
+
'1.19.0-beta.0': {
|
|
565
|
+
gulpCli: {
|
|
566
|
+
range: '^1 || ^2',
|
|
567
|
+
fix: 'npm i -g gulp-cli@2'
|
|
568
|
+
},
|
|
569
|
+
node: {
|
|
570
|
+
range: '>=18.17.1 <19.0.0',
|
|
571
|
+
fix: 'Install Node.js >=18.17.1 <19.0.0'
|
|
572
|
+
},
|
|
573
|
+
sp: SharePointVersion.SPO,
|
|
574
|
+
yo: {
|
|
575
|
+
range: '^4 || ^5',
|
|
576
|
+
fix: 'npm i -g yo@5'
|
|
577
|
+
}
|
|
571
578
|
}
|
|
572
579
|
};
|
|
580
|
+
this.output = '';
|
|
581
|
+
this.resultsObject = [];
|
|
573
582
|
__classPrivateFieldGet(this, _SpfxDoctorCommand_instances, "m", _SpfxDoctorCommand_initTelemetry).call(this);
|
|
574
583
|
__classPrivateFieldGet(this, _SpfxDoctorCommand_instances, "m", _SpfxDoctorCommand_initOptions).call(this);
|
|
575
584
|
__classPrivateFieldGet(this, _SpfxDoctorCommand_instances, "m", _SpfxDoctorCommand_initValidators).call(this);
|
|
@@ -578,168 +587,265 @@ class SpfxDoctorCommand extends BaseProjectCommand {
|
|
|
578
587
|
if (!args.options.output) {
|
|
579
588
|
args.options.output = 'text';
|
|
580
589
|
}
|
|
590
|
+
this.output = args.options.output;
|
|
581
591
|
this.projectRootPath = this.getProjectRoot(process.cwd());
|
|
582
|
-
|
|
583
|
-
await
|
|
584
|
-
await
|
|
585
|
-
await
|
|
592
|
+
this.logger = logger;
|
|
593
|
+
await this.logMessage(' ');
|
|
594
|
+
await this.logMessage('CLI for Microsoft 365 SharePoint Framework doctor');
|
|
595
|
+
await this.logMessage('Verifying configuration of your system for working with the SharePoint Framework');
|
|
596
|
+
await this.logMessage(' ');
|
|
586
597
|
let spfxVersion = '';
|
|
587
598
|
let prerequisites;
|
|
588
|
-
const fixes = [];
|
|
589
599
|
try {
|
|
590
|
-
spfxVersion = args.options.spfxVersion ?? await this.getSharePointFrameworkVersion(
|
|
600
|
+
spfxVersion = args.options.spfxVersion ?? await this.getSharePointFrameworkVersion();
|
|
591
601
|
if (!spfxVersion) {
|
|
592
|
-
await
|
|
602
|
+
await this.logMessage(formatting.getStatus(CheckStatus.Failure, `SharePoint Framework`));
|
|
603
|
+
this.resultsObject.push({
|
|
604
|
+
check: 'SharePoint Framework',
|
|
605
|
+
passed: false,
|
|
606
|
+
message: `SharePoint Framework not found`
|
|
607
|
+
});
|
|
593
608
|
throw `SharePoint Framework not found`;
|
|
594
609
|
}
|
|
595
610
|
prerequisites = this.versions[spfxVersion];
|
|
596
611
|
if (!prerequisites) {
|
|
597
|
-
|
|
598
|
-
|
|
612
|
+
const message = `spfx doctor doesn't support SPFx v${spfxVersion} at this moment`;
|
|
613
|
+
this.resultsObject.push({
|
|
614
|
+
check: 'SharePoint Framework',
|
|
615
|
+
passed: true,
|
|
616
|
+
version: spfxVersion,
|
|
617
|
+
message: message
|
|
618
|
+
});
|
|
619
|
+
await this.logMessage(formatting.getStatus(CheckStatus.Failure, `SharePoint Framework v${spfxVersion}`));
|
|
620
|
+
throw message;
|
|
621
|
+
}
|
|
622
|
+
else {
|
|
623
|
+
this.resultsObject.push({
|
|
624
|
+
check: 'SharePoint Framework',
|
|
625
|
+
passed: true,
|
|
626
|
+
version: spfxVersion,
|
|
627
|
+
message: `SharePoint Framework v${spfxVersion} valid.`
|
|
628
|
+
});
|
|
599
629
|
}
|
|
600
630
|
if (args.options.spfxVersion) {
|
|
601
|
-
await this.checkSharePointFrameworkVersion(args.options.spfxVersion
|
|
631
|
+
await this.checkSharePointFrameworkVersion(args.options.spfxVersion);
|
|
602
632
|
}
|
|
603
633
|
else {
|
|
604
634
|
// spfx was detected and if we are here, it means that we support it
|
|
605
|
-
|
|
635
|
+
const message = `SharePoint Framework v${spfxVersion}`;
|
|
636
|
+
this.resultsObject.push({
|
|
637
|
+
check: 'SharePoint Framework',
|
|
638
|
+
passed: true,
|
|
639
|
+
version: spfxVersion,
|
|
640
|
+
message: message
|
|
641
|
+
});
|
|
642
|
+
await this.logMessage(formatting.getStatus(CheckStatus.Success, message));
|
|
606
643
|
}
|
|
607
|
-
await this.checkSharePointCompatibility(spfxVersion, prerequisites, args
|
|
608
|
-
await this.checkNodeVersion(prerequisites
|
|
609
|
-
await this.checkYo(prerequisites
|
|
610
|
-
await this.checkGulp(
|
|
611
|
-
await this.checkGulpCli(prerequisites
|
|
612
|
-
await this.checkTypeScript(
|
|
613
|
-
if (
|
|
614
|
-
await
|
|
615
|
-
await
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
await logger.log(' ');
|
|
644
|
+
await this.checkSharePointCompatibility(spfxVersion, prerequisites, args);
|
|
645
|
+
await this.checkNodeVersion(prerequisites);
|
|
646
|
+
await this.checkYo(prerequisites);
|
|
647
|
+
await this.checkGulp();
|
|
648
|
+
await this.checkGulpCli(prerequisites);
|
|
649
|
+
await this.checkTypeScript();
|
|
650
|
+
if (this.resultsObject.some(y => y.fix !== undefined)) {
|
|
651
|
+
await this.logMessage('Recommended fixes:');
|
|
652
|
+
await this.logMessage(' ');
|
|
653
|
+
for (const f of this.resultsObject.filter(y => y.fix !== undefined)) {
|
|
654
|
+
await this.logMessage(`- ${f.fix}`);
|
|
655
|
+
}
|
|
656
|
+
await this.logMessage(' ');
|
|
621
657
|
}
|
|
622
658
|
}
|
|
623
659
|
catch (err) {
|
|
624
|
-
await
|
|
625
|
-
if (
|
|
626
|
-
await
|
|
627
|
-
await
|
|
628
|
-
for (const f of
|
|
629
|
-
await
|
|
630
|
-
}
|
|
631
|
-
await
|
|
660
|
+
await this.logMessage(' ');
|
|
661
|
+
if (this.resultsObject.some(y => y.fix !== undefined)) {
|
|
662
|
+
await this.logMessage('Recommended fixes:');
|
|
663
|
+
await this.logMessage(' ');
|
|
664
|
+
for (const f of this.resultsObject.filter(y => y.fix !== undefined)) {
|
|
665
|
+
await this.logMessage(`- ${f.fix}`);
|
|
666
|
+
}
|
|
667
|
+
await this.logMessage(' ');
|
|
668
|
+
}
|
|
669
|
+
if (this.output === 'text') {
|
|
670
|
+
this.handleRejectedPromise(err);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
finally {
|
|
674
|
+
if (args.options.output === 'json' && this.resultsObject.length > 0) {
|
|
675
|
+
await logger.log(this.resultsObject);
|
|
632
676
|
}
|
|
633
|
-
this.handleRejectedPromise(err);
|
|
634
677
|
}
|
|
635
678
|
}
|
|
636
|
-
async
|
|
679
|
+
async logMessage(message) {
|
|
680
|
+
if (this.output === 'json') {
|
|
681
|
+
await this.logger.logToStderr(message);
|
|
682
|
+
}
|
|
683
|
+
else {
|
|
684
|
+
await this.logger.log(message);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
async checkSharePointCompatibility(spfxVersion, prerequisites, args) {
|
|
637
688
|
if (args.options.env) {
|
|
638
689
|
const sp = this.spVersionStringToEnum(args.options.env);
|
|
639
690
|
if ((prerequisites.sp & sp) === sp) {
|
|
640
|
-
|
|
691
|
+
const message = `Supported in ${SharePointVersion[sp]}`;
|
|
692
|
+
this.resultsObject.push({
|
|
693
|
+
check: 'env',
|
|
694
|
+
passed: true,
|
|
695
|
+
message: message,
|
|
696
|
+
version: args.options.env
|
|
697
|
+
});
|
|
698
|
+
await this.logMessage(formatting.getStatus(CheckStatus.Success, message));
|
|
641
699
|
return;
|
|
642
700
|
}
|
|
643
|
-
|
|
644
|
-
|
|
701
|
+
const fix = `Use SharePoint Framework v${(sp === SharePointVersion.SP2016 ? '1.1' : '1.4.1')}`;
|
|
702
|
+
const message = `Not supported in ${SharePointVersion[sp]}`;
|
|
703
|
+
this.resultsObject.push({
|
|
704
|
+
check: 'env',
|
|
705
|
+
passed: false,
|
|
706
|
+
fix: fix,
|
|
707
|
+
message: message,
|
|
708
|
+
version: args.options.env
|
|
709
|
+
});
|
|
710
|
+
await this.logMessage(formatting.getStatus(CheckStatus.Failure, message));
|
|
645
711
|
throw `SharePoint Framework v${spfxVersion} is not supported in ${SharePointVersion[sp]}`;
|
|
646
712
|
}
|
|
647
713
|
}
|
|
648
|
-
async checkNodeVersion(prerequisites
|
|
714
|
+
async checkNodeVersion(prerequisites) {
|
|
649
715
|
const nodeVersion = this.getNodeVersion();
|
|
650
|
-
this.checkStatus('Node', nodeVersion, prerequisites.node
|
|
716
|
+
this.checkStatus('Node', nodeVersion, prerequisites.node);
|
|
651
717
|
}
|
|
652
|
-
async checkSharePointFrameworkVersion(spfxVersionRequested
|
|
653
|
-
let spfxVersionDetected = await this.getSPFxVersionFromYoRcFile(
|
|
718
|
+
async checkSharePointFrameworkVersion(spfxVersionRequested) {
|
|
719
|
+
let spfxVersionDetected = await this.getSPFxVersionFromYoRcFile();
|
|
654
720
|
if (!spfxVersionDetected) {
|
|
655
|
-
spfxVersionDetected = await this.getPackageVersion('@microsoft/generator-sharepoint', PackageSearchMode.GlobalOnly, HandlePromise.Continue
|
|
721
|
+
spfxVersionDetected = await this.getPackageVersion('@microsoft/generator-sharepoint', PackageSearchMode.GlobalOnly, HandlePromise.Continue);
|
|
656
722
|
}
|
|
657
723
|
const versionCheck = {
|
|
658
724
|
range: spfxVersionRequested,
|
|
659
725
|
fix: `npm i -g @microsoft/generator-sharepoint@${spfxVersionRequested}`
|
|
660
726
|
};
|
|
661
727
|
if (spfxVersionDetected) {
|
|
662
|
-
this.checkStatus(`SharePoint Framework`, spfxVersionDetected, versionCheck
|
|
728
|
+
this.checkStatus(`SharePoint Framework`, spfxVersionDetected, versionCheck);
|
|
663
729
|
}
|
|
664
730
|
else {
|
|
665
|
-
|
|
666
|
-
|
|
731
|
+
const message = `SharePoint Framework v${spfxVersionRequested} not found`;
|
|
732
|
+
this.resultsObject.push({
|
|
733
|
+
check: 'SharePoint Framework',
|
|
734
|
+
passed: false,
|
|
735
|
+
version: spfxVersionRequested,
|
|
736
|
+
message: message,
|
|
737
|
+
fix: versionCheck.fix
|
|
738
|
+
});
|
|
739
|
+
await this.logMessage(formatting.getStatus(CheckStatus.Failure, message));
|
|
667
740
|
}
|
|
668
741
|
}
|
|
669
|
-
async checkYo(prerequisites
|
|
670
|
-
const yoVersion = await this.getPackageVersion('yo', PackageSearchMode.GlobalOnly, HandlePromise.Continue
|
|
742
|
+
async checkYo(prerequisites) {
|
|
743
|
+
const yoVersion = await this.getPackageVersion('yo', PackageSearchMode.GlobalOnly, HandlePromise.Continue);
|
|
671
744
|
if (yoVersion) {
|
|
672
|
-
this.checkStatus('yo', yoVersion, prerequisites.yo
|
|
745
|
+
this.checkStatus('yo', yoVersion, prerequisites.yo);
|
|
673
746
|
}
|
|
674
747
|
else {
|
|
675
|
-
|
|
676
|
-
|
|
748
|
+
const message = 'yo not found';
|
|
749
|
+
this.resultsObject.push({
|
|
750
|
+
check: 'yo',
|
|
751
|
+
passed: false,
|
|
752
|
+
message: message,
|
|
753
|
+
fix: prerequisites.yo.fix
|
|
754
|
+
});
|
|
755
|
+
await this.logMessage(formatting.getStatus(CheckStatus.Failure, message));
|
|
677
756
|
}
|
|
678
757
|
}
|
|
679
|
-
async checkGulpCli(prerequisites
|
|
680
|
-
const gulpCliVersion = await this.getPackageVersion('gulp-cli', PackageSearchMode.GlobalOnly, HandlePromise.Continue
|
|
758
|
+
async checkGulpCli(prerequisites) {
|
|
759
|
+
const gulpCliVersion = await this.getPackageVersion('gulp-cli', PackageSearchMode.GlobalOnly, HandlePromise.Continue);
|
|
681
760
|
if (gulpCliVersion) {
|
|
682
|
-
this.checkStatus('gulp-cli', gulpCliVersion, prerequisites.gulpCli
|
|
761
|
+
this.checkStatus('gulp-cli', gulpCliVersion, prerequisites.gulpCli);
|
|
683
762
|
}
|
|
684
763
|
else {
|
|
685
|
-
|
|
686
|
-
|
|
764
|
+
const message = 'gulp-cli not found';
|
|
765
|
+
this.resultsObject.push({
|
|
766
|
+
check: 'gulp-cli',
|
|
767
|
+
passed: false,
|
|
768
|
+
message: message,
|
|
769
|
+
fix: prerequisites.gulpCli.fix
|
|
770
|
+
});
|
|
771
|
+
await this.logMessage(formatting.getStatus(CheckStatus.Failure, message));
|
|
687
772
|
}
|
|
688
773
|
}
|
|
689
|
-
async checkGulp(
|
|
690
|
-
const gulpVersion = await this.getPackageVersion('gulp', PackageSearchMode.GlobalOnly, HandlePromise.Continue
|
|
774
|
+
async checkGulp() {
|
|
775
|
+
const gulpVersion = await this.getPackageVersion('gulp', PackageSearchMode.GlobalOnly, HandlePromise.Continue);
|
|
691
776
|
if (gulpVersion) {
|
|
692
|
-
|
|
693
|
-
|
|
777
|
+
const message = 'gulp should be removed';
|
|
778
|
+
const fix = 'npm un -g gulp';
|
|
779
|
+
this.resultsObject.push({
|
|
780
|
+
check: 'gulp',
|
|
781
|
+
passed: false,
|
|
782
|
+
version: gulpVersion,
|
|
783
|
+
message: message,
|
|
784
|
+
fix: fix
|
|
785
|
+
});
|
|
786
|
+
await this.logMessage(formatting.getStatus(CheckStatus.Failure, message));
|
|
694
787
|
}
|
|
695
788
|
}
|
|
696
|
-
async checkTypeScript(
|
|
697
|
-
const typeScriptVersion = await this.getPackageVersion('typescript', PackageSearchMode.LocalOnly, HandlePromise.Continue
|
|
789
|
+
async checkTypeScript() {
|
|
790
|
+
const typeScriptVersion = await this.getPackageVersion('typescript', PackageSearchMode.LocalOnly, HandlePromise.Continue);
|
|
698
791
|
if (typeScriptVersion) {
|
|
699
|
-
|
|
700
|
-
|
|
792
|
+
const fix = 'npm un typescript';
|
|
793
|
+
const message = `typescript v${typeScriptVersion} installed in the project`;
|
|
794
|
+
this.resultsObject.push({
|
|
795
|
+
check: 'typescript',
|
|
796
|
+
passed: false,
|
|
797
|
+
message: message,
|
|
798
|
+
fix: fix
|
|
799
|
+
});
|
|
800
|
+
await this.logMessage(formatting.getStatus(CheckStatus.Failure, message));
|
|
701
801
|
}
|
|
702
802
|
else {
|
|
703
|
-
|
|
803
|
+
const message = 'bundled typescript used';
|
|
804
|
+
this.resultsObject.push({
|
|
805
|
+
check: 'typescript',
|
|
806
|
+
passed: true,
|
|
807
|
+
message: message
|
|
808
|
+
});
|
|
809
|
+
await this.logMessage(formatting.getStatus(CheckStatus.Success, message));
|
|
704
810
|
}
|
|
705
811
|
}
|
|
706
812
|
spVersionStringToEnum(sp) {
|
|
707
813
|
return SharePointVersion[sp.toUpperCase()];
|
|
708
814
|
}
|
|
709
|
-
async getSPFxVersionFromYoRcFile(
|
|
815
|
+
async getSPFxVersionFromYoRcFile() {
|
|
710
816
|
if (this.projectRootPath !== null) {
|
|
711
817
|
const spfxVersion = this.getProjectVersion();
|
|
712
818
|
if (spfxVersion) {
|
|
713
819
|
if (this.debug) {
|
|
714
|
-
await logger.logToStderr(`SPFx version retrieved from .yo-rc.json file. Retrieved version: ${spfxVersion}`);
|
|
820
|
+
await this.logger.logToStderr(`SPFx version retrieved from .yo-rc.json file. Retrieved version: ${spfxVersion}`);
|
|
715
821
|
}
|
|
716
822
|
return spfxVersion;
|
|
717
823
|
}
|
|
718
824
|
}
|
|
719
825
|
return undefined;
|
|
720
826
|
}
|
|
721
|
-
async getSharePointFrameworkVersion(
|
|
722
|
-
let spfxVersion = await this.getSPFxVersionFromYoRcFile(
|
|
827
|
+
async getSharePointFrameworkVersion() {
|
|
828
|
+
let spfxVersion = await this.getSPFxVersionFromYoRcFile();
|
|
723
829
|
if (spfxVersion) {
|
|
724
830
|
return spfxVersion;
|
|
725
831
|
}
|
|
726
832
|
try {
|
|
727
|
-
spfxVersion = await this.getPackageVersion('@microsoft/sp-core-library', PackageSearchMode.LocalOnly, HandlePromise.Fail
|
|
833
|
+
spfxVersion = await this.getPackageVersion('@microsoft/sp-core-library', PackageSearchMode.LocalOnly, HandlePromise.Fail);
|
|
728
834
|
if (this.debug) {
|
|
729
|
-
await logger.logToStderr(`Found @microsoft/sp-core-library@${spfxVersion}`);
|
|
835
|
+
await this.logger.logToStderr(`Found @microsoft/sp-core-library@${spfxVersion}`);
|
|
730
836
|
}
|
|
731
837
|
return spfxVersion;
|
|
732
838
|
}
|
|
733
839
|
catch {
|
|
734
840
|
if (this.debug) {
|
|
735
|
-
await logger.logToStderr(`@microsoft/sp-core-library not found. Search for @microsoft/generator-sharepoint local or global...`);
|
|
841
|
+
await this.logger.logToStderr(`@microsoft/sp-core-library not found. Search for @microsoft/generator-sharepoint local or global...`);
|
|
736
842
|
}
|
|
737
843
|
try {
|
|
738
|
-
return await this.getPackageVersion('@microsoft/generator-sharepoint', PackageSearchMode.LocalAndGlobal, HandlePromise.Fail
|
|
844
|
+
return await this.getPackageVersion('@microsoft/generator-sharepoint', PackageSearchMode.LocalAndGlobal, HandlePromise.Fail);
|
|
739
845
|
}
|
|
740
846
|
catch (error) {
|
|
741
847
|
if (this.debug) {
|
|
742
|
-
await logger.logToStderr('@microsoft/generator-sharepoint not found');
|
|
848
|
+
await this.logger.logToStderr('@microsoft/generator-sharepoint not found');
|
|
743
849
|
}
|
|
744
850
|
if (error && error.indexOf('ENOENT') > -1) {
|
|
745
851
|
throw 'npm not found';
|
|
@@ -750,19 +856,19 @@ class SpfxDoctorCommand extends BaseProjectCommand {
|
|
|
750
856
|
}
|
|
751
857
|
}
|
|
752
858
|
}
|
|
753
|
-
async getPackageVersion(packageName, searchMode, handlePromise
|
|
859
|
+
async getPackageVersion(packageName, searchMode, handlePromise) {
|
|
754
860
|
const args = ['ls', packageName, '--depth=0', '--json'];
|
|
755
861
|
if (searchMode === PackageSearchMode.GlobalOnly) {
|
|
756
862
|
args.push('-g');
|
|
757
863
|
}
|
|
758
864
|
let version;
|
|
759
865
|
try {
|
|
760
|
-
version = await this.getPackageVersionFromNpm(args
|
|
866
|
+
version = await this.getPackageVersionFromNpm(args);
|
|
761
867
|
}
|
|
762
868
|
catch {
|
|
763
869
|
if (searchMode === PackageSearchMode.LocalAndGlobal) {
|
|
764
870
|
args.push('-g');
|
|
765
|
-
version = await this.getPackageVersionFromNpm(args
|
|
871
|
+
version = await this.getPackageVersionFromNpm(args);
|
|
766
872
|
}
|
|
767
873
|
else {
|
|
768
874
|
version = '';
|
|
@@ -780,11 +886,11 @@ class SpfxDoctorCommand extends BaseProjectCommand {
|
|
|
780
886
|
}
|
|
781
887
|
}
|
|
782
888
|
}
|
|
783
|
-
getPackageVersionFromNpm(args
|
|
889
|
+
getPackageVersionFromNpm(args) {
|
|
784
890
|
return new Promise(async (resolve, reject) => {
|
|
785
891
|
const packageName = args[1];
|
|
786
892
|
if (this.debug) {
|
|
787
|
-
await logger.logToStderr(`Executing npm: ${args.join(' ')}...`);
|
|
893
|
+
await this.logger.logToStderr(`Executing npm: ${args.join(' ')}...`);
|
|
788
894
|
}
|
|
789
895
|
child_process.exec(`npm ${args.join(' ')}`, (err, stdout) => {
|
|
790
896
|
if (err) {
|
|
@@ -810,14 +916,28 @@ class SpfxDoctorCommand extends BaseProjectCommand {
|
|
|
810
916
|
getNodeVersion() {
|
|
811
917
|
return process.version.substr(1);
|
|
812
918
|
}
|
|
813
|
-
async checkStatus(what, versionFound, versionCheck
|
|
919
|
+
async checkStatus(what, versionFound, versionCheck) {
|
|
814
920
|
if (versionFound) {
|
|
815
921
|
if (satisfies(versionFound, versionCheck.range)) {
|
|
816
|
-
|
|
922
|
+
const message = `${what} v${versionFound}`;
|
|
923
|
+
this.resultsObject.push({
|
|
924
|
+
check: what,
|
|
925
|
+
passed: true,
|
|
926
|
+
message: message,
|
|
927
|
+
version: versionFound
|
|
928
|
+
});
|
|
929
|
+
await this.logMessage(formatting.getStatus(CheckStatus.Success, message));
|
|
817
930
|
}
|
|
818
931
|
else {
|
|
819
|
-
|
|
820
|
-
|
|
932
|
+
const message = `${what} v${versionFound} found, v${versionCheck.range} required`;
|
|
933
|
+
this.resultsObject.push({
|
|
934
|
+
check: what,
|
|
935
|
+
passed: false,
|
|
936
|
+
version: versionFound,
|
|
937
|
+
message: message,
|
|
938
|
+
fix: versionCheck.fix
|
|
939
|
+
});
|
|
940
|
+
await this.logMessage(formatting.getStatus(CheckStatus.Failure, message));
|
|
821
941
|
}
|
|
822
942
|
}
|
|
823
943
|
}
|