Skip to content

Commit 5dfa877

Browse files
Sm/sf command (#542)
* refactor: sfCommand (and all nuts pass) * feat: use sfComand * docs: message conversion * test: ut conversion * refactor: share sandboxRequest * test: ut conversion for status * test: ut all work * fix: aliases and default markings * chore: todo cleanup * chore: consistent api-version and loglevel * feat: deprecate 4 commands, remove beta * feat: sf-ify 3 commands * chore: bump linter * docs: don't put versions for deprecations * chore: bump plugins-ore * chore: snapshots and schemas * chore: org topic * chore: bump dep * chore: linter updates * test: temporarily remove deprecation for UT reasons * docs: sf-ify messages * feat: add commands from plugin-env as is for comparison * feat: refactor commands * test: refactor tests * chore: schema * chore: snapshot * test: original org nuts pass because aliases. + new schemas * test: all NUTs passing * refactor: reduce eslint pragma * chore: snapshot * feat: faster org:list via parallelization * chore: sfCommand subscribes lifecycleEvents automatically * refactor: non-case-sensitive alias sorting * refactor: simplify default markers * docs: extract message, use new command format * test: windows paths without ./ * test: powershell command-ref * test: comspec absolute path * test: another comspec attempt * test: try yarn config to set shell for windows * docs: todo reminder * test: try compspec env * test: escape and quote for windoze * test: quote the full path * fix: (windows) handle undefined username * chore: bump dev-scripts * test: test all the things * test: wireit windows cache wth longer nut timeout * chore: test-compile not a dependency * chore: bump dev-scripts, fix pjson * test: organize tests * chore: bump wireit/pjson * test: [sb-nuts] * chore: reorganize NUTs * test: parallelize NUTs more * test: fix import paths * test: wireit on ghw/main * test: all sbox nuts pass locally * test: sandbox-nuts as on-demand workflow * test: correct nuts path * chore: get script name right * docs: readme comment about sbnuts [no-ci] * test: keep sbox status nut from using nuts from other sbox nuts * chore: longer waits on org create to prevent nut re-runs * test: use default waits * test: sbox doesn't catch mocha assert errors [skip-ci] * test: tracing windows NUT failure [no ci] * test: no single quotes in windows [no ci] * chore: bump dev-scripts * test: nut imports messages it depends on * chore: bump core for type change on Snapshot * fix: message was wrong when it came over from plugin-env * fix: clean up the messages * fix: set version of command-ref plugin that ignores missing descriptions * fix: new yarn.lock * chore: deprecation message for force:org:create * docs: resolve comments and sf env references * fix: message placeholder checks * chore: remove oclif/test * docs: remove bin references from commands * chore: bump oclif core, bin into message placeholders * chore: get action tokens right * test: remove deprecation (pending oclif bug) * chore: lockfile dedupe * fix: stopSpinner to avoid oclif bug * refactor: isObject instead of filtering out the undefined --------- Co-authored-by: Juliet Shackell <[email protected]>
1 parent 4aae6ab commit 5dfa877

File tree

111 files changed

+8715
-3592
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+8715
-3592
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77
module.exports = {
8-
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license'],
8+
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license', 'plugin:sf-plugin/recommended'],
99
};

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
uses: salesforcecli/github-workflows/.github/workflows/unitTestsLinux.yml@main
1414
windows-unit-tests:
1515
needs: linux-unit-tests
16+
# TODO: use main
1617
uses: salesforcecli/github-workflows/.github/workflows/unitTestsWindows.yml@main
1718
nuts:
1819
needs: linux-unit-tests
@@ -21,6 +22,8 @@ jobs:
2122
strategy:
2223
matrix:
2324
os: [ubuntu-latest, windows-latest]
25+
command: ['yarn test:nuts', 'yarn test:nuts:legacy']
2426
fail-fast: false
2527
with:
2628
os: ${{ matrix.os }}
29+
command: ${{ matrix.command}}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ docs
3131
package.json.bak.
3232

3333
# -- CLEAN ALL
34+
*.tsbuildinfo
35+
.eslintcache
36+
.wireit
3437
node_modules
3538

3639
# --

CHANGELOG.md

Lines changed: 97 additions & 302 deletions
Large diffs are not rendered by default.

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2022, Salesforce.com, Inc.
1+
Copyright (c) 2023, Salesforce.com, Inc.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ sfdx plugins:link .
7474
sfdx plugins
7575
```
7676

77+
### Sandbox NUTs
78+
79+
Sandboxes are pretty slow, and there's a constraint to how many we can have. So if your changes might impact sandboxes, and you want to check those in the real world, run the [SandboxNuts](https://github.com/salesforcecli/plugin-org/actions/workflows/sandboxNuts.yml) Github Action.
80+
7781
## Commands
7882

7983
<!-- commands -->

command-snapshot.json

Lines changed: 82 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
"command": "force:org:clone",
44
"plugin": "@salesforce/plugin-org",
55
"flags": [
6-
"apiversion",
6+
"api-version",
77
"definitionfile",
88
"json",
99
"loglevel",
1010
"setalias",
1111
"setdefaultusername",
12-
"targetusername",
12+
"target-org",
1313
"type",
1414
"wait"
1515
],
@@ -19,7 +19,7 @@
1919
"command": "force:org:create",
2020
"plugin": "@salesforce/plugin-org",
2121
"flags": [
22-
"apiversion",
22+
"api-version",
2323
"clientid",
2424
"definitionfile",
2525
"durationdays",
@@ -30,50 +30,106 @@
3030
"retry",
3131
"setalias",
3232
"setdefaultusername",
33-
"targetdevhubusername",
34-
"targetusername",
33+
"target-dev-hub",
34+
"target-org",
3535
"type",
3636
"wait"
3737
],
38-
"alias": ["force:org:beta:create"]
39-
},
40-
{
41-
"command": "force:org:delete",
42-
"plugin": "@salesforce/plugin-org",
43-
"flags": ["apiversion", "json", "loglevel", "noprompt", "targetdevhubusername", "targetusername"],
4438
"alias": []
4539
},
4640
{
47-
"command": "force:org:display",
41+
"command": "force:org:delete",
4842
"plugin": "@salesforce/plugin-org",
49-
"flags": ["apiversion", "json", "loglevel", "targetusername", "verbose"],
43+
"flags": ["api-version", "json", "loglevel", "no-prompt", "target-org"],
5044
"alias": []
5145
},
5246
{
53-
"command": "force:org:list",
47+
"command": "force:org:status",
5448
"plugin": "@salesforce/plugin-org",
55-
"flags": ["all", "clean", "json", "loglevel", "noprompt", "skipconnectionstatus", "verbose"],
49+
"flags": ["api-version", "json", "loglevel", "sandboxname", "setalias", "setdefaultusername", "target-org", "wait"],
5650
"alias": []
5751
},
5852
{
59-
"command": "force:org:open",
53+
"command": "org:create:sandbox",
6054
"plugin": "@salesforce/plugin-org",
61-
"flags": ["apiversion", "browser", "json", "loglevel", "path", "targetusername", "urlonly"],
62-
"alias": []
55+
"flags": [
56+
"alias",
57+
"async",
58+
"clone",
59+
"definition-file",
60+
"json",
61+
"license-type",
62+
"name",
63+
"no-prompt",
64+
"no-track-source",
65+
"poll-interval",
66+
"set-default",
67+
"target-org",
68+
"wait"
69+
],
70+
"alias": ["env:create:sandbox"]
6371
},
6472
{
65-
"command": "force:org:status",
73+
"command": "org:create:scratch",
6674
"plugin": "@salesforce/plugin-org",
6775
"flags": [
68-
"apiversion",
76+
"alias",
77+
"api-version",
78+
"async",
79+
"client-id",
80+
"definition-file",
81+
"duration-days",
82+
"edition",
6983
"json",
70-
"loglevel",
71-
"sandboxname",
72-
"setalias",
73-
"setdefaultusername",
74-
"targetusername",
84+
"no-ancestors",
85+
"no-namespace",
86+
"set-default",
87+
"target-dev-hub",
88+
"track-source",
7589
"wait"
7690
],
77-
"alias": []
91+
"alias": ["env:create:scratch"]
92+
},
93+
{
94+
"command": "org:delete:sandbox",
95+
"plugin": "@salesforce/plugin-org",
96+
"flags": ["json", "no-prompt", "target-org"],
97+
"alias": ["env:delete:sandbox"]
98+
},
99+
{
100+
"command": "org:delete:scratch",
101+
"plugin": "@salesforce/plugin-org",
102+
"flags": ["json", "no-prompt", "target-org"],
103+
"alias": ["env:delete:scratch"]
104+
},
105+
{
106+
"command": "org:display",
107+
"plugin": "@salesforce/plugin-org",
108+
"flags": ["api-version", "json", "loglevel", "target-org", "verbose"],
109+
"alias": ["force:org:display"]
110+
},
111+
{
112+
"command": "org:list",
113+
"plugin": "@salesforce/plugin-org",
114+
"flags": ["all", "clean", "json", "loglevel", "no-prompt", "skip-connection-status", "verbose"],
115+
"alias": ["force:org:list"]
116+
},
117+
{
118+
"command": "org:open",
119+
"plugin": "@salesforce/plugin-org",
120+
"flags": ["api-version", "browser", "json", "loglevel", "path", "target-org", "url-only"],
121+
"alias": ["force:org:open"]
122+
},
123+
{
124+
"command": "org:resume:sandbox",
125+
"plugin": "@salesforce/plugin-org",
126+
"flags": ["job-id", "json", "name", "target-org", "use-most-recent", "wait"],
127+
"alias": ["env:resume:sandbox"]
128+
},
129+
{
130+
"command": "org:resume:scratch",
131+
"plugin": "@salesforce/plugin-org",
132+
"flags": ["job-id", "json", "use-most-recent"],
133+
"alias": ["env:resume:scratch"]
78134
}
79135
]

messages/clone.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

messages/clone.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# summary
2+
3+
Clone a sandbox org.
4+
5+
# success
6+
7+
The sandbox org cloning process %s is in progress. Run "sfdx force:org:status -n %s" to check for status. If the org is ready, checking the status also logs the requesting user in to the sandbox org and authorizes the org for use with Salesforce CLI.
8+
9+
# description
10+
11+
There are two ways to clone a sandbox: either specify a sandbox definition file or provide key=value pairs at the command line. Key-value pairs at the command-line override their equivalent sandbox definition file values. In either case, you must specify both the "SandboxName" and "SourceSandboxName" options to set the names of the new sandbox and the one being cloned, respectively.
12+
13+
Set the --targetusername (-u) parameter to a production org with sandbox licenses. The --type (-t) parameter is required and must be set to "sandbox".
14+
15+
# examples
16+
17+
- $ <%= config.bin %> <%= command.id %> -t sandbox -f config/dev-sandbox-def.json -u prodOrg -a MyDevSandbox
18+
19+
- $ <%= config.bin %> <%= command.id %> -t sandbox SandboxName=NewClonedSandbox SourceSandboxName=ExistingSandbox -u prodOrg -a MyDevSandbox
20+
21+
# flags.type
22+
23+
Type of org to create.
24+
25+
# flags.wait
26+
27+
Number of minutes to wait while polling for status.
28+
29+
# flags.setdefaultusername
30+
31+
Set the cloned org as your default.
32+
33+
# flags.setalias
34+
35+
Alias for the cloned org.
36+
37+
# flags.definitionfile
38+
39+
Path to the sandbox definition file.
40+
41+
# flagsLong.wait
42+
43+
Sets the streaming client socket timeout, in minutes. If the streaming client socket has no contact from the server for a number of minutes, the client exits. Specify a longer wait time if timeouts occur frequently.
44+
45+
# commandSuccess
46+
47+
The sandbox org cloning process %s is in progress. Run "sfdx force:org:status -n %s" to check for status. If the org is ready, checking the status also logs the requesting user in to the sandbox org and authorizes the org for use with Salesforce CLI.
48+
49+
# missingLicenseType
50+
51+
The sandbox license type is required, but you didn't provide a value. Specify the license type in the sandbox definition file with the "licenseType" option, or specify the option as a name-value pair at the command-line. See https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_sandbox_definition.htm for more information.
52+
53+
# commandOrganizationTypeNotSupport
54+
55+
The only supported org type is: %s
56+
57+
# commandOrganizationTypeNotSupportAction
58+
59+
force:org:clone -t %s
60+
61+
# missingSourceSandboxName
62+
63+
Specify a value for %s in a definition file or on the command line.
64+
65+
# missingSourceSandboxNameAction
66+
67+
To indicate which sandbox org you want to clone, specify %s in a definition file or as a command line argument.

messages/create.json

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)