@pnp/cli-microsoft365 12.1.0-beta.79db3d9 → 12.1.0-beta.81e442d
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/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/cli/cli.js +12 -7
- package/dist/m365/entra/commands/app/app-add.js +106 -150
- package/dist/m365/entra/commands/app/app-get.js +22 -38
- package/dist/m365/entra/commands/app/app-list.js +10 -22
- package/dist/m365/entra/commands/app/app-permission-add.js +36 -50
- package/dist/m365/entra/commands/app/app-permission-list.js +29 -48
- package/dist/m365/entra/commands/app/app-permission-remove.js +44 -82
- package/dist/m365/entra/commands/app/app-remove.js +21 -38
- package/dist/m365/entra/commands/app/app-role-add.js +32 -46
- package/dist/m365/entra/commands/app/app-role-list.js +20 -25
- package/dist/m365/entra/commands/app/app-role-remove.js +33 -41
- package/dist/m365/entra/commands/app/app-set.js +46 -69
- package/dist/m365/spfx/commands/package/package-generate.js +30 -51
- package/dist/m365/spfx/commands/project/project-azuredevops-pipeline-add.js +27 -62
- package/dist/m365/spfx/commands/project/project-doctor.js +20 -51
- package/dist/m365/spfx/commands/project/project-externalize.js +16 -26
- package/dist/m365/spfx/commands/project/project-github-workflow-add.js +28 -65
- package/dist/m365/spfx/commands/project/project-permissions-grant.js +4 -2
- package/dist/m365/spfx/commands/project/project-rename.js +17 -29
- package/dist/m365/spfx/commands/project/project-upgrade.js +0 -3
- package/dist/m365/spfx/commands/spfx-doctor.js +23 -47
- package/dist/m365/spo/commands/file/file-add.js +51 -77
- package/dist/m365/spo/commands/file/file-archive.js +1 -1
- package/dist/m365/spo/commands/file/file-checkin.js +35 -64
- package/dist/m365/spo/commands/file/file-checkout-undo.js +25 -49
- package/dist/m365/spo/commands/file/file-checkout.js +24 -47
- package/dist/m365/spo/commands/file/file-copy.js +37 -68
- package/dist/m365/spo/commands/file/file-get.js +44 -79
- package/dist/m365/spo/commands/file/file-list.js +16 -39
- package/dist/m365/spo/commands/file/file-move.js +30 -68
- package/dist/m365/spo/commands/file/file-remove.js +27 -56
- package/dist/m365/spo/commands/file/file-rename.js +15 -36
- package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +26 -51
- package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +25 -50
- package/dist/m365/spo/commands/file/file-roleassignment-add.js +47 -75
- package/dist/m365/spo/commands/file/file-roleassignment-remove.js +39 -70
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +26 -52
- package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +25 -49
- package/dist/m365/spo/commands/file/file-sharinginfo-get.js +24 -47
- package/dist/m365/spo/commands/file/file-sharinglink-add.js +46 -70
- package/dist/m365/spo/commands/file/file-sharinglink-clear.js +33 -57
- package/dist/m365/spo/commands/file/file-sharinglink-get.js +25 -47
- package/dist/m365/spo/commands/file/file-sharinglink-list.js +32 -53
- package/dist/m365/spo/commands/file/file-sharinglink-remove.js +26 -51
- package/dist/m365/spo/commands/file/file-sharinglink-set.js +29 -55
- package/dist/m365/spo/commands/file/file-unarchive.js +1 -1
- package/dist/m365/spo/commands/file/file-version-clear.js +25 -45
- package/dist/m365/spo/commands/file/file-version-get.js +25 -43
- package/dist/m365/spo/commands/file/file-version-keep.js +1 -1
- package/dist/m365/spo/commands/file/file-version-list.js +24 -41
- package/dist/m365/spo/commands/file/file-version-remove.js +26 -47
- package/dist/m365/spo/commands/file/file-version-restore.js +26 -47
- package/dist/m365/spo/commands/folder/folder-add.js +19 -48
- package/dist/m365/spo/commands/folder/folder-copy.js +36 -62
- package/dist/m365/spo/commands/folder/folder-get.js +30 -51
- package/dist/m365/spo/commands/folder/folder-list.js +16 -39
- package/dist/m365/spo/commands/folder/folder-move.js +36 -62
- package/dist/m365/spo/commands/folder/folder-remove.js +15 -36
- package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +30 -48
- package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +30 -50
- package/dist/m365/spo/commands/folder/folder-roleassignment-add.js +49 -79
- package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +37 -67
- package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +15 -36
- package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +14 -33
- package/dist/m365/spo/commands/folder/folder-set.js +28 -48
- package/dist/m365/spo/commands/folder/folder-sharinglink-add.js +58 -86
- package/dist/m365/spo/commands/folder/folder-sharinglink-clear.js +33 -50
- package/dist/m365/spo/commands/folder/folder-sharinglink-get.js +33 -42
- package/dist/m365/spo/commands/folder/folder-sharinglink-list.js +32 -47
- package/dist/m365/spo/commands/folder/folder-sharinglink-remove.js +34 -41
- package/dist/m365/spo/commands/folder/folder-sharinglink-set.js +38 -43
- package/dist/m365/spo/commands/page/page-add.js +31 -68
- package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +74 -101
- package/dist/m365/spo/commands/page/page-column-get.js +15 -32
- package/dist/m365/spo/commands/page/page-column-list.js +14 -27
- package/dist/m365/spo/commands/page/page-control-get.js +18 -27
- package/dist/m365/spo/commands/page/page-control-list.js +13 -20
- package/dist/m365/spo/commands/page/page-control-remove.js +1 -1
- package/dist/m365/spo/commands/page/page-control-set.js +51 -61
- package/dist/m365/spo/commands/page/page-copy.js +15 -31
- package/dist/m365/spo/commands/page/page-header-set.js +25 -89
- package/dist/m365/spo/commands/page/page-list.js +12 -18
- package/dist/m365/spo/commands/page/page-remove.js +16 -39
- package/dist/m365/spo/commands/page/page-section-add.js +108 -173
- package/dist/m365/spo/commands/page/page-section-get.js +17 -27
- package/dist/m365/spo/commands/page/page-section-list.js +13 -20
- package/dist/m365/spo/commands/page/page-section-remove.js +4 -1
- package/dist/m365/spo/commands/page/page-set.js +50 -100
- package/dist/m365/spo/commands/page/page-template-list.js +12 -18
- package/dist/m365/spo/commands/page/page-text-add.js +23 -45
- package/dist/m365/viva/commands/connections/connections-app-create.js +36 -42
- package/dist/m365/viva/commands/engage/engage-community-add.js +75 -71
- package/dist/m365/viva/commands/engage/engage-community-get.js +8 -16
- package/dist/m365/viva/commands/engage/engage-community-list.js +5 -0
- package/dist/m365/viva/commands/engage/engage-community-remove.js +28 -48
- package/dist/m365/viva/commands/engage/engage-community-set.js +43 -66
- package/dist/m365/viva/commands/engage/engage-community-user-add.js +7 -12
- package/dist/m365/viva/commands/engage/engage-community-user-list.js +1 -1
- package/dist/m365/viva/commands/engage/engage-community-user-remove.js +4 -2
- package/dist/m365/viva/commands/engage/engage-message-add.js +22 -52
- package/dist/m365/viva/commands/engage/engage-message-get.js +8 -23
- package/dist/m365/viva/commands/engage/engage-message-like-set.js +10 -39
- package/dist/m365/viva/commands/engage/engage-message-list.js +22 -66
- package/dist/m365/viva/commands/engage/engage-message-remove.js +9 -32
- package/dist/m365/viva/commands/engage/engage-network-list.js +8 -22
- package/dist/m365/viva/commands/engage/engage-report-activitycounts.js +2 -1
- package/dist/m365/viva/commands/engage/engage-report-activityusercounts.js +2 -1
- package/dist/m365/viva/commands/engage/engage-report-activityuserdetail.js +2 -1
- package/dist/m365/viva/commands/engage/engage-report-deviceusagedistributionusercounts.js +2 -1
- package/dist/m365/viva/commands/engage/engage-report-deviceusageusercounts.js +2 -1
- package/dist/m365/viva/commands/engage/engage-report-deviceusageuserdetail.js +2 -1
- package/dist/m365/viva/commands/engage/engage-report-groupsactivitycounts.js +2 -1
- package/dist/m365/viva/commands/engage/engage-report-groupsactivitydetail.js +2 -1
- package/dist/m365/viva/commands/engage/engage-report-groupsactivitygroupcounts.js +2 -1
- package/dist/m365/viva/commands/engage/engage-role-list.js +5 -0
- package/dist/m365/viva/commands/engage/engage-role-member-add.js +3 -5
- package/dist/m365/viva/commands/engage/engage-role-member-list.js +1 -1
- package/dist/m365/viva/commands/engage/engage-role-member-remove.js +4 -2
- package/dist/m365/viva/commands/engage/engage-search.js +16 -65
- package/dist/m365/viva/commands/engage/engage-user-get.js +15 -33
- package/dist/m365/viva/commands/engage/engage-user-list.js +22 -57
- package/docs/docs/cmd/spo/listitem/listitem-record-declare.mdx +19 -0
- package/docs/docs/cmd/spo/listitem/listitem-record-lock.mdx +21 -0
- package/docs/docs/cmd/spo/listitem/listitem-record-undeclare.mdx +21 -0
- package/docs/docs/cmd/spo/listitem/listitem-record-unlock.mdx +21 -0
- package/docs/docs/cmd/spo/page/page-text-add.mdx +1 -1
- package/docs/docs/cmd/viva/engage/engage-community-add.mdx +19 -0
- package/docs/docs/cmd/viva/engage/engage-community-get.mdx +19 -0
- package/docs/docs/cmd/viva/engage/engage-community-remove.mdx +21 -0
- package/docs/docs/cmd/viva/engage/engage-community-set.mdx +19 -0
- package/npm-shrinkwrap.json +55 -55
- package/package.json +1 -1
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _EntraAppSetCommand_instances, _a, _EntraAppSetCommand_initTelemetry, _EntraAppSetCommand_initOptions, _EntraAppSetCommand_initValidators, _EntraAppSetCommand_initOptionSets, _EntraAppSetCommand_initTypes;
|
|
7
1
|
import fs from 'fs';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
8
4
|
import request from '../../../../request.js';
|
|
5
|
+
import { entraApp } from '../../../../utils/entraApp.js';
|
|
6
|
+
import { optionsUtils } from '../../../../utils/optionsUtils.js';
|
|
7
|
+
import { zod } from '../../../../utils/zod.js';
|
|
9
8
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
10
9
|
import commands from '../../commands.js';
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const aadApplicationPlatform = ['spa', 'web', 'publicClient'];
|
|
11
|
+
export const options = z.looseObject({
|
|
12
|
+
...globalOptionsZod.shape,
|
|
13
|
+
appId: z.guid().optional(),
|
|
14
|
+
objectId: z.guid().optional(),
|
|
15
|
+
name: z.string().optional().alias('n'),
|
|
16
|
+
uris: z.string().optional().alias('u'),
|
|
17
|
+
redirectUris: z.string().optional().alias('r'),
|
|
18
|
+
certificateFile: z.string().optional(),
|
|
19
|
+
certificateBase64Encoded: z.string().optional(),
|
|
20
|
+
certificateDisplayName: z.string().optional(),
|
|
21
|
+
platform: z.enum(aadApplicationPlatform).optional(),
|
|
22
|
+
redirectUrisToRemove: z.string().optional(),
|
|
23
|
+
allowPublicClientFlows: z.boolean().optional()
|
|
24
|
+
});
|
|
13
25
|
class EntraAppSetCommand extends GraphCommand {
|
|
14
26
|
get name() {
|
|
15
27
|
return commands.APP_SET;
|
|
@@ -20,14 +32,30 @@ class EntraAppSetCommand extends GraphCommand {
|
|
|
20
32
|
allowUnknownOptions() {
|
|
21
33
|
return true;
|
|
22
34
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
get schema() {
|
|
36
|
+
return options;
|
|
37
|
+
}
|
|
38
|
+
getRefinedSchema(schema) {
|
|
39
|
+
return schema
|
|
40
|
+
.refine(options => [options.appId, options.objectId, options.name].filter(o => o !== undefined).length === 1, {
|
|
41
|
+
error: 'Specify either appId, objectId, or name',
|
|
42
|
+
params: {
|
|
43
|
+
customCode: 'optionSet',
|
|
44
|
+
options: ['appId', 'objectId', 'name']
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
.refine(options => !options.redirectUris || !!options.platform, {
|
|
48
|
+
error: 'When you specify redirectUris you also need to specify platform'
|
|
49
|
+
})
|
|
50
|
+
.refine(options => !(options.certificateFile && options.certificateBase64Encoded), {
|
|
51
|
+
error: 'Specify either certificateFile or certificateBase64Encoded but not both'
|
|
52
|
+
})
|
|
53
|
+
.refine(options => !options.certificateDisplayName || !!options.certificateFile || !!options.certificateBase64Encoded, {
|
|
54
|
+
error: 'When you specify certificateDisplayName you also need to specify certificateFile or certificateBase64Encoded'
|
|
55
|
+
})
|
|
56
|
+
.refine(options => !options.certificateFile || fs.existsSync(options.certificateFile), {
|
|
57
|
+
error: 'Certificate file not found'
|
|
58
|
+
});
|
|
31
59
|
}
|
|
32
60
|
async commandAction(logger, args) {
|
|
33
61
|
try {
|
|
@@ -55,12 +83,12 @@ class EntraAppSetCommand extends GraphCommand {
|
|
|
55
83
|
return app.id;
|
|
56
84
|
}
|
|
57
85
|
else {
|
|
58
|
-
const app = await entraApp.getAppRegistrationByAppName(name, [
|
|
86
|
+
const app = await entraApp.getAppRegistrationByAppName(name, ['id']);
|
|
59
87
|
return app.id;
|
|
60
88
|
}
|
|
61
89
|
}
|
|
62
90
|
async updateUnknownOptions(args, objectId) {
|
|
63
|
-
const unknownOptions = optionsUtils.getUnknownOptions(args.options, this.
|
|
91
|
+
const unknownOptions = optionsUtils.getUnknownOptions(args.options, zod.schemaToOptions(this.schema));
|
|
64
92
|
if (Object.keys(unknownOptions).length > 0) {
|
|
65
93
|
const requestBody = {};
|
|
66
94
|
optionsUtils.addUnknownOptionsToPayload(requestBody, unknownOptions);
|
|
@@ -263,56 +291,5 @@ class EntraAppSetCommand extends GraphCommand {
|
|
|
263
291
|
return request.patch(requestOptions);
|
|
264
292
|
}
|
|
265
293
|
}
|
|
266
|
-
_a = EntraAppSetCommand, _EntraAppSetCommand_instances = new WeakSet(), _EntraAppSetCommand_initTelemetry = function _EntraAppSetCommand_initTelemetry() {
|
|
267
|
-
this.telemetry.push((args) => {
|
|
268
|
-
Object.assign(this.telemetryProperties, {
|
|
269
|
-
appId: typeof args.options.appId !== 'undefined',
|
|
270
|
-
objectId: typeof args.options.objectId !== 'undefined',
|
|
271
|
-
name: typeof args.options.name !== 'undefined',
|
|
272
|
-
platform: typeof args.options.platform !== 'undefined',
|
|
273
|
-
redirectUris: typeof args.options.redirectUris !== 'undefined',
|
|
274
|
-
redirectUrisToRemove: typeof args.options.redirectUrisToRemove !== 'undefined',
|
|
275
|
-
uris: typeof args.options.uris !== 'undefined',
|
|
276
|
-
certificateFile: typeof args.options.certificateFile !== 'undefined',
|
|
277
|
-
certificateBase64Encoded: typeof args.options.certificateBase64Encoded !== 'undefined',
|
|
278
|
-
certificateDisplayName: typeof args.options.certificateDisplayName !== 'undefined',
|
|
279
|
-
allowPublicClientFlows: typeof args.options.allowPublicClientFlows !== 'undefined'
|
|
280
|
-
});
|
|
281
|
-
this.trackUnknownOptions(this.telemetryProperties, args.options);
|
|
282
|
-
});
|
|
283
|
-
}, _EntraAppSetCommand_initOptions = function _EntraAppSetCommand_initOptions() {
|
|
284
|
-
this.options.unshift({ option: '--appId [appId]' }, { option: '--objectId [objectId]' }, { option: '-n, --name [name]' }, { option: '-u, --uris [uris]' }, { option: '-r, --redirectUris [redirectUris]' }, { option: '--certificateFile [certificateFile]' }, { option: '--certificateBase64Encoded [certificateBase64Encoded]' }, { option: '--certificateDisplayName [certificateDisplayName]' }, {
|
|
285
|
-
option: '--platform [platform]',
|
|
286
|
-
autocomplete: _a.aadApplicationPlatform
|
|
287
|
-
}, { option: '--redirectUrisToRemove [redirectUrisToRemove]' }, {
|
|
288
|
-
option: '--allowPublicClientFlows [allowPublicClientFlows]',
|
|
289
|
-
autocomplete: ['true', 'false']
|
|
290
|
-
});
|
|
291
|
-
}, _EntraAppSetCommand_initValidators = function _EntraAppSetCommand_initValidators() {
|
|
292
|
-
this.validators.push(async (args) => {
|
|
293
|
-
if (args.options.certificateFile && args.options.certificateBase64Encoded) {
|
|
294
|
-
return 'Specify either certificateFile or certificateBase64Encoded but not both';
|
|
295
|
-
}
|
|
296
|
-
if (args.options.certificateDisplayName && !args.options.certificateFile && !args.options.certificateBase64Encoded) {
|
|
297
|
-
return 'When you specify certificateDisplayName you also need to specify certificateFile or certificateBase64Encoded';
|
|
298
|
-
}
|
|
299
|
-
if (args.options.certificateFile && !fs.existsSync(args.options.certificateFile)) {
|
|
300
|
-
return 'Certificate file not found';
|
|
301
|
-
}
|
|
302
|
-
if (args.options.redirectUris && !args.options.platform) {
|
|
303
|
-
return `When you specify redirectUris you also need to specify platform`;
|
|
304
|
-
}
|
|
305
|
-
if (args.options.platform &&
|
|
306
|
-
_a.aadApplicationPlatform.indexOf(args.options.platform) < 0) {
|
|
307
|
-
return `${args.options.platform} is not a valid value for platform. Allowed values are ${_a.aadApplicationPlatform.join(', ')}`;
|
|
308
|
-
}
|
|
309
|
-
return true;
|
|
310
|
-
});
|
|
311
|
-
}, _EntraAppSetCommand_initOptionSets = function _EntraAppSetCommand_initOptionSets() {
|
|
312
|
-
this.optionSets.push({ options: ['appId', 'objectId', 'name'] });
|
|
313
|
-
}, _EntraAppSetCommand_initTypes = function _EntraAppSetCommand_initTypes() {
|
|
314
|
-
this.types.boolean.push('allowPublicClientFlows');
|
|
315
|
-
};
|
|
316
|
-
EntraAppSetCommand.aadApplicationPlatform = ['spa', 'web', 'publicClient'];
|
|
317
294
|
export default new EntraAppSetCommand();
|
|
318
295
|
//# sourceMappingURL=app-set.js.map
|
|
@@ -1,19 +1,31 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _SpfxPackageGenerateCommand_instances, _a, _SpfxPackageGenerateCommand_initTelemetry, _SpfxPackageGenerateCommand_initOptions, _SpfxPackageGenerateCommand_initValidators;
|
|
7
1
|
import AdmZip from 'adm-zip';
|
|
8
2
|
import fs from 'fs';
|
|
9
3
|
import os from 'os';
|
|
10
4
|
import path from 'path';
|
|
11
5
|
import url from 'url';
|
|
12
6
|
import { v4 } from 'uuid';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
13
9
|
import { fsUtil } from '../../../../utils/fsUtil.js';
|
|
14
10
|
import AnonymousCommand from '../../../base/AnonymousCommand.js';
|
|
15
11
|
import commands from '../../commands.js';
|
|
16
12
|
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
|
13
|
+
export const options = z.strictObject({
|
|
14
|
+
...globalOptionsZod.shape,
|
|
15
|
+
webPartTitle: z.string().alias('t'),
|
|
16
|
+
webPartDescription: z.string().alias('d'),
|
|
17
|
+
name: z.string().alias('n'),
|
|
18
|
+
html: z.string(),
|
|
19
|
+
enableForTeams: z.enum(['tab', 'personalApp', 'all']).optional(),
|
|
20
|
+
exposePageContextGlobally: z.boolean().optional(),
|
|
21
|
+
exposeTeamsContextGlobally: z.boolean().optional(),
|
|
22
|
+
allowTenantWideDeployment: z.boolean().optional(),
|
|
23
|
+
developerName: z.string().optional(),
|
|
24
|
+
developerPrivacyUrl: z.string().optional(),
|
|
25
|
+
developerTermsOfUseUrl: z.string().optional(),
|
|
26
|
+
developerWebsiteUrl: z.string().optional(),
|
|
27
|
+
developerMpnId: z.string().optional()
|
|
28
|
+
});
|
|
17
29
|
class SpfxPackageGenerateCommand extends AnonymousCommand {
|
|
18
30
|
get name() {
|
|
19
31
|
return commands.PACKAGE_GENERATE;
|
|
@@ -21,12 +33,8 @@ class SpfxPackageGenerateCommand extends AnonymousCommand {
|
|
|
21
33
|
get description() {
|
|
22
34
|
return 'Generates SharePoint Framework solution package with a no-framework web part rendering the specified HTML snippet';
|
|
23
35
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
_SpfxPackageGenerateCommand_instances.add(this);
|
|
27
|
-
__classPrivateFieldGet(this, _SpfxPackageGenerateCommand_instances, "m", _SpfxPackageGenerateCommand_initTelemetry).call(this);
|
|
28
|
-
__classPrivateFieldGet(this, _SpfxPackageGenerateCommand_instances, "m", _SpfxPackageGenerateCommand_initOptions).call(this);
|
|
29
|
-
__classPrivateFieldGet(this, _SpfxPackageGenerateCommand_instances, "m", _SpfxPackageGenerateCommand_initValidators).call(this);
|
|
36
|
+
get schema() {
|
|
37
|
+
return options;
|
|
30
38
|
}
|
|
31
39
|
async commandAction(logger, args) {
|
|
32
40
|
const supportedHosts = ['SharePointWebPart'];
|
|
@@ -37,7 +45,7 @@ class SpfxPackageGenerateCommand extends AnonymousCommand {
|
|
|
37
45
|
supportedHosts.push('TeamsPersonalApp');
|
|
38
46
|
}
|
|
39
47
|
const tokens = {
|
|
40
|
-
clientSideAssetsFeatureId:
|
|
48
|
+
clientSideAssetsFeatureId: SpfxPackageGenerateCommand.generateNewId(),
|
|
41
49
|
developerName: args.options.developerName || 'Contoso',
|
|
42
50
|
developerWebsiteUrl: args.options.developerWebsiteUrl || 'https://contoso.com/my-app',
|
|
43
51
|
developerPrivacyUrl: args.options.developerPrivacyUrl || 'https://contoso.com/privacy',
|
|
@@ -46,18 +54,18 @@ class SpfxPackageGenerateCommand extends AnonymousCommand {
|
|
|
46
54
|
exposePageContextGlobally: args.options.exposePageContextGlobally ? '!0' : '!1',
|
|
47
55
|
exposeTeamsContextGlobally: args.options.exposeTeamsContextGlobally ? '!0' : '!1',
|
|
48
56
|
html: args.options.html.replace(/"/g, '\\"').replace(/\r\n/g, ' ').replace(/\n/g, ' '),
|
|
49
|
-
packageName:
|
|
50
|
-
productId:
|
|
57
|
+
packageName: SpfxPackageGenerateCommand.getSafePackageName(args.options.webPartTitle),
|
|
58
|
+
productId: SpfxPackageGenerateCommand.generateNewId(),
|
|
51
59
|
skipFeatureDeployment: (args.options.allowTenantWideDeployment === true).toString(),
|
|
52
60
|
supportedHosts: JSON.stringify(supportedHosts).replace(/"/g, '"'),
|
|
53
|
-
webPartId:
|
|
61
|
+
webPartId: SpfxPackageGenerateCommand.generateNewId(),
|
|
54
62
|
webPartFeatureName: `${args.options.webPartTitle} Feature`,
|
|
55
63
|
webPartFeatureDescription: `A feature which activates the Client-Side WebPart named ${args.options.webPartTitle}`,
|
|
56
|
-
webPartAlias:
|
|
64
|
+
webPartAlias: SpfxPackageGenerateCommand.getWebPartAlias(args.options.webPartTitle),
|
|
57
65
|
webPartName: args.options.webPartTitle,
|
|
58
|
-
webPartSafeName:
|
|
66
|
+
webPartSafeName: SpfxPackageGenerateCommand.getSafeWebPartName(args.options.webPartTitle),
|
|
59
67
|
webPartDescription: args.options.webPartDescription,
|
|
60
|
-
webPartModule:
|
|
68
|
+
webPartModule: SpfxPackageGenerateCommand.getSafePackageName(args.options.webPartTitle)
|
|
61
69
|
};
|
|
62
70
|
let tmpDir = undefined;
|
|
63
71
|
let error;
|
|
@@ -73,7 +81,7 @@ class SpfxPackageGenerateCommand extends AnonymousCommand {
|
|
|
73
81
|
await logger.log('Copying files...');
|
|
74
82
|
}
|
|
75
83
|
const src = path.join(__dirname, 'package-generate', 'assets');
|
|
76
|
-
fsUtil.copyRecursiveSync(src, tmpDir, s =>
|
|
84
|
+
fsUtil.copyRecursiveSync(src, tmpDir, s => SpfxPackageGenerateCommand.replaceTokens(s, tokens));
|
|
77
85
|
const files = fsUtil.readdirR(tmpDir);
|
|
78
86
|
if (this.verbose) {
|
|
79
87
|
await logger.log('Processing files...');
|
|
@@ -82,7 +90,7 @@ class SpfxPackageGenerateCommand extends AnonymousCommand {
|
|
|
82
90
|
if (this.debug) {
|
|
83
91
|
await logger.log(`Processing ${filePath}...`);
|
|
84
92
|
}
|
|
85
|
-
if (!
|
|
93
|
+
if (!SpfxPackageGenerateCommand.isBinaryFile(filePath)) {
|
|
86
94
|
if (this.verbose) {
|
|
87
95
|
await logger.log('Replacing tokens...');
|
|
88
96
|
}
|
|
@@ -91,7 +99,7 @@ class SpfxPackageGenerateCommand extends AnonymousCommand {
|
|
|
91
99
|
await logger.log('Before:');
|
|
92
100
|
await logger.log(fileContents);
|
|
93
101
|
}
|
|
94
|
-
fileContents =
|
|
102
|
+
fileContents = SpfxPackageGenerateCommand.replaceTokens(fileContents, tokens);
|
|
95
103
|
if (this.debug) {
|
|
96
104
|
await logger.log('After:');
|
|
97
105
|
await logger.log(fileContents);
|
|
@@ -172,35 +180,6 @@ class SpfxPackageGenerateCommand extends AnonymousCommand {
|
|
|
172
180
|
return 'AutoWP' + webPartName.replace(/[^a-zA-Z0-9]/g, '').substring(0, 40);
|
|
173
181
|
}
|
|
174
182
|
}
|
|
175
|
-
_a = SpfxPackageGenerateCommand, _SpfxPackageGenerateCommand_instances = new WeakSet(), _SpfxPackageGenerateCommand_initTelemetry = function _SpfxPackageGenerateCommand_initTelemetry() {
|
|
176
|
-
this.telemetry.push((args) => {
|
|
177
|
-
Object.assign(this.telemetryProperties, {
|
|
178
|
-
allowTenantWideDeployment: args.options.allowTenantWideDeployment === true,
|
|
179
|
-
developerMpnId: typeof args.options.developerMpnId !== 'undefined',
|
|
180
|
-
developerName: typeof args.options.developerName !== 'undefined',
|
|
181
|
-
developerPrivacyUrl: typeof args.options.developerPrivacyUrl !== 'undefined',
|
|
182
|
-
developerTermsOfUseUrl: typeof args.options.developerTermsOfUseUrl !== 'undefined',
|
|
183
|
-
developerWebsiteUrl: typeof args.options.developerWebsiteUrl !== 'undefined',
|
|
184
|
-
enableForTeams: args.options.enableForTeams,
|
|
185
|
-
exposePageContextGlobally: args.options.exposePageContextGlobally === true,
|
|
186
|
-
exposeTeamsContextGlobally: args.options.exposeTeamsContextGlobally === true
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
}, _SpfxPackageGenerateCommand_initOptions = function _SpfxPackageGenerateCommand_initOptions() {
|
|
190
|
-
this.options.unshift({ option: '-t, --webPartTitle <webPartTitle>' }, { option: '-d, --webPartDescription <webPartDescription>' }, { option: '-n, --name <name>' }, { option: '--html <html>' }, {
|
|
191
|
-
option: '--enableForTeams [enableForTeams]',
|
|
192
|
-
autocomplete: _a.enableForTeamsOptions
|
|
193
|
-
}, { option: '--exposePageContextGlobally' }, { option: '--exposeTeamsContextGlobally' }, { option: '--allowTenantWideDeployment' }, { option: '--developerName [developerName]' }, { option: '--developerPrivacyUrl [developerPrivacyUrl]' }, { option: '--developerTermsOfUseUrl [developerTermsOfUseUrl]' }, { option: '--developerWebsiteUrl [developerWebsiteUrl]' }, { option: '--developerMpnId [developerMpnId]' });
|
|
194
|
-
}, _SpfxPackageGenerateCommand_initValidators = function _SpfxPackageGenerateCommand_initValidators() {
|
|
195
|
-
this.validators.push(async (args) => {
|
|
196
|
-
if (args.options.enableForTeams &&
|
|
197
|
-
_a.enableForTeamsOptions.indexOf(args.options.enableForTeams) < 0) {
|
|
198
|
-
return `${args.options.enableForTeams} is not a valid value for enableForTeams. Allowed values are: ${_a.enableForTeamsOptions.join(', ')}`;
|
|
199
|
-
}
|
|
200
|
-
return true;
|
|
201
|
-
});
|
|
202
|
-
};
|
|
203
|
-
SpfxPackageGenerateCommand.enableForTeamsOptions = ['tab', 'personalApp', 'all'];
|
|
204
183
|
SpfxPackageGenerateCommand.generateNewId = () => {
|
|
205
184
|
return v4();
|
|
206
185
|
};
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _SpfxProjectAzureDevOpsPipelineAddCommand_instances, _a, _SpfxProjectAzureDevOpsPipelineAddCommand_initTelemetry, _SpfxProjectAzureDevOpsPipelineAddCommand_initOptions, _SpfxProjectAzureDevOpsPipelineAddCommand_initValidators;
|
|
7
1
|
import fs from 'fs';
|
|
8
2
|
import path from 'path';
|
|
9
3
|
import yaml from 'yaml';
|
|
10
|
-
import {
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { globalOptionsZod, CommandError } from '../../../../Command.js';
|
|
11
6
|
import commands from '../../commands.js';
|
|
12
7
|
import { BaseProjectCommand } from './base-project-command.js';
|
|
13
8
|
import { validation } from '../../../../utils/validation.js';
|
|
@@ -15,6 +10,15 @@ import { pipeline } from './DeployWorkflow.js';
|
|
|
15
10
|
import { fsUtil } from '../../../../utils/fsUtil.js';
|
|
16
11
|
import { versions } from '../SpfxCompatibilityMatrix.js';
|
|
17
12
|
import { spfx } from '../../../../utils/spfx.js';
|
|
13
|
+
export const options = z.strictObject({
|
|
14
|
+
...globalOptionsZod.shape,
|
|
15
|
+
name: z.string().alias('n').optional(),
|
|
16
|
+
branchName: z.string().alias('b').optional(),
|
|
17
|
+
loginMethod: z.enum(['application', 'user']).alias('l').optional(),
|
|
18
|
+
scope: z.enum(['tenant', 'sitecollection']).alias('s').optional(),
|
|
19
|
+
siteUrl: z.string().alias('u').optional(),
|
|
20
|
+
skipFeatureDeployment: z.boolean().optional()
|
|
21
|
+
});
|
|
18
22
|
class SpfxProjectAzureDevOpsPipelineAddCommand extends BaseProjectCommand {
|
|
19
23
|
get name() {
|
|
20
24
|
return commands.PROJECT_AZUREDEVOPS_PIPELINE_ADD;
|
|
@@ -22,17 +26,26 @@ class SpfxProjectAzureDevOpsPipelineAddCommand extends BaseProjectCommand {
|
|
|
22
26
|
get description() {
|
|
23
27
|
return 'Adds a Azure DevOps Pipeline for a SharePoint Framework project.';
|
|
24
28
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
get schema() {
|
|
30
|
+
return options;
|
|
31
|
+
}
|
|
32
|
+
getRefinedSchema(schema) {
|
|
33
|
+
return schema
|
|
34
|
+
.refine(opts => !opts.scope || opts.scope !== 'sitecollection' || opts.siteUrl, {
|
|
35
|
+
error: `siteUrl option has to be defined when scope set to sitecollection`,
|
|
36
|
+
params: {
|
|
37
|
+
customCode: 'required'
|
|
38
|
+
},
|
|
39
|
+
path: ['siteUrl']
|
|
40
|
+
})
|
|
41
|
+
.refine(opts => !opts.scope || opts.scope !== 'sitecollection' || !opts.siteUrl || validation.isValidSharePointUrl(opts.siteUrl) === true, {
|
|
42
|
+
error: issue => validation.isValidSharePointUrl(issue.input.siteUrl)
|
|
43
|
+
});
|
|
31
44
|
}
|
|
32
45
|
async commandAction(logger, args) {
|
|
33
46
|
this.projectRootPath = this.getProjectRoot(process.cwd());
|
|
34
47
|
if (this.projectRootPath === null) {
|
|
35
|
-
throw new CommandError(`Couldn't find project root folder`,
|
|
48
|
+
throw new CommandError(`Couldn't find project root folder`, SpfxProjectAzureDevOpsPipelineAddCommand.ERROR_NO_PROJECT_ROOT_FOLDER);
|
|
36
49
|
}
|
|
37
50
|
if (this.debug) {
|
|
38
51
|
await logger.logToStderr(`Adding Azure DevOps pipeline in the current SPFx project`);
|
|
@@ -152,54 +165,6 @@ class SpfxProjectAzureDevOpsPipelineAddCommand extends BaseProjectCommand {
|
|
|
152
165
|
return pipeline.stages[0].jobs[0].steps;
|
|
153
166
|
}
|
|
154
167
|
}
|
|
155
|
-
_a = SpfxProjectAzureDevOpsPipelineAddCommand, _SpfxProjectAzureDevOpsPipelineAddCommand_instances = new WeakSet(), _SpfxProjectAzureDevOpsPipelineAddCommand_initTelemetry = function _SpfxProjectAzureDevOpsPipelineAddCommand_initTelemetry() {
|
|
156
|
-
this.telemetry.push((args) => {
|
|
157
|
-
Object.assign(this.telemetryProperties, {
|
|
158
|
-
name: typeof args.options.name !== 'undefined',
|
|
159
|
-
branchName: typeof args.options.branchName !== 'undefined',
|
|
160
|
-
loginMethod: typeof args.options.loginMethod !== 'undefined',
|
|
161
|
-
scope: typeof args.options.scope !== 'undefined',
|
|
162
|
-
skipFeatureDeployment: !!args.options.skipFeatureDeployment
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
}, _SpfxProjectAzureDevOpsPipelineAddCommand_initOptions = function _SpfxProjectAzureDevOpsPipelineAddCommand_initOptions() {
|
|
166
|
-
this.options.unshift({
|
|
167
|
-
option: '-n, --name [name]'
|
|
168
|
-
}, {
|
|
169
|
-
option: '-b, --branchName [branchName]'
|
|
170
|
-
}, {
|
|
171
|
-
option: '-l, --loginMethod [loginMethod]',
|
|
172
|
-
autocomplete: _a.loginMethod
|
|
173
|
-
}, {
|
|
174
|
-
option: '-s, --scope [scope]',
|
|
175
|
-
autocomplete: _a.scope
|
|
176
|
-
}, {
|
|
177
|
-
option: '-u, --siteUrl [siteUrl]'
|
|
178
|
-
}, {
|
|
179
|
-
option: '--skipFeatureDeployment'
|
|
180
|
-
});
|
|
181
|
-
}, _SpfxProjectAzureDevOpsPipelineAddCommand_initValidators = function _SpfxProjectAzureDevOpsPipelineAddCommand_initValidators() {
|
|
182
|
-
this.validators.push(async (args) => {
|
|
183
|
-
if (args.options.scope && args.options.scope === 'sitecollection') {
|
|
184
|
-
if (!args.options.siteUrl) {
|
|
185
|
-
return `siteUrl option has to be defined when scope set to ${args.options.scope}`;
|
|
186
|
-
}
|
|
187
|
-
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.siteUrl);
|
|
188
|
-
if (isValidSharePointUrl !== true) {
|
|
189
|
-
return isValidSharePointUrl;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
if (args.options.loginMethod && _a.loginMethod.indexOf(args.options.loginMethod) < 0) {
|
|
193
|
-
return `${args.options.loginMethod} is not a valid login method. Allowed values are ${_a.loginMethod.join(', ')}`;
|
|
194
|
-
}
|
|
195
|
-
if (args.options.scope && _a.scope.indexOf(args.options.scope) < 0) {
|
|
196
|
-
return `${args.options.scope} is not a valid scope. Allowed values are ${_a.scope.join(', ')}`;
|
|
197
|
-
}
|
|
198
|
-
return true;
|
|
199
|
-
});
|
|
200
|
-
};
|
|
201
|
-
SpfxProjectAzureDevOpsPipelineAddCommand.loginMethod = ['application', 'user'];
|
|
202
|
-
SpfxProjectAzureDevOpsPipelineAddCommand.scope = ['tenant', 'sitecollection'];
|
|
203
168
|
SpfxProjectAzureDevOpsPipelineAddCommand.ERROR_NO_PROJECT_ROOT_FOLDER = 1;
|
|
204
169
|
export default new SpfxProjectAzureDevOpsPipelineAddCommand();
|
|
205
170
|
//# sourceMappingURL=project-azuredevops-pipeline-add.js.map
|
|
@@ -1,31 +1,21 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _SpfxProjectDoctorCommand_instances, _a, _SpfxProjectDoctorCommand_initTelemetry, _SpfxProjectDoctorCommand_initOptions, _SpfxProjectDoctorCommand_initValidators;
|
|
7
1
|
import fs from 'fs';
|
|
8
2
|
import os from 'os';
|
|
9
3
|
import path from 'path';
|
|
10
|
-
import {
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { CommandError, globalOptionsZod } from '../../../../Command.js';
|
|
11
6
|
import { packageManager } from '../../../../utils/packageManager.js';
|
|
12
7
|
import commands from '../../commands.js';
|
|
13
8
|
import { BaseProjectCommand } from './base-project-command.js';
|
|
14
9
|
import { rules as genericRules } from './project-doctor/generic-rules.js';
|
|
15
10
|
import { FN017001_MISC_npm_dedupe } from './project-upgrade/rules/FN017001_MISC_npm_dedupe.js';
|
|
11
|
+
export const options = z.strictObject({
|
|
12
|
+
...globalOptionsZod.shape,
|
|
13
|
+
packageManager: z.enum(['npm', 'pnpm', 'yarn']).optional(),
|
|
14
|
+
output: z.enum(['json', 'text', 'md', 'tour']).optional().alias('o')
|
|
15
|
+
});
|
|
16
16
|
class SpfxProjectDoctorCommand extends BaseProjectCommand {
|
|
17
|
-
get allowedOutputs() {
|
|
18
|
-
return ['json', 'text', 'md', 'tour'];
|
|
19
|
-
}
|
|
20
|
-
get name() {
|
|
21
|
-
return commands.PROJECT_DOCTOR;
|
|
22
|
-
}
|
|
23
|
-
get description() {
|
|
24
|
-
return 'Validates correctness of a SharePoint Framework project';
|
|
25
|
-
}
|
|
26
17
|
constructor() {
|
|
27
|
-
super();
|
|
28
|
-
_SpfxProjectDoctorCommand_instances.add(this);
|
|
18
|
+
super(...arguments);
|
|
29
19
|
this.allFindings = [];
|
|
30
20
|
this.packageManager = 'npm';
|
|
31
21
|
this.supportedVersions = [
|
|
@@ -82,14 +72,20 @@ class SpfxProjectDoctorCommand extends BaseProjectCommand {
|
|
|
82
72
|
'1.24.0',
|
|
83
73
|
'1.24.1'
|
|
84
74
|
];
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
75
|
+
}
|
|
76
|
+
get name() {
|
|
77
|
+
return commands.PROJECT_DOCTOR;
|
|
78
|
+
}
|
|
79
|
+
get description() {
|
|
80
|
+
return 'Validates correctness of a SharePoint Framework project';
|
|
81
|
+
}
|
|
82
|
+
get schema() {
|
|
83
|
+
return options;
|
|
88
84
|
}
|
|
89
85
|
async commandAction(logger, args) {
|
|
90
86
|
this.projectRootPath = this.getProjectRoot(process.cwd());
|
|
91
87
|
if (this.projectRootPath === null) {
|
|
92
|
-
throw new CommandError(`Couldn't find project root folder`,
|
|
88
|
+
throw new CommandError(`Couldn't find project root folder`, SpfxProjectDoctorCommand.ERROR_NO_PROJECT_ROOT_FOLDER);
|
|
93
89
|
}
|
|
94
90
|
this.packageManager = args.options.packageManager || 'npm';
|
|
95
91
|
if (this.verbose) {
|
|
@@ -102,10 +98,10 @@ class SpfxProjectDoctorCommand extends BaseProjectCommand {
|
|
|
102
98
|
}
|
|
103
99
|
project.version = this.getProjectVersion();
|
|
104
100
|
if (!project.version) {
|
|
105
|
-
throw new CommandError(`Unable to determine the version of the current SharePoint Framework project`,
|
|
101
|
+
throw new CommandError(`Unable to determine the version of the current SharePoint Framework project`, SpfxProjectDoctorCommand.ERROR_NO_VERSION);
|
|
106
102
|
}
|
|
107
103
|
if (!this.supportedVersions.includes(project.version)) {
|
|
108
|
-
throw new CommandError(`CLI for Microsoft 365 doesn't support validating projects built using SharePoint Framework v${project.version}`,
|
|
104
|
+
throw new CommandError(`CLI for Microsoft 365 doesn't support validating projects built using SharePoint Framework v${project.version}`, SpfxProjectDoctorCommand.ERROR_UNSUPPORTED_VERSION);
|
|
109
105
|
}
|
|
110
106
|
if (this.verbose) {
|
|
111
107
|
await logger.logToStderr(`Project built using SPFx v${project.version}`);
|
|
@@ -348,33 +344,6 @@ ${f.resolution}
|
|
|
348
344
|
};
|
|
349
345
|
}
|
|
350
346
|
}
|
|
351
|
-
_a = SpfxProjectDoctorCommand, _SpfxProjectDoctorCommand_instances = new WeakSet(), _SpfxProjectDoctorCommand_initTelemetry = function _SpfxProjectDoctorCommand_initTelemetry() {
|
|
352
|
-
this.telemetry.push((args) => {
|
|
353
|
-
Object.assign(this.telemetryProperties, {
|
|
354
|
-
packageManager: args.options.packageManager || 'npm'
|
|
355
|
-
});
|
|
356
|
-
});
|
|
357
|
-
}, _SpfxProjectDoctorCommand_initOptions = function _SpfxProjectDoctorCommand_initOptions() {
|
|
358
|
-
this.options.forEach(o => {
|
|
359
|
-
if (o.option.indexOf('--output') > -1) {
|
|
360
|
-
o.autocomplete = this.allowedOutputs;
|
|
361
|
-
}
|
|
362
|
-
});
|
|
363
|
-
this.options.unshift({
|
|
364
|
-
option: '--packageManager [packageManager]',
|
|
365
|
-
autocomplete: _a.packageManagers
|
|
366
|
-
});
|
|
367
|
-
}, _SpfxProjectDoctorCommand_initValidators = function _SpfxProjectDoctorCommand_initValidators() {
|
|
368
|
-
this.validators.push(async (args) => {
|
|
369
|
-
if (args.options.packageManager) {
|
|
370
|
-
if (_a.packageManagers.indexOf(args.options.packageManager) < 0) {
|
|
371
|
-
return `${args.options.packageManager} is not a supported package manager. Supported package managers are ${_a.packageManagers.join(', ')}`;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
return true;
|
|
375
|
-
});
|
|
376
|
-
};
|
|
377
|
-
SpfxProjectDoctorCommand.packageManagers = ['npm', 'pnpm', 'yarn'];
|
|
378
347
|
SpfxProjectDoctorCommand.ERROR_NO_PROJECT_ROOT_FOLDER = 1;
|
|
379
348
|
SpfxProjectDoctorCommand.ERROR_NO_VERSION = 3;
|
|
380
349
|
SpfxProjectDoctorCommand.ERROR_UNSUPPORTED_VERSION = 4;
|
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _SpfxProjectExternalizeCommand_instances, _SpfxProjectExternalizeCommand_initOptions;
|
|
7
1
|
import os from 'os';
|
|
8
2
|
import path from 'path';
|
|
9
|
-
import {
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { CommandError, globalOptionsZod } from '../../../../Command.js';
|
|
10
5
|
import commands from '../../commands.js';
|
|
11
6
|
import { BaseProjectCommand } from './base-project-command.js';
|
|
12
7
|
import rules from './project-externalize/DefaultRules.js';
|
|
8
|
+
export const options = z.strictObject({
|
|
9
|
+
...globalOptionsZod.shape,
|
|
10
|
+
output: z.enum(['json', 'text', 'md']).optional().alias('o')
|
|
11
|
+
});
|
|
13
12
|
class SpfxProjectExternalizeCommand extends BaseProjectCommand {
|
|
14
|
-
get allowedOutputs() {
|
|
15
|
-
return ['json', 'text', 'md'];
|
|
16
|
-
}
|
|
17
|
-
get name() {
|
|
18
|
-
return commands.PROJECT_EXTERNALIZE;
|
|
19
|
-
}
|
|
20
|
-
get description() {
|
|
21
|
-
return 'Externalizes SharePoint Framework project dependencies';
|
|
22
|
-
}
|
|
23
13
|
constructor() {
|
|
24
|
-
super();
|
|
25
|
-
_SpfxProjectExternalizeCommand_instances.add(this);
|
|
14
|
+
super(...arguments);
|
|
26
15
|
this.supportedVersions = [
|
|
27
16
|
'1.0.0',
|
|
28
17
|
'1.0.1',
|
|
@@ -49,7 +38,15 @@ class SpfxProjectExternalizeCommand extends BaseProjectCommand {
|
|
|
49
38
|
];
|
|
50
39
|
this.allFindings = [];
|
|
51
40
|
this.allEditSuggestions = [];
|
|
52
|
-
|
|
41
|
+
}
|
|
42
|
+
get name() {
|
|
43
|
+
return commands.PROJECT_EXTERNALIZE;
|
|
44
|
+
}
|
|
45
|
+
get description() {
|
|
46
|
+
return 'Externalizes SharePoint Framework project dependencies';
|
|
47
|
+
}
|
|
48
|
+
get schema() {
|
|
49
|
+
return options;
|
|
53
50
|
}
|
|
54
51
|
async commandAction(logger, args) {
|
|
55
52
|
if (args.options.output !== 'json' || this.verbose) {
|
|
@@ -178,13 +175,6 @@ class SpfxProjectExternalizeCommand extends BaseProjectCommand {
|
|
|
178
175
|
return s.join('').trim();
|
|
179
176
|
}
|
|
180
177
|
}
|
|
181
|
-
_SpfxProjectExternalizeCommand_instances = new WeakSet(), _SpfxProjectExternalizeCommand_initOptions = function _SpfxProjectExternalizeCommand_initOptions() {
|
|
182
|
-
this.options.forEach(o => {
|
|
183
|
-
if (o.option.indexOf('--output') > -1) {
|
|
184
|
-
o.autocomplete = this.allowedOutputs;
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
};
|
|
188
178
|
SpfxProjectExternalizeCommand.ERROR_NO_PROJECT_ROOT_FOLDER = 1;
|
|
189
179
|
SpfxProjectExternalizeCommand.ERROR_NO_VERSION = 3;
|
|
190
180
|
SpfxProjectExternalizeCommand.ERROR_UNSUPPORTED_VERSION = 2;
|