Skip to content

Commit 1d3be7a

Browse files
authored
Merge pull request #587 from salesforcecli/wr/sourceOpen
feat: add force:source:open force:mdapi:listmetadata force:mdapi:describemetadata
2 parents 08154f3 + 9d3314b commit 1d3be7a

23 files changed

+1735
-661
lines changed

.mocharc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
"watch-files": ["src", "test"],
55
"recursive": true,
66
"reporter": "spec",
7-
"timeout": 5000
7+
"timeout": 10000
88
}

CHANGELOG.md

Lines changed: 110 additions & 356 deletions
Large diffs are not rendered by default.

command-snapshot.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,23 @@
114114
"flags": ["all", "clean", "json", "loglevel", "no-prompt", "skip-connection-status", "verbose"],
115115
"alias": ["force:org:list"]
116116
},
117+
{
118+
"command": "org:list:metadata",
119+
"plugin": "@salesforce/plugin-org",
120+
"flags": ["api-version", "folder", "json", "loglevel", "metadata-type", "output-file", "target-org"],
121+
"alias": ["force:mdapi:listmetadata"]
122+
},
123+
{
124+
"command": "org:list:metadata-types",
125+
"plugin": "@salesforce/plugin-org",
126+
"flags": ["api-version", "filter-known", "json", "loglevel", "output-file", "target-org"],
127+
"alias": ["force:mdapi:describemetadata"]
128+
},
117129
{
118130
"command": "org:open",
119131
"plugin": "@salesforce/plugin-org",
120-
"flags": ["api-version", "browser", "json", "loglevel", "path", "target-org", "url-only"],
121-
"alias": ["force:org:open"]
132+
"flags": ["api-version", "browser", "json", "loglevel", "path", "source-file", "target-org", "url-only"],
133+
"alias": ["force:org:open", "force:source:open"]
122134
},
123135
{
124136
"command": "org:resume:sandbox",

messages/list.metadata.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# description
2+
3+
Use this command to identify individual components in your manifest file or if you want a high-level view of particular metadata types in your org. For example, you can use this command to return a list of names of all the CustomObject or Layout components in your org, then use this information in a retrieve command that returns a subset of these components.
4+
5+
The username that you use to connect to the org must have the Modify All Data or Modify Metadata Through Metadata API Functions permission.
6+
7+
# summary
8+
9+
List the metadata components and properties of a specified type.
10+
11+
# examples
12+
13+
- List the CustomObject components, and their properties, in the org with alias "my-dev-org":
14+
15+
$ <%= config.bin %> <%= command.id %> --metadata-type CustomObject --target-org my-dev-org
16+
17+
- List the CustomObject components in your default org, write the output to the specified file, and use API version 57.0:
18+
19+
$ <%= config.bin %> <%= command.id %> --metadata-type CustomObject --api-version 57.0 --output-file /path/to/outputfilename.txt
20+
21+
- List the Dashboard components in your default org that are contained in the "folderSales" folder, write the output to the specified file, and use API version 57.0:
22+
23+
$ <%= config.bin %> <%= command.id %> --metadata-type Dashboard --folder folderSales --api-version 57.0 --output-file /path/to/outputfilename.txt
24+
25+
# flags.api-version.summary
26+
27+
API version to use; default is the most recent API version.
28+
29+
# flags.output-file.summary
30+
31+
Pathname of the file in which to write the results.
32+
33+
# flags.metadata-type.summary
34+
35+
Metadata type to be retrieved, such as CustomObject; metadata type names are case-sensitive.
36+
37+
# flags.folder.summary
38+
39+
Folder associated with the component; required for components that use folders; folder names are case-sensitive.
40+
41+
# flags.folder.description
42+
43+
Examples of metadata types that use folders are Dashboard, Document, EmailTemplate, and Report.
44+
45+
# noMatchingMetadata
46+
47+
No metadata found for type: %s in org: %s.

messages/metadata-types.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# description
2+
3+
The information includes Apex classes and triggers, custom objects, custom fields on standard objects, tab sets that define an app, and many other metadata types. Use this information to identify the syntax needed for a <name> element in a manifest file (package.xml).
4+
5+
The username that you use to connect to the org must have the Modify All Data or Modify Metadata Through Metadata API Functions permission.
6+
7+
# summary
8+
9+
Display details about the metadata types that are enabled for your org.
10+
11+
# examples
12+
13+
- Display information about all known and enabled metadata types in the org with alias "my-dev-org" using API version 57.0:
14+
15+
$ <%= config.bin %> <%= command.id %> --api-version 57.0 --target-org my-dev-org
16+
17+
- Display only the metadata types that aren't yet supported by Salesforce CLI in your default org and write the results to the specified file:
18+
19+
$ <%= config.bin %> <%= command.id %> --output-file /path/to/outputfilename.txt --filter-known
20+
21+
# flags.api-version.summary
22+
23+
API version to use; default is the most recent API version.
24+
25+
# flags.output-file.summary
26+
27+
Pathname of the file in which to write the results.
28+
29+
# flags.filter-known.summary
30+
31+
Filter the known metadata types from the result to display only the types not yet fully supported by Salesforce CLI.
32+
33+
filter metadata known by the CLI
34+
35+
# flags.output-file.description
36+
37+
Directing the output to a file makes it easier to extract relevant information for your package.xml manifest file. The default output destination is the terminal or command window console.

messages/open.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Open your default scratch org, or another specified org, in a browser.
66

77
To open a specific page, specify the portion of the URL after "https://MyDomainName.my.salesforce.com/" as the value for the --path flag. For example, specify "--path lightning" to open Lightning Experience, or specify "--path /apex/YourPage" to open a Visualforce page.
88

9+
Use the --source-file to open a Lightning Page from your local project in Lightning App Builder. Lightning page files have the suffix .flexipage-meta.xml, and are stored in the "flexipages" directory.
10+
911
To generate a URL but not launch it in your browser, specify --url-only.
1012

1113
To open in a specific browser, use the --browser flag. Supported browsers are "chrome", "edge", and "firefox". If you don't specify --browser, the org opens in your default browser.
@@ -24,10 +26,18 @@ To open in a specific browser, use the --browser flag. Supported browsers are "c
2426

2527
$ <%= config.bin %> <%= command.id %> --url-only --path lightning
2628

29+
- Open a local Lightning page in your default org's Lightning App Builder:
30+
31+
$ <%= config.bin %> <%= command.id %> --source-path force-app/main/default/flexipages/Hello.flexipage-meta.xml
32+
2733
# flags.browser.summary
2834

2935
Browser where the org opens.
3036

37+
# flags.source-file.summary
38+
39+
Path to an ApexPage or FlexiPage to open in Lightning App Builder.
40+
3141
# flags.path.summary
3242

3343
Navigation URL path to open a specific page.

package.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
"main": "lib/index.js",
77
"bugs": "https://github.com/forcedotcom/cli/issues",
88
"dependencies": {
9-
"@oclif/core": "^2.3.1",
9+
"@oclif/core": "^2.6.3",
1010
"@salesforce/core": "^3.33.5",
1111
"@salesforce/kit": "^1.9.0",
1212
"@salesforce/sf-plugins-core": "^2.2.3",
13-
"open": "8.4.2",
13+
"@salesforce/source-deploy-retrieve": "^7.11.0",
14+
"open": "^8.4.2",
1415
"tslib": "^2"
1516
},
1617
"devDependencies": {
@@ -19,6 +20,7 @@
1920
"@salesforce/dev-config": "^3.1.0",
2021
"@salesforce/dev-scripts": "^4.1.2",
2122
"@salesforce/plugin-command-reference": "^2.2.9",
23+
"@salesforce/plugin-source": "^2.7.0",
2224
"@salesforce/prettier-config": "^0.0.2",
2325
"@salesforce/ts-sinon": "1.4.6",
2426
"@swc/core": "^1.3.37",
@@ -36,7 +38,7 @@
3638
"eslint-plugin-header": "^3.0.0",
3739
"eslint-plugin-import": "2.27.5",
3840
"eslint-plugin-jsdoc": "^40.0.1",
39-
"eslint-plugin-sf-plugin": "^1.8.1",
41+
"eslint-plugin-sf-plugin": "^1.13.0",
4042
"husky": "^7.0.4",
4143
"mocha": "^9.1.3",
4244
"moment": "^2.29.1",
@@ -74,7 +76,8 @@
7476
"devPlugins": [
7577
"@oclif/plugin-help",
7678
"@oclif/plugin-command-snapshot",
77-
"@salesforce/plugin-command-reference"
79+
"@salesforce/plugin-command-reference",
80+
"@salesforce/plugin-source"
7881
],
7982
"topics": {
8083
"org": {
@@ -86,6 +89,9 @@
8689
"resume": {
8790
"description": "Resume an org creation that was started asynchronously, timed out, or was interrupted."
8891
},
92+
"list": {
93+
"description": "list metadata types that are relevant to the org"
94+
},
8995
"delete": {
9096
"description": "Delete scratch orgs, sandboxes, org shapes, and org snapshots."
9197
}
@@ -115,7 +121,7 @@
115121
"prepack": "sf-prepack",
116122
"prepare": "sf-install",
117123
"test": "wireit",
118-
"test:nuts": "nyc mocha \"./test/nut/*.nut.ts\" --slow 4500 --timeout 1200000",
124+
"test:nuts": "nyc mocha \"./test/nut/*.nut.ts\" --slow 4500 --timeout 1200000 --parallel --jobs 20",
119125
"test:nuts:legacy": "nyc mocha \"./test/nut/legacy/*.nut.ts\" --slow 4500 --timeout 1200000 --parallel --jobs 10",
120126
"test:nuts:sandbox": "nyc mocha \"./test/**/*.sandboxNut.ts\" --slow 450000 --timeout 7200000 --parallel --jobs 10",
121127
"test:only": "wireit",
@@ -231,4 +237,4 @@
231237
"output": []
232238
}
233239
}
234-
}
240+
}

schemas/org-list-metadata.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$ref": "#/definitions/ListMetadataCommandResult",
4+
"definitions": {
5+
"ListMetadataCommandResult": {
6+
"type": "array",
7+
"items": {
8+
"$ref": "#/definitions/FileProperties"
9+
}
10+
},
11+
"FileProperties": {
12+
"type": "object",
13+
"properties": {
14+
"createdById": {
15+
"type": "string"
16+
},
17+
"createdByName": {
18+
"type": "string"
19+
},
20+
"createdDate": {
21+
"type": "string"
22+
},
23+
"fileName": {
24+
"type": "string"
25+
},
26+
"fullName": {
27+
"type": "string"
28+
},
29+
"id": {
30+
"type": "string"
31+
},
32+
"lastModifiedById": {
33+
"type": "string"
34+
},
35+
"lastModifiedByName": {
36+
"type": "string"
37+
},
38+
"lastModifiedDate": {
39+
"type": "string"
40+
},
41+
"manageableState": {
42+
"type": ["string", "null"]
43+
},
44+
"namespacePrefix": {
45+
"type": ["string", "null"]
46+
},
47+
"type": {
48+
"type": "string"
49+
}
50+
},
51+
"required": [
52+
"createdById",
53+
"createdByName",
54+
"createdDate",
55+
"fileName",
56+
"fullName",
57+
"id",
58+
"lastModifiedById",
59+
"lastModifiedByName",
60+
"lastModifiedDate",
61+
"type"
62+
],
63+
"additionalProperties": false
64+
}
65+
}
66+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$ref": "#/definitions/DescribeMetadataResult",
4+
"definitions": {
5+
"DescribeMetadataResult": {
6+
"type": "object",
7+
"properties": {
8+
"metadataObjects": {
9+
"type": "array",
10+
"items": {
11+
"$ref": "#/definitions/DescribeMetadataObject"
12+
}
13+
},
14+
"organizationNamespace": {
15+
"type": "string"
16+
},
17+
"partialSaveAllowed": {
18+
"type": "boolean"
19+
},
20+
"testRequired": {
21+
"type": "boolean"
22+
}
23+
},
24+
"required": ["metadataObjects", "organizationNamespace", "partialSaveAllowed", "testRequired"],
25+
"additionalProperties": false
26+
},
27+
"DescribeMetadataObject": {
28+
"type": "object",
29+
"properties": {
30+
"childXmlNames": {
31+
"type": "array",
32+
"items": {
33+
"type": "string"
34+
}
35+
},
36+
"directoryName": {
37+
"type": "string"
38+
},
39+
"inFolder": {
40+
"type": "boolean"
41+
},
42+
"metaFile": {
43+
"type": "boolean"
44+
},
45+
"suffix": {
46+
"type": ["string", "null"]
47+
},
48+
"xmlName": {
49+
"type": "string"
50+
}
51+
},
52+
"required": ["childXmlNames", "directoryName", "inFolder", "metaFile", "xmlName"],
53+
"additionalProperties": false
54+
}
55+
}
56+
}

0 commit comments

Comments
 (0)