@pnp/cli-microsoft365 6.5.0-beta.33bab12 → 6.5.0-beta.dd9fb80
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/cli/Cli.js +13 -9
- package/dist/m365/cli/commands/config/config-set.js +1 -0
- package/dist/m365/spo/commands/file/file-move.js +1 -1
- package/dist/m365/spo/commands/web/web-set.js +33 -13
- package/dist/settingsNames.js +2 -1
- package/docs/docs/_clisettings.md +1 -0
- package/package.json +1 -1
package/dist/cli/Cli.js
CHANGED
|
@@ -158,9 +158,10 @@ class Cli {
|
|
|
158
158
|
const cli = Cli.getInstance();
|
|
159
159
|
const parentCommandName = cli.currentCommandName;
|
|
160
160
|
cli.currentCommandName = command.getCommandName(cli.currentCommandName);
|
|
161
|
+
const showSpinner = cli.getSettingWithDefaultValue(settingsNames_1.settingsNames.showSpinner, true);
|
|
161
162
|
// don't show spinner if running tests
|
|
162
163
|
/* c8 ignore next 3 */
|
|
163
|
-
if (typeof global.it === 'undefined') {
|
|
164
|
+
if (showSpinner && typeof global.it === 'undefined') {
|
|
164
165
|
cli.spinner.start();
|
|
165
166
|
}
|
|
166
167
|
try {
|
|
@@ -756,9 +757,10 @@ class Cli {
|
|
|
756
757
|
/* c8 ignore next */
|
|
757
758
|
}
|
|
758
759
|
static log(message, ...optionalParams) {
|
|
760
|
+
const cli = Cli.getInstance();
|
|
759
761
|
/* c8 ignore next 3 */
|
|
760
|
-
if (
|
|
761
|
-
|
|
762
|
+
if (cli.spinner.isSpinning) {
|
|
763
|
+
cli.spinner.stop();
|
|
762
764
|
}
|
|
763
765
|
if (message) {
|
|
764
766
|
console.log(message, ...optionalParams);
|
|
@@ -768,11 +770,12 @@ class Cli {
|
|
|
768
770
|
}
|
|
769
771
|
}
|
|
770
772
|
static error(message, ...optionalParams) {
|
|
773
|
+
const cli = Cli.getInstance();
|
|
771
774
|
/* c8 ignore next 3 */
|
|
772
|
-
if (
|
|
773
|
-
|
|
775
|
+
if (cli.spinner.isSpinning) {
|
|
776
|
+
cli.spinner.stop();
|
|
774
777
|
}
|
|
775
|
-
const errorOutput =
|
|
778
|
+
const errorOutput = cli.getSettingWithDefaultValue(settingsNames_1.settingsNames.errorOutput, 'stderr');
|
|
776
779
|
if (errorOutput === 'stdout') {
|
|
777
780
|
console.log(message, ...optionalParams);
|
|
778
781
|
}
|
|
@@ -783,16 +786,17 @@ class Cli {
|
|
|
783
786
|
static prompt(options) {
|
|
784
787
|
return __awaiter(this, void 0, void 0, function* () {
|
|
785
788
|
const inquirer = require('inquirer');
|
|
786
|
-
const
|
|
789
|
+
const cli = Cli.getInstance();
|
|
790
|
+
const spinnerSpinning = cli.spinner.isSpinning;
|
|
787
791
|
/* c8 ignore next 3 */
|
|
788
792
|
if (spinnerSpinning) {
|
|
789
|
-
|
|
793
|
+
cli.spinner.stop();
|
|
790
794
|
}
|
|
791
795
|
const response = yield inquirer.prompt(options);
|
|
792
796
|
// Restart the spinner if it was running before the prompt
|
|
793
797
|
/* c8 ignore next 3 */
|
|
794
798
|
if (spinnerSpinning) {
|
|
795
|
-
|
|
799
|
+
cli.spinner.start();
|
|
796
800
|
}
|
|
797
801
|
return response;
|
|
798
802
|
});
|
|
@@ -46,6 +46,7 @@ class CliConfigSetCommand extends AnonymousCommand_1.default {
|
|
|
46
46
|
case settingsNames_1.settingsNames.printErrorsAsPlainText:
|
|
47
47
|
case settingsNames_1.settingsNames.prompt:
|
|
48
48
|
case settingsNames_1.settingsNames.showHelpOnFailure:
|
|
49
|
+
case settingsNames_1.settingsNames.showSpinner:
|
|
49
50
|
value = args.options.value === 'true';
|
|
50
51
|
break;
|
|
51
52
|
default:
|
|
@@ -147,7 +147,7 @@ class SpoFileMoveCommand extends SpoCommand_1.default {
|
|
|
147
147
|
yield Cli_1.Cli.executeCommand(removeCommand, { options: Object.assign(Object.assign({}, removeOptions), { _: [] }) });
|
|
148
148
|
}
|
|
149
149
|
catch (err) {
|
|
150
|
-
if (err
|
|
150
|
+
if (err !== undefined && err.message !== undefined && err.message.includes('does not exist')) {
|
|
151
151
|
}
|
|
152
152
|
else {
|
|
153
153
|
throw err;
|
|
@@ -69,20 +69,37 @@ class SpoWebSetCommand extends SpoCommand_1.default {
|
|
|
69
69
|
const searchScope = args.options.searchScope.toLowerCase();
|
|
70
70
|
payload.SearchScope = SpoWebSetCommand.searchScopeOptions.indexOf(searchScope);
|
|
71
71
|
}
|
|
72
|
-
const requestOptions = {
|
|
73
|
-
url: `${args.options.url}/_api/web`,
|
|
74
|
-
headers: {
|
|
75
|
-
'content-type': 'application/json;odata=nometadata',
|
|
76
|
-
accept: 'application/json;odata=nometadata'
|
|
77
|
-
},
|
|
78
|
-
responseType: 'json',
|
|
79
|
-
data: payload
|
|
80
|
-
};
|
|
81
|
-
if (this.verbose) {
|
|
82
|
-
logger.logToStderr(`Updating properties of subsite ${args.options.url}...`);
|
|
83
|
-
}
|
|
84
72
|
try {
|
|
73
|
+
const requestOptions = {
|
|
74
|
+
url: `${args.options.url}/_api/web`,
|
|
75
|
+
headers: {
|
|
76
|
+
'content-type': 'application/json;odata=nometadata',
|
|
77
|
+
accept: 'application/json;odata=nometadata'
|
|
78
|
+
},
|
|
79
|
+
responseType: 'json',
|
|
80
|
+
data: payload
|
|
81
|
+
};
|
|
82
|
+
if (this.verbose) {
|
|
83
|
+
logger.logToStderr(`Updating properties of subsite ${args.options.url}...`);
|
|
84
|
+
}
|
|
85
85
|
yield request_1.default.patch(requestOptions);
|
|
86
|
+
if (typeof args.options.welcomePage !== 'undefined') {
|
|
87
|
+
if (this.verbose) {
|
|
88
|
+
logger.logToStderr(`Setting welcome page to: ${args.options.welcomePage}...`);
|
|
89
|
+
}
|
|
90
|
+
const requestOptions = {
|
|
91
|
+
url: `${args.options.url}/_api/web/RootFolder`,
|
|
92
|
+
headers: {
|
|
93
|
+
'content-type': 'application/json;odata=nometadata',
|
|
94
|
+
accept: 'application/json;odata=nometadata'
|
|
95
|
+
},
|
|
96
|
+
responseType: 'json',
|
|
97
|
+
data: {
|
|
98
|
+
WelcomePage: args.options.welcomePage
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
yield request_1.default.patch(requestOptions);
|
|
102
|
+
}
|
|
86
103
|
}
|
|
87
104
|
catch (err) {
|
|
88
105
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -105,7 +122,8 @@ _SpoWebSetCommand_instances = new WeakSet(), _SpoWebSetCommand_initTelemetry = f
|
|
|
105
122
|
quickLaunchEnabled: typeof args.options.quickLaunchEnabled !== 'undefined',
|
|
106
123
|
footerEnabled: typeof args.options.footerEnabled !== 'undefined',
|
|
107
124
|
navAudienceTargetingEnabled: typeof args.options.navAudienceTargetingEnabled !== 'undefined',
|
|
108
|
-
searchScope: args.options.searchScope !== 'undefined'
|
|
125
|
+
searchScope: typeof args.options.searchScope !== 'undefined',
|
|
126
|
+
welcomePage: typeof args.options.welcomePage !== 'undefined'
|
|
109
127
|
});
|
|
110
128
|
this.trackUnknownOptions(this.telemetryProperties, args.options);
|
|
111
129
|
});
|
|
@@ -139,6 +157,8 @@ _SpoWebSetCommand_instances = new WeakSet(), _SpoWebSetCommand_initTelemetry = f
|
|
|
139
157
|
}, {
|
|
140
158
|
option: '--searchScope [searchScope]',
|
|
141
159
|
autocomplete: SpoWebSetCommand.searchScopeOptions
|
|
160
|
+
}, {
|
|
161
|
+
option: '--welcomePage [welcomePage]'
|
|
142
162
|
});
|
|
143
163
|
}, _SpoWebSetCommand_initTypes = function _SpoWebSetCommand_initTypes() {
|
|
144
164
|
this.types.boolean.push('megaMenuEnabled', 'footerEnabled', 'quickLaunchEnabled', 'navAudienceTargetingEnabled');
|
package/dist/settingsNames.js
CHANGED
|
@@ -15,7 +15,8 @@ const settingsNames = {
|
|
|
15
15
|
output: 'output',
|
|
16
16
|
printErrorsAsPlainText: 'printErrorsAsPlainText',
|
|
17
17
|
prompt: 'prompt',
|
|
18
|
-
showHelpOnFailure: 'showHelpOnFailure'
|
|
18
|
+
showHelpOnFailure: 'showHelpOnFailure',
|
|
19
|
+
showSpinner: 'showSpinner'
|
|
19
20
|
};
|
|
20
21
|
exports.settingsNames = settingsNames;
|
|
21
22
|
//# sourceMappingURL=settingsNames.js.map
|
|
@@ -18,3 +18,4 @@ Setting name|Definition|Default value
|
|
|
18
18
|
`printErrorsAsPlainText`|When output mode is set to `json`, print error messages as plain-text rather than JSON|`true`
|
|
19
19
|
`prompt`|Prompts for missing values in required options|`false`
|
|
20
20
|
`showHelpOnFailure`|Automatically display help when executing a command failed|`true`
|
|
21
|
+
`showSpinner`|Display spinner when executing commands|`true`
|
package/package.json
CHANGED