Skip to content

Commit 11bb901

Browse files
maggibenshetzel
andauthored
Move toolbelt/source:open to plugin-source (#99)
* chore: cmd skeleton * feat: return flexipage app builder url * chore: type declare fx * chore: deprecate require * chore: use previously saved var * chore: clean types export * chore: add tests for getTypeDefinitionByFileName * chore: update command-snapshot.json * chore: use 'open' lib to open urls + fix frontdoor url * chore: add command test * chore: remove dependency on SfdxProject.resolveProjectPathSync * chore: add NUT test * chore: fix output message * chore: return correct type * chore: better type on json collection * chore: use sdr to get file metadata type * chore: stub getTypeDefinitionByFileName * chore: clean command options and messages * chore: clean unused vars * chore: remove unused * chore: no upgrade sdr * chore: clean run method * chore: deprecated check * chore: remove unused stub * chore: get frontdoor from AuthInfo * chore: remove unused * chore: stub for getOrgFrontDoorUrl * chore: remove unwanted print * chore: use getTypeBySuffix from RegistryAccess * chore: fix suffix extraction * chore: just stub fs calls * chore: move restore * chore: better stub * chore: use MetadataResolver to resolve file type * chore: test upgrade + merge * chore: use checkLightningDomain from sfdx-core * chore: remove unused * chore: use checkLightningDomain from sfdx-core * chore: make stubs compatible + code cleanup * chore: restore test * chore: upgrade core * chore: bump command version * chore: bump deps * chore: restore files * fix: extend from sourceCommand Co-authored-by: Steve Hetzel <shetzel@salesforce.com>
1 parent 76a4be4 commit 11bb901

File tree

10 files changed

+477
-30
lines changed

10 files changed

+477
-30
lines changed

CHANGELOG.md

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,61 +13,53 @@ All notable changes to this project will be documented in this file. See [standa
1313

1414
### [1.0.3](https://github.com/salesforcecli/plugin-source/compare/v1.0.2...v1.0.3) (2021-07-28)
1515

16-
1716
### Bug Fixes
1817

19-
* deploy:report now respects the wait flag ([#153](https://github.com/salesforcecli/plugin-source/issues/153)) ([c194f7c](https://github.com/salesforcecli/plugin-source/commit/c194f7c6907074fef8ac2b4e450c511966b83f5f))
18+
- deploy:report now respects the wait flag ([#153](https://github.com/salesforcecli/plugin-source/issues/153)) ([c194f7c](https://github.com/salesforcecli/plugin-source/commit/c194f7c6907074fef8ac2b4e450c511966b83f5f))
2019

2120
### [1.0.2](https://github.com/salesforcecli/plugin-source/compare/v1.0.1...v1.0.2) (2021-07-26)
2221

23-
2422
### Bug Fixes
2523

26-
* throw deploy error when missing required params ([#150](https://github.com/salesforcecli/plugin-source/issues/150)) ([234c596](https://github.com/salesforcecli/plugin-source/commit/234c5968b31dc620dcdb318dccbcc1dcc1e11fde))
24+
- throw deploy error when missing required params ([#150](https://github.com/salesforcecli/plugin-source/issues/150)) ([234c596](https://github.com/salesforcecli/plugin-source/commit/234c5968b31dc620dcdb318dccbcc1dcc1e11fde))
2725

2826
### [1.0.1](https://github.com/salesforcecli/plugin-source/compare/v1.0.0...v1.0.1) (2021-07-26)
2927

30-
3128
### Bug Fixes
3229

33-
* minor package fixes ([#152](https://github.com/salesforcecli/plugin-source/issues/152)) ([5aa593d](https://github.com/salesforcecli/plugin-source/commit/5aa593d2e20297c1b928b828679de9c3ea4809e6))
30+
- minor package fixes ([#152](https://github.com/salesforcecli/plugin-source/issues/152)) ([5aa593d](https://github.com/salesforcecli/plugin-source/commit/5aa593d2e20297c1b928b828679de9c3ea4809e6))
3431

3532
## [1.0.0](https://github.com/salesforcecli/plugin-source/compare/v0.1.22...v1.0.0) (2021-07-22)
3633

37-
3834
### Bug Fixes
3935

40-
* deploy errors are reported properly ([#146](https://github.com/salesforcecli/plugin-source/issues/146)) ([08fbbdd](https://github.com/salesforcecli/plugin-source/commit/08fbbdd2c919b1000fcdb253d9d63babf643ded1))
41-
* retrieve package names output ([#149](https://github.com/salesforcecli/plugin-source/issues/149)) ([7350488](https://github.com/salesforcecli/plugin-source/commit/7350488f2ac7e7d0fa1c0ffef58c7b60d74fb423))
42-
* set sourceApiVersion on the ComponentSet ([#147](https://github.com/salesforcecli/plugin-source/issues/147)) ([46c15ba](https://github.com/salesforcecli/plugin-source/commit/46c15ba5d5f783a09002c81870a155d0691fd162))
36+
- deploy errors are reported properly ([#146](https://github.com/salesforcecli/plugin-source/issues/146)) ([08fbbdd](https://github.com/salesforcecli/plugin-source/commit/08fbbdd2c919b1000fcdb253d9d63babf643ded1))
37+
- retrieve package names output ([#149](https://github.com/salesforcecli/plugin-source/issues/149)) ([7350488](https://github.com/salesforcecli/plugin-source/commit/7350488f2ac7e7d0fa1c0ffef58c7b60d74fb423))
38+
- set sourceApiVersion on the ComponentSet ([#147](https://github.com/salesforcecli/plugin-source/issues/147)) ([46c15ba](https://github.com/salesforcecli/plugin-source/commit/46c15ba5d5f783a09002c81870a155d0691fd162))
4339

4440
### [0.1.22](https://github.com/salesforcecli/plugin-source/compare/v0.1.21...v0.1.22) (2021-06-28)
4541

46-
4742
### Bug Fixes
4843

49-
* display retrieve warnings ([#121](https://github.com/salesforcecli/plugin-source/issues/121)) ([a2330ed](https://github.com/salesforcecli/plugin-source/commit/a2330edb51408a91169608a5d518423dd919231b))
44+
- display retrieve warnings ([#121](https://github.com/salesforcecli/plugin-source/issues/121)) ([a2330ed](https://github.com/salesforcecli/plugin-source/commit/a2330edb51408a91169608a5d518423dd919231b))
5045

5146
### [0.1.21](https://github.com/salesforcecli/plugin-source/compare/v0.1.20...v0.1.21) (2021-06-24)
5247

53-
5448
### Bug Fixes
5549

56-
* postretrieve hook payload is now the file responses ([#120](https://github.com/salesforcecli/plugin-source/issues/120)) ([a505389](https://github.com/salesforcecli/plugin-source/commit/a50538905a9bb02192c9803fec49000baf6a588f))
50+
- postretrieve hook payload is now the file responses ([#120](https://github.com/salesforcecli/plugin-source/issues/120)) ([a505389](https://github.com/salesforcecli/plugin-source/commit/a50538905a9bb02192c9803fec49000baf6a588f))
5751

5852
### [0.1.20](https://github.com/salesforcecli/plugin-source/compare/v0.1.19...v0.1.20) (2021-06-17)
5953

60-
6154
### Bug Fixes
6255

63-
* temporary polling fix ([#114](https://github.com/salesforcecli/plugin-source/issues/114)) ([6c6a3ab](https://github.com/salesforcecli/plugin-source/commit/6c6a3ab6b1a4e36efa974627bc944e37e875c3d6))
56+
- temporary polling fix ([#114](https://github.com/salesforcecli/plugin-source/issues/114)) ([6c6a3ab](https://github.com/salesforcecli/plugin-source/commit/6c6a3ab6b1a4e36efa974627bc944e37e875c3d6))
6457

6558
### [0.1.19](https://github.com/salesforcecli/plugin-source/compare/v0.0.19...v0.1.19) (2021-06-12)
6659

67-
6860
### Features
6961

70-
* add support for async deploys ([#89](https://github.com/salesforcecli/plugin-source/issues/89)) ([e7d7215](https://github.com/salesforcecli/plugin-source/commit/e7d721561542baab8abcf6a8d482e7bb9653176a)), closes [#108](https://github.com/salesforcecli/plugin-source/issues/108) [#84](https://github.com/salesforcecli/plugin-source/issues/84) [#85](https://github.com/salesforcecli/plugin-source/issues/85) [#88](https://github.com/salesforcecli/plugin-source/issues/88) [#80](https://github.com/salesforcecli/plugin-source/issues/80) [#90](https://github.com/salesforcecli/plugin-source/issues/90) [#105](https://github.com/salesforcecli/plugin-source/issues/105) [#106](https://github.com/salesforcecli/plugin-source/issues/106)
62+
- add support for async deploys ([#89](https://github.com/salesforcecli/plugin-source/issues/89)) ([e7d7215](https://github.com/salesforcecli/plugin-source/commit/e7d721561542baab8abcf6a8d482e7bb9653176a)), closes [#108](https://github.com/salesforcecli/plugin-source/issues/108) [#84](https://github.com/salesforcecli/plugin-source/issues/84) [#85](https://github.com/salesforcecli/plugin-source/issues/85) [#88](https://github.com/salesforcecli/plugin-source/issues/88) [#80](https://github.com/salesforcecli/plugin-source/issues/80) [#90](https://github.com/salesforcecli/plugin-source/issues/90) [#105](https://github.com/salesforcecli/plugin-source/issues/105) [#106](https://github.com/salesforcecli/plugin-source/issues/106)
7163

7264
### [0.0.19](https://github.com/salesforcecli/plugin-source/compare/v0.0.18...v0.0.19) (2021-06-10)
7365

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ sfdx plugins
7575
# Usage
7676

7777
<!-- usage -->
78+
7879
```sh-session
7980
$ npm install -g @salesforce/plugin-source
8081
$ sfdx COMMAND
@@ -86,16 +87,18 @@ USAGE
8687
$ sfdx COMMAND
8788
...
8889
```
90+
8991
<!-- usagestop -->
9092

9193
# Commands
9294

9395
<!-- commands -->
94-
* [`sfdx force:source:convert [-r <directory>] [-d <directory>] [-n <string>] [-p <array> | -x <string> | -m <array>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcesourceconvert--r-directory--d-directory--n-string--p-array---x-string---m-array---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
95-
* [`sfdx force:source:deploy [--soapdeploy] [-w <minutes>] [-q <id> | -x <filepath> | -m <array> | -p <array> | -c | -l NoTestRun|RunSpecifiedTests|RunLocalTests|RunAllTestsInOrg | -r <array> | -o | -g] [-u <string>] [--apiversion <string>] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcesourcedeploy---soapdeploy--w-minutes--q-id---x-filepath---m-array---p-array---c---l-notestrunrunspecifiedtestsrunlocaltestsrunalltestsinorg---r-array---o---g--u-string---apiversion-string---verbose---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
96-
* [`sfdx force:source:deploy:cancel [-w <minutes>] [-i <id>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcesourcedeploycancel--w-minutes--i-id--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
97-
* [`sfdx force:source:deploy:report [-w <minutes>] [-i <id>] [-u <string>] [--apiversion <string>] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcesourcedeployreport--w-minutes--i-id--u-string---apiversion-string---verbose---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
98-
* [`sfdx force:source:retrieve [-p <array> | -x <filepath> | -m <array>] [-w <minutes>] [-n <array>] [-u <string>] [-a <string>] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcesourceretrieve--p-array---x-filepath---m-array--w-minutes--n-array--u-string--a-string---verbose---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
96+
97+
- [`sfdx force:source:convert [-r <directory>] [-d <directory>] [-n <string>] [-p <array> | -x <string> | -m <array>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcesourceconvert--r-directory--d-directory--n-string--p-array---x-string---m-array---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
98+
- [`sfdx force:source:deploy [--soapdeploy] [-w <minutes>] [-q <id> | -x <filepath> | -m <array> | -p <array> | -c | -l NoTestRun|RunSpecifiedTests|RunLocalTests|RunAllTestsInOrg | -r <array> | -o | -g] [-u <string>] [--apiversion <string>] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcesourcedeploy---soapdeploy--w-minutes--q-id---x-filepath---m-array---p-array---c---l-notestrunrunspecifiedtestsrunlocaltestsrunalltestsinorg---r-array---o---g--u-string---apiversion-string---verbose---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
99+
- [`sfdx force:source:deploy:cancel [-w <minutes>] [-i <id>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcesourcedeploycancel--w-minutes--i-id--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
100+
- [`sfdx force:source:deploy:report [-w <minutes>] [-i <id>] [-u <string>] [--apiversion <string>] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcesourcedeployreport--w-minutes--i-id--u-string---apiversion-string---verbose---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
101+
- [`sfdx force:source:retrieve [-p <array> | -x <filepath> | -m <array>] [-w <minutes>] [-n <array>] [-u <string>] [-a <string>] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcesourceretrieve--p-array---x-filepath---m-array--w-minutes--n-array--u-string--a-string---verbose---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
99102

100103
## `sfdx force:source:convert [-r <directory>] [-d <directory>] [-n <string>] [-p <array> | -x <string> | -m <array>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
101104

@@ -105,7 +108,7 @@ convert source into Metadata API format
105108
convert source into Metadata API format
106109
107110
USAGE
108-
$ sfdx force:source:convert [-r <directory>] [-d <directory>] [-n <string>] [-p <array> | -x <string> | -m <array>]
111+
$ sfdx force:source:convert [-r <directory>] [-d <directory>] [-n <string>] [-p <array> | -x <string> | -m <array>]
109112
[--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
110113
111114
OPTIONS
@@ -148,8 +151,8 @@ deploy source to an org
148151
deploy source to an org
149152
150153
USAGE
151-
$ sfdx force:source:deploy [--soapdeploy] [-w <minutes>] [-q <id> | -x <filepath> | -m <array> | -p <array> | -c | -l
152-
NoTestRun|RunSpecifiedTests|RunLocalTests|RunAllTestsInOrg | -r <array> | -o | -g] [-u <string>] [--apiversion
154+
$ sfdx force:source:deploy [--soapdeploy] [-w <minutes>] [-q <id> | -x <filepath> | -m <array> | -p <array> | -c | -l
155+
NoTestRun|RunSpecifiedTests|RunLocalTests|RunAllTestsInOrg | -r <array> | -o | -g] [-u <string>] [--apiversion
153156
<string>] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
154157
155158
OPTIONS
@@ -223,7 +226,7 @@ cancel a source deployment
223226
cancel a source deployment
224227
225228
USAGE
226-
$ sfdx force:source:deploy:cancel [-w <minutes>] [-i <id>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
229+
$ sfdx force:source:deploy:cancel [-w <minutes>] [-i <id>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
227230
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
228231
229232
OPTIONS
@@ -261,7 +264,7 @@ check the status of a metadata deployment
261264
check the status of a metadata deployment
262265
263266
USAGE
264-
$ sfdx force:source:deploy:report [-w <minutes>] [-i <id>] [-u <string>] [--apiversion <string>] [--verbose] [--json]
267+
$ sfdx force:source:deploy:report [-w <minutes>] [-i <id>] [-u <string>] [--apiversion <string>] [--verbose] [--json]
265268
[--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
266269
267270
OPTIONS
@@ -306,7 +309,7 @@ retrieve source from an org
306309
retrieve source from an org
307310
308311
USAGE
309-
$ sfdx force:source:retrieve [-p <array> | -x <filepath> | -m <array>] [-w <minutes>] [-n <array>] [-u <string>] [-a
312+
$ sfdx force:source:retrieve [-p <array> | -x <filepath> | -m <array>] [-w <minutes>] [-n <array>] [-u <string>] [-a
310313
<string>] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
311314
312315
OPTIONS

command-snapshot.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
"plugin": "@salesforce/plugin-source",
3737
"flags": ["apiversion", "jobid", "json", "loglevel", "targetusername", "wait", "verbose"]
3838
},
39+
{
40+
"command": "force:source:open",
41+
"plugin": "@salesforce/plugin-source",
42+
"flags": ["apiversion", "json", "loglevel", "sourcefile", "targetusername", "urlonly"]
43+
},
3944
{
4045
"command": "force:source:retrieve",
4146
"plugin": "@salesforce/plugin-source",

messages/open.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"description": "edit a Lightning Page with Lightning App Builder\nOpens the specified Lightning Page in Lightning App Builder. Lightning Page files have the suffix .flexipage-meta.xml, and are stored in the flexipages directory. If you specify a different type of file, this command opens your org’s home page.",
3+
"examples": [
4+
"$ sfdx force:source:open -f path/to/source",
5+
"$ sfdx force:source:open -r -f path/to/source",
6+
"$ sfdx force:source:open -f path/to/source -u my-user@my-org.com"
7+
],
8+
"flags": {
9+
"sourcefile": "(required) file to edit",
10+
"urlonly": "generate a navigation URL; don’t launch the editor"
11+
},
12+
"SourceOpenFileDescription": "file to edit",
13+
"SourceOpenPathDescription": "generate a navigation URL; don’t launch the editor",
14+
"SourceOpenCommandHumanSuccess": "Access org %s as user %s with the following URL: %s",
15+
"SourceOpenCommandTimeoutError": "Timeout error",
16+
"SourceOpenCommandError": "Open failed"
17+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"@salesforce/source-deploy-retrieve": "^4.0.1",
1212
"chalk": "^4.1.1",
1313
"cli-ux": "^5.6.3",
14+
"open": "^8.2.1",
1415
"tslib": "^2"
1516
},
1617
"devDependencies": {

0 commit comments

Comments
 (0)