Skip to content

Commit

Permalink
Merge pull request #573 from salesforcecli/mdonnalley/bump-sf-plugins…
Browse files Browse the repository at this point in the history
…-core

feat: bump sf-plugins-core
  • Loading branch information
mdonnalley authored Mar 25, 2024
2 parents e977d3c + a6468e2 commit fc8d63c
Show file tree
Hide file tree
Showing 8 changed files with 227 additions and 37 deletions.
196 changes: 194 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,200 @@ sf plugins

<!-- commands -->

# Command Topics
- [`sf schema generate field`](#sf-schema-generate-field)
- [`sf schema generate platformevent`](#sf-schema-generate-platformevent)
- [`sf schema generate sobject`](#sf-schema-generate-sobject)
- [`sf schema generate tab`](#sf-schema-generate-tab)

- [`sf schema`](docs/schema.md) - Generate metadata files.
## `sf schema generate field`

Generate metadata source files for a new custom field on a specified object.

```
USAGE
$ sf schema generate field -l <value> [--flags-dir <value>] [-o <value>]
FLAGS
-l, --label=<value> (required) The field's label.
-o, --object=<value> The directory that contains the object's source files.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
DESCRIPTION
Generate metadata source files for a new custom field on a specified object.
This command is interactive and must be run in a Salesforce DX project directory. You're required to specify the
field's label with the "--label" flag. The command uses this label to provide intelligent suggestions for other field
properties, such as its API name.
You can generate a custom field on either a standard object, such as Account, or a custom object. In both cases, the
source files for the object must already exist in your local project before you run this command. If you create a
relationship field, the source files for the parent object must also exist in your local directory. Use the command
"sf metadata retrieve -m CustomObject:<object>" to retrieve source files for both standard and custom objects from
your org. To create a custom object, run the "sf generate metadata sobject" command or use the Object Manager UI in
your Salesforce org.
ALIASES
$ sf generate metadata field
EXAMPLES
Create a field with the specified label; the command prompts you for the object:
$ sf schema generate field --label "My Field"
Specify the local path to the object's folder:
$ sf schema generate field --label "My Field" --object force-app/main/default/objects/MyObject__c
FLAG DESCRIPTIONS
-o, --object=<value> The directory that contains the object's source files.
The object source files in your local project are grouped in a directoy with the same name as the object. Custom
object names always end in "__c". An example of the object directory for the Account standard object is
"force-app/main/default/objects/Account" An example custom object directory is
"force-app/main/default/objects/MyObject__c"
If you don't specify this flag, the command prompts you to choose from your local objects.
```

_See code: [src/commands/schema/generate/field.ts](https://github.com/salesforcecli/plugin-sobject/blob/1.1.21/src/commands/schema/generate/field.ts)_

## `sf schema generate platformevent`

Generate metadata source files for a new platform event.

```
USAGE
$ sf schema generate platformevent -l <value> [--flags-dir <value>]
FLAGS
-l, --label=<value> (required) The platform event's label.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
DESCRIPTION
Generate metadata source files for a new platform event.
This command is interactive and must be run in a Salesforce DX project directory. You're required to specify the
event's label with the "--label" flag. The command uses this label to provide intelligent suggestions for other event
properties, such as its API name.
ALIASES
$ sf generate metadata platformevent
EXAMPLES
Create a platform event with the specified label:
$ sf schema generate platformevent --label "My Platform Event"
```

_See code: [src/commands/schema/generate/platformevent.ts](https://github.com/salesforcecli/plugin-sobject/blob/1.1.21/src/commands/schema/generate/platformevent.ts)_

## `sf schema generate sobject`

Generate metadata source files for a new custom object.

```
USAGE
$ sf schema generate sobject -l <value> [--flags-dir <value>] [-f]
FLAGS
-f, --use-default-features Enable all optional features without prompting.
-l, --label=<value> (required) The custom object's label.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
DESCRIPTION
Generate metadata source files for a new custom object.
This command is interactive and must be run in a Salesforce DX project directory. You're required to specify the
object's label with the "--label" flag. The command uses this label to provide intelligent suggestions for other
object properties, such as its API name and plural label.
All Salesforce objects are required to have a Name field, so this command also prompts you for the label and type of
the Name field. Run the "sf metadata generate field" command to create additional fields for the object.
To reduce the number of prompts, use the "--use-default-features" flag to automatically enable some features, such as
reporting and search on the object.
ALIASES
$ sf generate metadata sobject
EXAMPLES
Create a custom object with the specified label and be prompted for additional information:
$ sf schema generate sobject --label "My Object"
Create a custom object and enable optional features without prompting:
$ sf schema generate sobject --label "My Object" --use-default-features
FLAG DESCRIPTIONS
-f, --use-default-features Enable all optional features without prompting.
Enables these features:
- Search: Allows users to find the custom object's records when they search, including SOSL.
- Feeds: Enables feed tracking.
- Reports: Allows reporting of the data in the custom object records.
- History: Enables object history tracking.
- Activities: Allows users to associate tasks and scheduled calendar events related to the custom object records.
- Bulk API: With Sharing and Streaming API, classifies the custom object as an Enterprise Application object.
- Sharing: With Bulk API and Streaming API, classifies the custom object as an Enterprise Application object.
- Streaming API: With Bulk API and Sharing, classifies the custom object as an Enterprise Application object.
```

_See code: [src/commands/schema/generate/sobject.ts](https://github.com/salesforcecli/plugin-sobject/blob/1.1.21/src/commands/schema/generate/sobject.ts)_

## `sf schema generate tab`

Generate the metadata source files for a new custom tab on a custom object.

```
USAGE
$ sf schema generate tab -o <value> -d <value> -i <value> [--json] [--flags-dir <value>]
FLAGS
-d, --directory=<value> (required) Path to a "tabs" directory that will contain the source files for your new tab.
-i, --icon=<value> (required) [default: 1] Number from 1 to 100 that specifies the color scheme and icon for the
custom tab.
-o, --object=<value> (required) API name of the custom object you're generating a tab for.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Generate the metadata source files for a new custom tab on a custom object.
Custom tabs let you display custom object data or other web content in Salesforce. Custom tabs appear in Salesforce as
an item in the app’s navigation bar and in the App Launcher.
This command must be run in a Salesforce DX project directory. You must pass all required information to it with the
required flags. The source files for the custom object for which you're generating a tab don't need to exist in your
local project.
ALIASES
$ sf generate metadata tab
EXAMPLES
Create a tab on the `MyObject__c` custom object:
$ sf schema generate tab --object `MyObject__c` --icon 54 --directory force-app/main/default/tabs
FLAG DESCRIPTIONS
-i, --icon=<value> Number from 1 to 100 that specifies the color scheme and icon for the custom tab.
See https://lightningdesignsystem.com/icons/#custom for the available icons.
-o, --object=<value> API name of the custom object you're generating a tab for.
The API name for a custom object always ends in `__c`, such as `MyObject__c`.
```

_See code: [src/commands/schema/generate/tab.ts](https://github.com/salesforcecli/plugin-sobject/blob/1.1.21/src/commands/schema/generate/tab.ts)_

<!-- commandsstop -->
32 changes: 16 additions & 16 deletions command-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
[
{
"command": "schema:generate:field",
"plugin": "@salesforce/plugin-sobject",
"flags": ["label", "object"],
"alias": ["generate:metadata:field"],
"command": "schema:generate:field",
"flagAliases": [],
"flagChars": ["l", "o"],
"flagAliases": []
"flags": ["flags-dir", "label", "object"],
"plugin": "@salesforce/plugin-sobject"
},
{
"command": "schema:generate:platformevent",
"plugin": "@salesforce/plugin-sobject",
"flags": ["label"],
"alias": ["generate:metadata:platformevent"],
"command": "schema:generate:platformevent",
"flagAliases": [],
"flagChars": ["l"],
"flagAliases": []
"flags": ["flags-dir", "label"],
"plugin": "@salesforce/plugin-sobject"
},
{
"command": "schema:generate:sobject",
"plugin": "@salesforce/plugin-sobject",
"flags": ["label", "use-default-features"],
"alias": ["generate:metadata:sobject"],
"command": "schema:generate:sobject",
"flagAliases": [],
"flagChars": ["f", "l"],
"flagAliases": []
"flags": ["flags-dir", "label", "use-default-features"],
"plugin": "@salesforce/plugin-sobject"
},
{
"command": "schema:generate:tab",
"plugin": "@salesforce/plugin-sobject",
"flags": ["directory", "icon", "json", "object"],
"alias": ["generate:metadata:tab"],
"command": "schema:generate:tab",
"flagAliases": [],
"flagChars": ["d", "i", "o"],
"flagAliases": []
"flags": ["directory", "flags-dir", "icon", "json", "object"],
"plugin": "@salesforce/plugin-sobject"
}
]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@oclif/core": "^3.25.2",
"@salesforce/core": "^6.7.3",
"@salesforce/kit": "^3.0.15",
"@salesforce/sf-plugins-core": "^7.1.14",
"@salesforce/sf-plugins-core": "^8.0.1",
"fast-glob": "^3.3.2",
"fast-xml-parser": "^4.3.6",
"js2xmlparser": "^4.0.2"
Expand Down
4 changes: 2 additions & 2 deletions src/commands/schema/generate/tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
*/

import fs from 'node:fs';
import path from 'node:path'
import path from 'node:path';

import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
import { Messages } from '@salesforce/core';
import type { CustomTab } from 'jsforce/api/metadata';
import { isTabsFolder } from '../../../shared/flags.js';
import { convertJsonToXml } from '../../../shared/convert.js';

Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@salesforce/plugin-sobject', 'generate.tab');

export type GenerateTabResult = {
Expand Down
4 changes: 2 additions & 2 deletions test/nuts/fs.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import path from 'node:path';
import fs from 'node:fs';
import path from 'node:path';
import fs from 'node:fs';
import { TestSession } from '@salesforce/cli-plugins-testkit';
import { expect } from 'chai';
import {
Expand Down
4 changes: 2 additions & 2 deletions test/shared/flags.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import {join, sep, resolve} from 'node:path';
import { join, sep, resolve } from 'node:path';

import { expect } from 'chai';
import { Messages, SfError } from '@salesforce/core';
import { labelValidation, isObjectsFolder, isTabsFolder } from '../../src/shared/flags.js';

Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@salesforce/plugin-sobject', 'flags');

describe('flag tests', () => {
Expand Down
6 changes: 2 additions & 4 deletions test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"extends": "@salesforce/dev-config/tsconfig-test-strict-esm",
"include": [
"./**/*.ts"
],
"include": ["./**/*.ts"],
"compilerOptions": {
"skipLibCheck": true
}
}
}
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@oclif/[email protected]", "@oclif/core@^3.15.1", "@oclif/core@^3.19.1", "@oclif/core@^3.19.2", "@oclif/core@^3.19.6", "@oclif/core@^3.21.0", "@oclif/core@^3.23.0", "@oclif/core@^3.25.2":
"@oclif/[email protected]", "@oclif/core@^3.15.1", "@oclif/core@^3.19.1", "@oclif/core@^3.19.2", "@oclif/core@^3.21.0", "@oclif/core@^3.23.0", "@oclif/core@^3.25.2":
version "3.26.0"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-3.26.0.tgz#959d5e9f13f4ad6a4e98235ad125189df9ee4279"
integrity sha512-TpMdfD4tfA2tVVbd4l0PrP02o5KoUXYmudBbTC7CeguDo/GLoprw4uL8cMsaVA26+cbcy7WYtOEydQiHVtJixA==
Expand Down Expand Up @@ -1390,7 +1390,7 @@
strip-ansi "6.0.1"
ts-retry-promise "^0.8.0"

"@salesforce/core@^6.4.1", "@salesforce/core@^6.5.3", "@salesforce/core@^6.6.0", "@salesforce/core@^6.7.0", "@salesforce/core@^6.7.3":
"@salesforce/core@^6.4.1", "@salesforce/core@^6.5.3", "@salesforce/core@^6.7.0", "@salesforce/core@^6.7.3":
version "6.7.3"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-6.7.3.tgz#5d8f30c40ac3cebb898c8e845fe9a067bc729268"
integrity sha512-uU+PuZZGXxByhvnXLH1V3eY5P1caw401dIZ/QvhzYxoP/alPLk7dpChnZNJYH5Rw3dc/AhSPw+eg0cvUyjhP1Q==
Expand Down Expand Up @@ -1496,15 +1496,15 @@
chalk "^4"
inquirer "^8.2.5"

"@salesforce/sf-plugins-core@^7.1.14":
version "7.1.14"
resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-7.1.14.tgz#5f07316a602b4c5d44c09bc74c294d7df9e2e260"
integrity sha512-KDX9vYDeVOkozRrsjVh4Pvzay++7bWWKmaHtGOwkZrBHb3mVEdCp0ryF0WaDTfaEvgNKn7kiZEDSO7oEhJSzug==
"@salesforce/sf-plugins-core@^8.0.1":
version "8.0.1"
resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-8.0.1.tgz#f155cddfd7695aab0d8264848b634b2a91cdbf2c"
integrity sha512-R6SqJ1XqSINSWdZruKtC2SKGnLBh7KbFI7+qS0FYlyPU4IlWoa+AZkGwWvlczuSOumqnlhT95rNKwZTS5rJugA==
dependencies:
"@inquirer/confirm" "^2.0.17"
"@inquirer/password" "^1.1.16"
"@oclif/core" "^3.19.6"
"@salesforce/core" "^6.6.0"
"@oclif/core" "^3.23.0"
"@salesforce/core" "^6.7.3"
"@salesforce/kit" "^3.0.15"
"@salesforce/ts-types" "^2.0.9"
chalk "^5.3.0"
Expand Down

0 comments on commit fc8d63c

Please sign in to comment.