@marsson/ciutils 0.1.0 โ†’ 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,260 +1,142 @@
1
- # ciutils
1
+ # SF-CIUtils: Salesforce CI/CD Utilities ๐Ÿš€
2
2
 
3
- [![NPM](https://img.shields.io/npm/v/ciutils.svg?label=ciutils)](https://www.npmjs.com/package/ciutils) [![Downloads/week](https://img.shields.io/npm/dw/ciutils.svg)](https://npmjs.org/package/ciutils) [![License](https://img.shields.io/badge/License-BSD%203--Clause-brightgreen.svg)](https://raw.githubusercontent.com/salesforcecli/ciutils/main/LICENSE.txt)
3
+ [![NPM](https://img.shields.io/npm/v/@marsson/ciutils.svg?label=@marsson/ciutils)](https://www.npmjs.com/package/@marsson/ciutils)
4
+ [![Downloads/week](https://img.shields.io/npm/dw/@marsson/ciutils.svg)](https://npmjs.org/package/@marsson/ciutils)
5
+ [![License](https://img.shields.io/badge/License-BSD%203--Clause-brightgreen.svg)](https://raw.githubusercontent.com/salesforcecli/ciutils/main/LICENSE.txt)
6
+ [![codecov](https://codecov.io/gh/marsson/sf-ciutils/branch/main/graph/badge.svg)](https://codecov.io/gh/marsson/sf-ciutils)
4
7
 
5
- ## Using the template
8
+ ## ๐ŸŒŸ What is SF-CIUtils?
6
9
 
7
- This repository provides a template for creating a plugin for the Salesforce CLI. To convert this template to a working plugin:
10
+ SF-CIUtils is a powerful toolkit for Salesforce developers who want to supercharge their CI/CD workflows! This plugin for the Salesforce CLI provides essential utilities that make continuous integration and deployment with Salesforce a breeze.
8
11
 
9
- 1. Please get in touch with the Platform CLI team. We want to help you develop your plugin.
10
- 2. Generate your plugin:
12
+ Think of it as your Swiss Army knife for Salesforce CI/CD operations - whether you're validating repository metadata, monitoring deployments, managing file uploads, or handling user permissions, SF-CIUtils has got you covered!
11
13
 
12
- ```
13
- sf plugins install dev
14
- sf dev generate plugin
15
-
16
- git init -b main
17
- git add . && git commit -m "chore: initial commit"
18
- ```
19
-
20
- 3. Create your plugin's repo in the salesforcecli github org
21
- 4. When you're ready, replace the contents of this README with the information you want.
22
-
23
- ## Learn about `sf` plugins
24
-
25
- Salesforce CLI plugins are based on the [oclif plugin framework](<(https://oclif.io/docs/introduction.html)>). Read the [plugin developer guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_plugins.meta/sfdx_cli_plugins/cli_plugins_architecture_sf_cli.htm) to learn about Salesforce CLI plugin development.
26
-
27
- This repository contains a lot of additional scripts and tools to help with general Salesforce node development and enforce coding standards. You should familiarize yourself with some of the [node developer packages](#tooling) used by Salesforce.
28
-
29
- Additionally, there are some additional tests that the Salesforce CLI will enforce if this plugin is ever bundled with the CLI. These test are included by default under the `posttest` script and it is required to keep these tests active in your plugin if you plan to have it bundled.
30
-
31
- ### Tooling
32
-
33
- - [@salesforce/core](https://github.com/forcedotcom/sfdx-core)
34
- - [@salesforce/kit](https://github.com/forcedotcom/kit)
35
- - [@salesforce/sf-plugins-core](https://github.com/salesforcecli/sf-plugins-core)
36
- - [@salesforce/ts-types](https://github.com/forcedotcom/ts-types)
37
- - [@salesforce/ts-sinon](https://github.com/forcedotcom/ts-sinon)
38
- - [@salesforce/dev-config](https://github.com/forcedotcom/dev-config)
39
- - [@salesforce/dev-scripts](https://github.com/forcedotcom/dev-scripts)
40
-
41
- ### Hooks
42
-
43
- For cross clouds commands, e.g. `sf env list`, we utilize [oclif hooks](https://oclif.io/docs/hooks) to get the relevant information from installed plugins.
44
-
45
- This plugin includes sample hooks in the [src/hooks directory](src/hooks). You'll just need to add the appropriate logic. You can also delete any of the hooks if they aren't required for your plugin.
46
-
47
- # Everything past here is only a suggestion as to what should be in your specific plugin's description
14
+ ## โœจ Features
48
15
 
49
- This plugin is bundled with the [Salesforce CLI](https://developer.salesforce.com/tools/sfdxcli). For more information on the CLI, read the [getting started guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_intro.htm).
16
+ - **Validate Repository Metadata**: Compare your local metadata with what's in your org to catch metadata drift
17
+ - **Report on Deployments**: Get detailed, real-time information about your deployments
18
+ - **Create Files**: Upload files to Salesforce with ease
19
+ - **Remove Assignments**: Efficiently manage permission sets, permission set groups, and group assignments
50
20
 
51
- We always recommend using the latest version of these commands bundled with the CLI, however, you can install a specific version or tag if needed.
52
-
53
- ## Install
21
+ ## ๐Ÿš€ Installation
54
22
 
55
23
  ```bash
56
- sf plugins install ciutils@x.y.z
24
+ sf plugins install @marsson/ciutils
57
25
  ```
58
26
 
59
- ## Issues
60
-
61
- Please report any issues at https://github.com/forcedotcom/cli/issues
62
-
63
- ## Contributing
64
-
65
- 1. Please read our [Code of Conduct](CODE_OF_CONDUCT.md)
66
- 2. Create a new issue before starting your project so that we can keep track of
67
- what you are trying to add/fix. That way, we can also offer suggestions or
68
- let you know if there is already an effort in progress.
69
- 3. Fork this repository.
70
- 4. [Build the plugin locally](#build)
71
- 5. Create a _topic_ branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.
72
- 6. Edit the code in your fork.
73
- 7. Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.
74
- 8. Sign CLA (see [CLA](#cla) below).
75
- 9. Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.
27
+ Or install a specific version:
76
28
 
77
- ### CLA
29
+ ```bash
30
+ sf plugins install @marsson/ciutils@x.y.z
31
+ ```
78
32
 
79
- External contributors will be required to sign a Contributor's License
80
- Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.
33
+ ## ๐Ÿ”ง Commands
81
34
 
82
- ### Build
35
+ ### `sf validate repository metadata`
83
36
 
84
- To build the plugin locally, make sure to have yarn installed and run the following commands:
37
+ This command helps you validate your local metadata against what's in your Salesforce org. It's like having a detective that spots differences between your local files and what's actually deployed!
85
38
 
86
39
  ```bash
87
- # Clone the repository
88
- git clone git@github.com:salesforcecli/ciutils
89
-
90
- # Install the dependencies and compile
91
- yarn && yarn build
40
+ sf validate repository metadata --folder path/to/metadata --target-org your-org
92
41
  ```
93
42
 
94
- To use your plugin, run using the local `./bin/dev` or `./bin/dev.cmd` file.
43
+ **Example**: Check if your local Apex classes match what's in your production org:
95
44
 
96
45
  ```bash
97
- # Run using local run file.
98
- ./bin/dev hello world
46
+ sf validate repository metadata --folder force-app/main/default/classes --target-org production
99
47
  ```
100
48
 
101
- There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
49
+ ### `sf reporton deployment`
50
+
51
+ Keep an eye on your deployments with this command. It's like having a deployment dashboard right in your terminal!
102
52
 
103
53
  ```bash
104
- # Link your plugin to the sf cli
105
- sf plugins link .
106
- # To verify
107
- sf plugins
54
+ sf reporton deployment --deploymentid 0AfXXXXXXXXXXXXXXX --target-org your-org
108
55
  ```
109
56
 
110
- ## Commands
111
-
112
- <!-- commands -->
113
- * [`sf create file`](#sf-create-file)
114
- * [`sf remove assignments`](#sf-remove-assignments)
115
- * [`sf reporton deployment`](#sf-reporton-deployment)
116
- * [`sf validate repository metadata`](#sf-validate-repository-metadata)
117
-
118
- ## `sf create file`
119
-
120
- Upload a local file to an org.
57
+ **Example**: Monitor a deployment and wait for it to complete:
121
58
 
59
+ ```bash
60
+ sf reporton deployment --deploymentid 0AfXXXXXXXXXXXXXXX --target-org production --awaitcompletion
122
61
  ```
123
- USAGE
124
- $ sf create file -o <value> -f <value> [--json] [--flags-dir <value>] [--api-version <value>] [-t <value>] [-i
125
- <value>] [-c <value>]
126
-
127
- FLAGS
128
- -c, --created-date=<value> Datetime value in ISO 8601 format (e.g., 2024-08-09T15:30:00Z).
129
- -f, --file=<value> (required) Path of file to upload.
130
- -i, --parent-id=<value> ID of the record to attach the file to.
131
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
132
- configuration variable is already set.
133
- -t, --title=<value> New title given to the file (ContentDocument) after it's uploaded.
134
- --api-version=<value> Override the api version used for api requests made by this command
135
62
 
136
- GLOBAL FLAGS
137
- --flags-dir=<value> Import flag values from a directory.
138
- --json Format output as json.
63
+ ### `sf create file`
139
64
 
140
- DESCRIPTION
141
- Upload a local file to an org.
65
+ Upload files to your Salesforce org with this handy command. Perfect for adding documents, images, or any other files to your org!
142
66
 
143
- This command always creates a new file in the org; you can't update an existing file. After a successful upload, the
144
- command displays the ID of the new ContentDocument record which represents the uploaded file.
145
-
146
- By default, the uploaded file isn't attached to a record; in the Salesforce UI the file shows up in the Files tab. You
147
- can optionally attach the file to an existing record, such as an account, as long as you know its record ID.
148
-
149
- You can also give the file a new name after it's been uploaded; by default its name in the org is the same as the
150
- local file name.
151
-
152
- EXAMPLES
153
- Upload the local file "resources/astro.png" to your default org:
154
-
155
- $ sf create file --file resources/astro.png
156
-
157
- Give the file a different filename after it's uploaded to the org with alias "my-scratch":
158
-
159
- $ sf create file --file resources/astro.png --title AstroOnABoat.png --target-org my-scratch
160
-
161
- Attach the file to a record in the org:
162
-
163
- $ sf create file --file path/to/astro.png --parent-id a03fakeLoJWPIA3
67
+ ```bash
68
+ sf create file --file path/to/file --target-org your-org
164
69
  ```
165
70
 
166
- ## `sf remove assignments`
167
-
168
- Summary of a command.
71
+ **Example**: Upload an image and attach it to a record:
169
72
 
73
+ ```bash
74
+ sf create file --file assets/logo.png --title "Company Logo" --parent-id 001XXXXXXXXXXXXXXX --target-org production
170
75
  ```
171
- USAGE
172
- $ sf remove assignments -b PermissionSet|PermissionSetGroup|Group... -u <value>... -o <value> [--json] [--flags-dir
173
- <value>] [-n <value>]
174
-
175
- FLAGS
176
- -b, --object=<option>... (required) The object for which the assignment will be removed.
177
- <options: PermissionSet|PermissionSetGroup|Group>
178
- -n, --name=<value> Description of a flag.
179
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
180
- configuration variable is already set.
181
- -u, --usernames=<value>... (required) The list of usernames to be unassigned from the selected object. If in a
182
- sandbox, the script will look for "usename" and "username".sandbox for unassignment.
183
-
184
- GLOBAL FLAGS
185
- --flags-dir=<value> Import flag values from a directory.
186
- --json Format output as json.
187
-
188
- DESCRIPTION
189
- Summary of a command.
190
76
 
191
- More information about a command. Don't repeat the summary.
77
+ ### `sf remove assignments`
192
78
 
193
- EXAMPLES
194
- $ sf remove assignments
79
+ Efficiently manage user permissions by removing assignments from users. Great for cleaning up access during user offboarding!
195
80
 
196
- FLAG DESCRIPTIONS
197
- -n, --name=<value> Description of a flag.
198
-
199
- More information about a flag. Don't repeat the summary.
81
+ ```bash
82
+ sf remove assignments --object PermissionSet --usernames user@example.com --target-org your-org
200
83
  ```
201
84
 
202
- ## `sf reporton deployment`
203
-
204
- Summary of a command.
85
+ **Example**: Remove multiple permission sets from multiple users:
205
86
 
87
+ ```bash
88
+ sf remove assignments --object PermissionSet --usernames user1@example.com user2@example.com --target-org production
206
89
  ```
207
- USAGE
208
- $ sf reporton deployment -o <value> -d <value> [--json] [--flags-dir <value>] [-a]
209
90
 
210
- FLAGS
211
- -a, --awaitcompletion If the aplication should respond every 30 sec until the deployment is complete.
212
- -d, --deploymentid=<value> (required) The id of the deployment that we want to report on.
213
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
214
- configuration variable is already set.
91
+ ## ๐Ÿงช Development
215
92
 
216
- GLOBAL FLAGS
217
- --flags-dir=<value> Import flag values from a directory.
218
- --json Format output as json.
93
+ To contribute to SF-CIUtils, follow these steps:
219
94
 
220
- DESCRIPTION
221
- Summary of a command.
95
+ 1. Clone the repository:
96
+ ```bash
97
+ git clone https://github.com/marsson/sf-ciutils.git
98
+ ```
222
99
 
223
- More information about a command. Don't repeat the summary.
100
+ 2. Install dependencies:
101
+ ```bash
102
+ yarn install
103
+ ```
224
104
 
225
- EXAMPLES
226
- $ sf reporton deployment
227
- ```
105
+ 3. Build the plugin:
106
+ ```bash
107
+ yarn build
108
+ ```
109
+
110
+ 4. Link to your local Salesforce CLI:
111
+ ```bash
112
+ sf plugins link .
113
+ ```
228
114
 
229
- ## `sf validate repository metadata`
115
+ 5. Run tests:
116
+ ```bash
117
+ yarn test
118
+ ```
230
119
 
231
- Summary of a command.
120
+ ## ๐Ÿค Contributing
232
121
 
233
- ```
234
- USAGE
235
- $ sf validate repository metadata -o <value> -f <value> [--json] [--flags-dir <value>] [-n <value>]
122
+ Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
236
123
 
237
- FLAGS
238
- -f, --folder=<value> (required) The path to the deployment folder (ex. force-app/main/default/obects).
239
- -n, --name=<value> Description of a flag.
240
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
241
- configuration variable is already set.
124
+ 1. Fork the Project
125
+ 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
126
+ 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
127
+ 4. Push to the Branch (`git push origin feature/AmazingFeature`)
128
+ 5. Open a Pull Request
242
129
 
243
- GLOBAL FLAGS
244
- --flags-dir=<value> Import flag values from a directory.
245
- --json Format output as json.
130
+ ## ๐Ÿ“ License
246
131
 
247
- DESCRIPTION
248
- Summary of a command.
132
+ This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.
249
133
 
250
- More information about a command. Don't repeat the summary.
134
+ ## ๐Ÿ™ Acknowledgments
251
135
 
252
- EXAMPLES
253
- $ sf validate repository metadata
136
+ - Thanks to the Salesforce CLI team for their amazing work
137
+ - Shoutout to all the contributors who have helped make this project better
138
+ - Special thanks to the Salesforce developer community for their continuous support
254
139
 
255
- FLAG DESCRIPTIONS
256
- -n, --name=<value> Description of a flag.
140
+ ---
257
141
 
258
- More information about a flag. Don't repeat the summary.
259
- ```
260
- <!-- commandsstop -->
142
+ Happy coding! May your deployments be swift and your validations pass on the first try! ๐ŸŽ‰