Skip to content

Commit e25b209

Browse files
committed
feat(salesforcecli): updating snapshot
1 parent 73b93ca commit e25b209

File tree

8 files changed

+35
-24
lines changed

8 files changed

+35
-24
lines changed

command-snapshot.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
{
33
"command": "basecommand",
44
"plugin": "@salesforce/plugin-omnistudio-migration-tool",
5-
"flags": ["apiversion", "json", "loglevel", "targetusername", "allversions"],
5+
"flags": ["apiversion", "json", "loglevel", "targetusername"],
66
"alias": []
77
},
88
{
99
"command": "omnistudio:migration:info",
1010
"plugin": "@salesforce/plugin-omnistudio-migration-tool",
11-
"flags": ["apiversion", "json", "loglevel", "name", "targetdevhubusername", "targetusername", "allversions"],
11+
"flags": ["apiversion", "json", "loglevel", "name", "targetdevhubusername", "targetusername"],
1212
"alias": []
1313
},
1414
{
1515
"command": "omnistudio:migration:migrate",
1616
"plugin": "@salesforce/plugin-omnistudio-migration-tool",
17-
"flags": ["apiversion", "json", "loglevel", "namespace", "only", "targetusername", "allversions"],
17+
"flags": ["allversions", "apiversion", "json", "loglevel", "namespace", "only", "targetusername"],
1818
"alias": []
1919
}
2020
]

messages/info.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"examples": [
77
"sfdx omnistudio:migration:info --targetusername [email protected] --targetdevhubusername [email protected]",
88
"sfdx omnistudio:migration:info --name myname --targetusername [email protected]"
9-
]
10-
}
9+
],
10+
"allVersionsDescription": "Migrate all versions of a component"
11+
}

messages/migrate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
"errorWhileActivatingCard": "Could not activate Card: ",
2626
"errorWhileUploadingCard": "An error ocurred while uploading Card: ",
2727
"errorWhileCreatingElements": "An error ocurred while saving OmniScript elements: ",
28-
"allVersionsDescription": "Migrate all versions of a component, not just the active version"
28+
"allVersionsDescription": "Migrate all versions of a component"
2929
}

src/commands/omnistudio/migration/info.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ export default class Org extends SfdxCommand {
2929
char: 'n',
3030
description: messages.getMessage('nameFlagDescription'),
3131
}),
32+
allversions: flags.boolean({
33+
char: 'a',
34+
description: messages.getMessage('allVersionsDescription'),
35+
required: false,
36+
}),
3237
};
3338

3439
// Comment this out if your command does not require an org username
@@ -42,6 +47,8 @@ export default class Org extends SfdxCommand {
4247

4348
public async run(): Promise<AnyJson> {
4449
const name = (this.flags.name || 'world') as string;
50+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
51+
const allVersions = this.flags.allversions || false;
4552

4653
// this.org is guaranteed because requiresUsername=true, as opposed to supportsUsername
4754
const conn = this.org.getConnection();
@@ -79,6 +86,10 @@ export default class Org extends SfdxCommand {
7986
this.ux.log(`My hub org id is: ${hubOrgId}`);
8087
}
8188

89+
if (allVersions) {
90+
outputString = `${outputString} and all versions will be migrated`;
91+
}
92+
8293
// Return an object to be displayed with --json
8394
return { orgId: this.org.getOrgId(), outputString };
8495
}

src/utils/prototypes.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
/* eslint-disable */
2-
String.prototype.formatUnicorn = String.prototype.formatUnicorn ||
3-
function () {
4-
"use strict";
2+
String.prototype.formatUnicorn =
3+
String.prototype.formatUnicorn ||
4+
function () {
5+
'use strict';
56
var str = this.toString();
67
if (arguments.length) {
7-
var t = typeof arguments[0];
8-
var key;
9-
var args = ("string" === t || "number" === t) ?
10-
Array.prototype.slice.call(arguments)
11-
: arguments[0];
8+
var t = typeof arguments[0];
9+
var key;
10+
var args = 'string' === t || 'number' === t ? Array.prototype.slice.call(arguments) : arguments[0];
1211

13-
for (key in args) {
14-
str = str.replace(new RegExp("\\{" + key + "\\}", "gi"), args[key]);
15-
}
12+
for (key in args) {
13+
str = str.replace(new RegExp('\\{' + key + '\\}', 'gi'), args[key]);
14+
}
1615
}
1716

1817
return str;
19-
};
18+
};

test/commands/omnistudio/migration/info.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ describe('omnistudio:migration:info', () => {
1919
return Promise.resolve({ records: [] });
2020
})
2121
.stdout()
22-
.command(['omnistudio:migration:info', '--targetusername', '[email protected]'])
23-
.it('runs omnistudio:migration:info --targetusername [email protected]', (ctx) => {
22+
.command(['omnistudio:migration:info', '--targetusername', '[email protected]', '--allversions'])
23+
.it('runs omnistudio:migration:info --targetusername [email protected] --allversions', (ctx) => {
2424
expect(ctx.stdout).to.contain(
2525
'Hello world! This is org: Super Awesome Org and I will be around until Tue Mar 20 2018!'
2626
);

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
"rootDir": "./src",
66
"esModuleInterop": true
77
},
8-
"include": ["./src/**/*.ts"]
8+
"include": ["./src/**/*.ts", "./src/prototypes.d.ts"]
99
}

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,9 +1800,9 @@ camelcase@^6.0.0:
18001800
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
18011801

18021802
caniuse-lite@^1.0.30001312:
1803-
version "1.0.30001312"
1804-
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001312.tgz"
1805-
integrity sha512-Wiz1Psk2MEK0pX3rUzWaunLTZzqS2JYZFzNKqAiJGiuxIjRPLgV6+VDPOg6lQOUxmDwhTlh198JsTTi8Hzw6aQ==
1803+
version "1.0.30001559"
1804+
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001559.tgz"
1805+
integrity sha512-cPiMKZgqgkg5LY3/ntGeLFUpi6tzddBNS58A4tnTgQw1zON7u2sZMU7SzOeVH4tj20++9ggL+V6FDOFMTaFFYA==
18061806

18071807
capital-case@^1.0.4:
18081808
version "1.0.4"

0 commit comments

Comments
 (0)