Skip to content

Commit

Permalink
♻ Refactor @percy/cli-config to utilize new @percy/cli-command (#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wil Wilsman authored Dec 16, 2021
1 parent 7dff315 commit 6a9aad8
Show file tree
Hide file tree
Showing 14 changed files with 348 additions and 324 deletions.
100 changes: 59 additions & 41 deletions packages/cli-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,35 @@ Percy configuration files.

## Commands
<!-- commands -->
* [`percy config:create [FILEPATH]`](#percy-configcreate-filepath)
* [`percy config:migrate [FILEPATH] [OUTPUT]`](#percy-configmigrate-filepath-output)
* [`percy config:validate [FILEPATH]`](#percy-configvalidate-filepath)
* [`percy config:create`](#percy-configcreate)
* [`percy config:validate`](#percy-configvalidate)
* [`percy config:migrate`](#percy-configmigrate)

## `percy config:create [FILEPATH]`
### `percy config:create`

Create a Percy config file

```
USAGE
$ percy config:create [FILEPATH]
ARGUMENTS
FILEPATH config filepath
OPTIONS
--js create a .percy.js file
--json create a .percy.json file
--rc create a .percyrc file
--yaml create a .percy.yaml file
--yml create a .percy.yml file
EXAMPLES
Usage:
$ percy config:create [options] [filepath]
Arguments:
filepath Optional config filepath
Options:
--rc Create a .percyrc file
--yaml Create a .percy.yaml file
--yml Create a .percy.yml file
--json Create a .percy.json file
--js Create a .percy.js file
Global options:
-v, --verbose Log everything
-q, --quiet Log errors only
-s, --silent Log nothing
-h, --help Display command help
Examples:
$ percy config:create
$ percy config:create --yaml
$ percy config:create --json
Expand All @@ -36,41 +42,53 @@ EXAMPLES
$ percy config:create ./config/percy.yml
```

## `percy config:migrate [FILEPATH] [OUTPUT]`
### `percy config:validate`

Migrate a Percy config file to the latest version
Validate a Percy config file

```
USAGE
$ percy config:migrate [FILEPATH] [OUTPUT]
Usage:
$ percy config:validate [options] [filepath]
ARGUMENTS
FILEPATH current config filepath, detected by default
OUTPUT new config filepath to write to, defaults to FILEPATH
Arguments:
filepath Config filepath, detected by default
OPTIONS
-d, --dry-run prints the new config rather than writing it
Global options:
-v, --verbose Log everything
-q, --quiet Log errors only
-s, --silent Log nothing
-h, --help Display command help
EXAMPLES
$ percy config:migrate
$ percy config:migrate --dry-run
$ percy config:migrate ./config/percy.yml
$ percy config:migrate .percy.yml .percy.js
Examples:
$ percy config:validate
$ percy config:validate ./config/percy.yml
```

## `percy config:validate [FILEPATH]`
### `percy config:migrate`

Validate a Percy config file
Migrate a Percy config file to the latest version

```
USAGE
$ percy config:validate [FILEPATH]
Usage:
$ percy config:migrate [options] [filepath] [output]
ARGUMENTS
FILEPATH config filepath, detected by default
Arguments:
filepath Current config filepath, detected by default
output New config filepath to write to, defaults to 'filepath'
EXAMPLES
$ percy config:validate
$ percy config:validate ./config/percy.yml
Options:
-d, --dry-run Print the new config without writing it
Global options:
-v, --verbose Log everything
-q, --quiet Log errors only
-s, --silent Log nothing
-h, --help Display command help
Examples:
$ percy config:migrate
$ percy config:migrate --dry-run
$ percy config:migrate ./config/percy.yml
$ percy config:migrate .percy.yml .percy.js
```
<!-- commandsstop -->
40 changes: 16 additions & 24 deletions packages/cli-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,35 @@
"name": "@percy/cli-config",
"version": "1.0.0-beta.71",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/percy/cli",
"directory": "packages/cli-config"
},
"publishConfig": {
"access": "public"
},
"main": "dist/index.js",
"files": [
"dist",
"oclif.manifest.json"
"dist"
],
"engines": {
"node": ">=12"
},
"scripts": {
"build": "node ../../scripts/build",
"lint": "eslint --ignore-path ../../.gitignore .",
"postbuild": "oclif-dev manifest",
"readme": "oclif-dev readme",
"readme": "percy-cli-readme",
"test": "node ../../scripts/test",
"test:coverage": "yarn test --coverage"
},
"publishConfig": {
"access": "public"
},
"oclif": {
"bin": "percy",
"commands": "./dist/commands",
"topics": {
"config": {
"description": "manage Percy config files"
}
}
"@percy/cli": {
"commands": [
"./dist/config.js"
]
},
"dependencies": {
"@oclif/command": "^1.8.0",
"@oclif/config": "^1.17.0",
"@percy/config": "1.0.0-beta.71",
"@percy/logger": "1.0.0-beta.71"
},
"repository": {
"type": "git",
"url": "https://github.com/percy/cli",
"directory": "packages/cli-config"
"@percy/cli-command": "1.0.0-beta.71",
"@percy/config": "1.0.0-beta.71"
}
}
88 changes: 0 additions & 88 deletions packages/cli-config/src/commands/config/create.js

This file was deleted.

100 changes: 0 additions & 100 deletions packages/cli-config/src/commands/config/migrate.js

This file was deleted.

Loading

0 comments on commit 6a9aad8

Please sign in to comment.