Skip to content

Commit

Permalink
feat/new command project valiate
Browse files Browse the repository at this point in the history
- add initial files
- add new command files
  • Loading branch information
Rocko1204 committed Nov 7, 2022
1 parent c0c4257 commit 493ac94
Show file tree
Hide file tree
Showing 15 changed files with 907 additions and 149 deletions.
21 changes: 21 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* 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
*/

module.exports = {
extends: ["eslint-config-salesforce-typescript"],
parser: "@typescript-eslint/parser",
rules: {
"no-console": "off",
"no-restricted-syntax": [
"error",
{
"selector": "CallExpression[callee.object.name='console'][callee.property.name!=/^(log|warn|error|info|trace)$/]",
"message": "Unexpected property on console object was called"
}
]
}
};
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ node_modules

# os specific files
.DS_Store
.idea
.idea
sfdx-project.json
82 changes: 82 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,91 @@ sfdx cli to build awesome package tool
[![License](https://img.shields.io/npm/l/@rocko1204/rocko-sfdx.svg)](https://github.com/github/rocko-sfdx/blob/master/package.json)

<!-- toc -->
* [Debugging your plugin](#debugging-your-plugin)
<!-- tocstop -->
<!-- install -->
<!-- usage -->
```sh-session
$ npm install -g @rocko1204/rocko-sfdx
$ @rocko1204/rocko-sfdx COMMAND
running command...
$ @rocko1204/rocko-sfdx (-v|--version|version)
@rocko1204/rocko-sfdx/0.0.1 darwin-x64 node-v18.10.0
$ @rocko1204/rocko-sfdx --help [COMMAND]
USAGE
$ @rocko1204/rocko-sfdx COMMAND
...
```
<!-- usagestop -->
<!-- commands -->
* [`@rocko1204/rocko-sfdx rocko:project:validate [-s <string>] [-v -t <string>] [-m] [-o] [-d] [-i <string>] [-e <string>] [-f] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#rocko1204rocko-sfdx-rockoprojectvalidate--s-string--v--t-string--m--o--d--i-string--e-string--f--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)

## `@rocko1204/rocko-sfdx rocko:project:validate [-s <string>] [-v -t <string>] [-m] [-o] [-d] [-i <string>] [-e <string>] [-f] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

This command performs static checks in the sfdx-project json file for changed packages. Optional flags are used to control which validations are to be carried out. The individual tests are described with the flags.

```
USAGE
$ @rocko1204/rocko-sfdx rocko:project:validate [-s <string>] [-v -t <string>] [-m] [-o] [-d] [-i <string>] [-e
<string>] [-f] [-u <string>] [--apiversion <string>] [--json] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
OPTIONS
-d, --depsversion
Checks whether the dependent packages have at least the versions of the dependent packages. Default this commands
checks only the required versions. This check includes only unlocked packages.
-e, --exclude=exclude
Packages to exclude from validation. Multiple selection possible via comma separated list.
-f, --fix
This flag is used to directly update the sfdx-project.json file with the fixes. The default value is false
-i, --include=include
Packages to validate via command line input. Multiple selection possible via comma separated list.
-m, --missingdeps
Checks whether all dependend packages are present in the package tree. This checks includes only unlocked packages.
-o, --order
Checks if the dependent packages are arranged in the correct order in the package tree. Furthermore, it is checked
that the dependend packages are arranged in front of the unlocked package in the tree. This check includes only
unlocked packages.
-s, --source=source
This flag is required for the git diff check and describes the source value. The default value is HEAD
-t, --target=target
This flag is required for the git diff check and describes the target value. The default value is remote main
branch.
-u, --targetusername=targetusername
username or alias for the target org; overrides default target org
-v, --versionupdate
Checks whether the versions of the changed packages for the merge request have been updated. The check is against
the target branch. So the target flag is required.
--apiversion=apiversion
override the api version used for api requests made by this command
--json
format output as json
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)
[default: warn] logging level for this command invocation
EXAMPLES
sfdx eon:project:validate -t origin/main --versionupdate
sfdx eon:project:validate --order --include core
sfdx eon:project:validate -t origin/main --versionupdate --missingdeps --order --depsversion
sfdx eon:project:validate -t origin/main - -v -m -o -d
sfdx eon:project:validate -t origin/main - -v -m -o -d -f
sfdx eon:project:validate -t origin/main --versionupdate --missingdeps --order --depsversion --fix
```

_See code: [src/commands/rocko/project/validate.ts](https://github.com/github/rocko-sfdx/blob/v0.0.1/src/commands/rocko/project/validate.ts)_
<!-- commandsstop -->
<!-- debugging-your-plugin -->
# Debugging your plugin
We recommend using the Visual Studio Code (VS Code) IDE for your plugin development. Included in the `.vscode` directory of this plugin is a `launch.json` config file, which allows you to attach a debugger to the node process when running your commands.
Expand Down
10 changes: 0 additions & 10 deletions messages/org.json

This file was deleted.

20 changes: 20 additions & 0 deletions messages/project_validate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"commandDescription": "This command performs static checks in the sfdx-project json file for changed packages. Optional flags are used to control which validations are to be carried out. The individual tests are described with the flags.",
"source": "This flag is required for the git diff check and describes the source value. The default value is HEAD",
"target": "This flag is required for the git diff check and describes the target value. The default value is remote main branch.",
"include": "Packages to validate via command line input. Multiple selection possible via comma separated list.",
"exclude": "Packages to exclude from validation. Multiple selection possible via comma separated list.",
"fix": "This flag is used to directly update the sfdx-project.json file with the fixes. The default value is false",
"versionupdate": "Checks whether the versions of the changed packages for the merge request have been updated. The check is against the target branch. So the target flag is required.",
"missingdeps": "Checks whether all dependend packages are present in the package tree. This checks includes only unlocked packages.",
"order": "Checks if the dependent packages are arranged in the correct order in the package tree. Furthermore, it is checked that the dependend packages are arranged in front of the unlocked package in the tree. This check includes only unlocked packages.",
"depsversion": "Checks whether the dependent packages have at least the versions of the dependent packages. Default this commands checks only the required versions. This check includes only unlocked packages.",
"examples": [
"sfdx eon:project:validate -t origin/main --versionupdate",
"sfdx eon:project:validate --order --include core",
"sfdx eon:project:validate -t origin/main --versionupdate --missingdeps --order --depsversion",
"sfdx eon:project:validate -t origin/main - -v -m -o -d",
"sfdx eon:project:validate -t origin/main - -v -m -o -d -f",
"sfdx eon:project:validate -t origin/main --versionupdate --missingdeps --order --depsversion --fix"
]
}
1 change: 1 addition & 0 deletions oclif.manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"0.0.1","commands":{"rocko:project:validate":{"id":"rocko:project:validate","description":"This command performs static checks in the sfdx-project json file for changed packages. Optional flags are used to control which validations are to be carried out. The individual tests are described with the flags.","usage":"<%= command.id %> [-s <string>] [-v -t <string>] [-m] [-o] [-d] [-i <string>] [-e <string>] [-f] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@rocko1204/rocko-sfdx","pluginType":"core","aliases":[],"examples":["sfdx eon:project:validate -t origin/main --versionupdate","sfdx eon:project:validate --order --include core","sfdx eon:project:validate -t origin/main --versionupdate --missingdeps --order --depsversion","sfdx eon:project:validate -t origin/main - -v -m -o -d","sfdx eon:project:validate -t origin/main - -v -m -o -d -f","sfdx eon:project:validate -t origin/main --versionupdate --missingdeps --order --depsversion --fix"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"target":{"name":"target","type":"option","char":"t","description":"This flag is required for the git diff check and describes the target value. The default value is remote main branch.","required":false},"source":{"name":"source","type":"option","char":"s","description":"This flag is required for the git diff check and describes the source value. The default value is HEAD","required":false},"versionupdate":{"name":"versionupdate","type":"boolean","char":"v","description":"Checks whether the versions of the changed packages for the merge request have been updated. The check is against the target branch. So the target flag is required.","required":false,"allowNo":false},"missingdeps":{"name":"missingdeps","type":"boolean","char":"m","description":"Checks whether all dependend packages are present in the package tree. This checks includes only unlocked packages.","required":false,"allowNo":false},"order":{"name":"order","type":"boolean","char":"o","description":"Checks if the dependent packages are arranged in the correct order in the package tree. Furthermore, it is checked that the dependend packages are arranged in front of the unlocked package in the tree. This check includes only unlocked packages.","required":false,"allowNo":false},"depsversion":{"name":"depsversion","type":"boolean","char":"d","description":"Checks whether the dependent packages have at least the versions of the dependent packages. Default this commands checks only the required versions. This check includes only unlocked packages.","required":false,"allowNo":false},"include":{"name":"include","type":"option","char":"i","description":"Packages to validate via command line input. Multiple selection possible via comma separated list.","required":false,"default":""},"exclude":{"name":"exclude","type":"option","char":"e","description":"Packages to exclude from validation. Multiple selection possible via comma separated list.","required":false,"default":""},"fix":{"name":"fix","type":"boolean","char":"f","description":"This flag is used to directly update the sfdx-project.json file with the fixes. The default value is false","required":false,"allowNo":false}},"args":[{"name":"file"}]}}}
104 changes: 68 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,66 @@
"author": "Ronny Rokitta",
"bugs": "https://github.com/github/rocko-sfdx/issues",
"dependencies": {
"@oclif/core": "^1",
"@salesforce/command": "^5",
"@salesforce/core": "^3",
"chalk": "^5.1.2",
"simple-git": "^3.14.1",
"tslib": "^2"
"@oclif/core": "^1.19.1",
"@salesforce/command": "5.2.20",
"@salesforce/core": "^3.31.16",
"@salesforce/kit": "^1.7.1",
"@salesforce/schemas": "^1.1.3",
"@salesforce/source-deploy-retrieve": "^7.0.1",
"@salesforce/ts-types": "^1.5.21",
"chalk": "4.1.2",
"cli-table3": "^0.6.2",
"jsforce": "2.0.0-beta.19",
"simple-git": "^3.4.0",
"strip-ansi": ""
},
"devDependencies": {
"@oclif/plugin-command-snapshot": "^3.2.9",
"@oclif/plugin-help": "^5",
"@oclif/test": "^2",
"@salesforce/ts-sinon": "^1",
"@types/chai": "^4",
"@types/mocha": "^8",
"@typescript-eslint/eslint-plugin": "^4",
"@typescript-eslint/parser": "^4",
"chai": "^4",
"eslint": "^7",
"eslint-config-prettier": "^8",
"eslint-plugin-header": "^3",
"eslint-plugin-import": "^2",
"eslint-plugin-jsdoc": "^35",
"eslint-plugin-prettier": "^3",
"eslint-plugin-typescript": "^0",
"mocha": "^9",
"nyc": "^15",
"oclif": "^3",
"prettier": "^2",
"sinon": "10.0.0",
"ts-node": "^10",
"typescript": "4"
"@salesforce/cli-plugins-testkit": "^3.2.2",
"@salesforce/dev-config": "^3.1.0",
"@salesforce/dev-scripts": "^3.1.0",
"@salesforce/plugin-command-reference": "^1",
"@salesforce/prettier-config": "^0.0.2",
"@salesforce/ts-sinon": "^1.4.1",
"@types/debug": "4.1.7",
"@types/globby": "^9.1.0",
"@types/jszip": "^3.4.1",
"@types/xml2js": "^0.4.11",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "5.42.0",
"chai": "^4.3.6",
"commitizen": "^4.2.4",
"eslint": "^8.27.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-salesforce": "^1.1.0",
"eslint-config-salesforce-license": "^0.1.6",
"eslint-config-salesforce-typescript": "^1.1.1",
"eslint-config-standard-with-typescript": "^23.0.0",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^39.3.25",
"eslint-plugin-n": "^15.5.0",
"eslint-plugin-promise": "^6.1.1",
"husky": "^8.0.1",
"mocha": "^10.0.0",
"nyc": "^15.1.0",
"prettier": "^2.7.1",
"pretty-quick": "^3.1.3",
"shelljs": "0.8.5",
"sinon": "14.0.1",
"ts-node": "^10.9.1",
"typescript": "^4.8.4"
},
"engines": {
"node": ">=14.0.0"
},
"files": [
"/lib",
"/messages",
"/npm-shrinkwrap.json",
"/oclif.manifest.json"
"docs",
"lib",
"messages",
"!lib/**/*.map"
],
"homepage": "https://github.com/github/rocko-sfdx",
"keywords": [
Expand All @@ -51,21 +73,31 @@
"license": "MIT",
"oclif": {
"commands": "./lib/commands",
"bin": "sfdx",
"topics": {
"hello": {
"description": "Commands to say hello."
"rocko": {
"description": "CLI for Package Development",
"external": true,
"subtopics": {
"project": {
"description": "Commands around sfdx-project.json file"
}
}
}
}
},
"devPlugins": [
"@oclif/plugin-help",
"@oclif/plugin-command-snapshot",
"@salesforce/plugin-command-reference"
]
},
"repository": "github/rocko-sfdx",
"scripts": {
"build": "tsc -p .",
"lint": "eslint src/**/*.ts test/**/*.ts",
"postpack": "rm -f oclif.manifest.json",
"posttest": "eslint src/**/*.ts test/**/*.ts",
"prepack": "rm -rf lib && tsc -b && oclif manifest && oclif readme",
"prepack": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
"test": "nyc --extension .ts --require ts-node/register mocha --forbid-only \"test/**/*.test.ts\"",
"version": "oclif readme && git add README.md"
"version": "oclif-dev readme && git add README.md"
}
}
93 changes: 0 additions & 93 deletions src/commands/hello/org.ts

This file was deleted.

Loading

0 comments on commit 493ac94

Please sign in to comment.