Socket
Socket
Sign inDemoInstall

@percy/cli-config

Package Overview
Dependencies
Maintainers
6
Versions
237
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@percy/cli-config - npm Package Compare versions

Comparing version 1.0.0-beta.29 to 1.0.0-beta.30

14

dist/commands/config/create.js

@@ -29,2 +29,8 @@ "use strict";

class Create extends _command.default {
constructor(...args) {
super(...args);
_defineProperty(this, "log", (0, _logger.default)('cli:config:create'));
}
async run() {

@@ -44,4 +50,3 @@ var _FILETYPES$find;

if (!FILETYPES.includes(filetype)) {
_logger.default.error(`Unsupported filetype: ${filetype}`);
this.log.error(`Unsupported filetype: ${filetype}`);
return this.exit(1);

@@ -60,4 +65,3 @@ } // discern the appropriate filename

if (_fs.default.existsSync(filepath)) {
_logger.default.error(`Percy config already exists: ${filepath}`);
this.log.error(`Percy config already exists: ${filepath}`);
return this.exit(1);

@@ -71,3 +75,3 @@ } // discern the file format

_logger.default.info(`Created Percy config: ${filepath}`);
this.log.info(`Created Percy config: ${filepath}`);
}

@@ -74,0 +78,0 @@

@@ -35,2 +35,8 @@ "use strict";

class Migrate extends _command.default {
constructor(...args) {
super(...args);
_defineProperty(this, "log", (0, _logger.default)('cli:config:migrate'));
}
async run() {

@@ -60,13 +66,10 @@ let config;

} = result);
_logger.default.info(`Found config file: ${_path.default.relative('', input)}`);
this.log.info(`Found config file: ${_path.default.relative('', input)}`);
output = output ? _path.default.resolve(output) : input;
} else {
_logger.default.error('Config file not found');
this.log.error('Config file not found');
}
} catch (error) {
_logger.default.error('Failed to load or parse config file');
_logger.default.error(error);
this.log.error('Failed to load or parse config file');
this.log.error(error);
} // no config, bail

@@ -78,4 +81,3 @@

if (input === output && config.version === 2) {
_logger.default.warn('Config is already the latest version');
this.log.warn('Config is already the latest version');
return;

@@ -85,4 +87,3 @@ } // migrate config

_logger.default.info('Migrating config file...');
this.log.info('Migrating config file...');
let format = _path.default.extname(output).replace(/^./, '') || 'yaml';

@@ -107,6 +108,5 @@ config = _config.default.stringify(format, this.migrate(config)); // update the package.json entry via string replacement

_logger.default.info('Config file migrated!'); // when dry-running, print config to stdout when finished
this.log.info('Config file migrated!'); // when dry-running, print config to stdout when finished
if (dry) process.stdout.write('\n' + config);
if (dry) _logger.default.instance.stdout.write('\n' + config);
} // Migrating config options is recursive so no matter which input version is

@@ -113,0 +113,0 @@ // provided, the output will be the latest version.

@@ -19,2 +19,8 @@ "use strict";

class Validate extends _command.default {
constructor(...args) {
super(...args);
_defineProperty(this, "log", (0, _logger.default)('cli:config:validate'));
}
async run() {

@@ -25,13 +31,11 @@ let {

}
} = this.parse();
} = this.parse(); // when `bail` is true, #load() returns undefined on validation warnings
_logger.default.loglevel('debug'); // when `bail` is true, #load() returns undefined on validation warnings
let config = _config.default.load({
path,
bail: true,
print: true
});
if (!_config.default.load({
path,
bail: true
})) {
this.exit(1);
}
if (!config) this.exit(1);
}

@@ -38,0 +42,0 @@

@@ -1,1 +0,1 @@

{"version":"1.0.0-beta.29","commands":{"config:create":{"id":"config:create","description":"Create a Percy config file","pluginName":"@percy/cli-config","pluginType":"core","aliases":[],"examples":["$ percy config:create","$ percy config:create --yaml","$ percy config:create --json","$ percy config:create --js","$ percy config:create --rc","$ percy config:create ./config/percy.yml"],"flags":{"rc":{"name":"rc","type":"boolean","description":"create a .percyrc file","allowNo":false},"yaml":{"name":"yaml","type":"boolean","description":"create a .percy.yaml file","allowNo":false},"yml":{"name":"yml","type":"boolean","description":"create a .percy.yml file","allowNo":false},"json":{"name":"json","type":"boolean","description":"create a .percy.json file","allowNo":false},"js":{"name":"js","type":"boolean","description":"create a .percy.js file","allowNo":false}},"args":[{"name":"filepath","description":"config filepath"}]},"config:migrate":{"id":"config:migrate","description":"Migrate a Percy config file to the latest version","pluginName":"@percy/cli-config","pluginType":"core","aliases":[],"examples":["$ percy config:migrate","$ percy config:migrate --dry-run","$ percy config:migrate ./config/percy.yml","$ percy config:migrate .percy.yml .percy.js"],"flags":{"dry-run":{"name":"dry-run","type":"boolean","char":"d","description":"prints the new config rather than writing it","allowNo":false}},"args":[{"name":"filepath","description":"current config filepath, detected by default"},{"name":"output","description":"new config filepath to write to, defaults to FILEPATH"}]},"config:validate":{"id":"config:validate","description":"Validate a Percy config file","pluginName":"@percy/cli-config","pluginType":"core","aliases":[],"examples":["$ percy config:validate","$ percy config:validate ./config/percy.yml"],"flags":{},"args":[{"name":"filepath","description":"config filepath, detected by default"}]}}}
{"version":"1.0.0-beta.30","commands":{"config:create":{"id":"config:create","description":"Create a Percy config file","pluginName":"@percy/cli-config","pluginType":"core","aliases":[],"examples":["$ percy config:create","$ percy config:create --yaml","$ percy config:create --json","$ percy config:create --js","$ percy config:create --rc","$ percy config:create ./config/percy.yml"],"flags":{"rc":{"name":"rc","type":"boolean","description":"create a .percyrc file","allowNo":false},"yaml":{"name":"yaml","type":"boolean","description":"create a .percy.yaml file","allowNo":false},"yml":{"name":"yml","type":"boolean","description":"create a .percy.yml file","allowNo":false},"json":{"name":"json","type":"boolean","description":"create a .percy.json file","allowNo":false},"js":{"name":"js","type":"boolean","description":"create a .percy.js file","allowNo":false}},"args":[{"name":"filepath","description":"config filepath"}]},"config:migrate":{"id":"config:migrate","description":"Migrate a Percy config file to the latest version","pluginName":"@percy/cli-config","pluginType":"core","aliases":[],"examples":["$ percy config:migrate","$ percy config:migrate --dry-run","$ percy config:migrate ./config/percy.yml","$ percy config:migrate .percy.yml .percy.js"],"flags":{"dry-run":{"name":"dry-run","type":"boolean","char":"d","description":"prints the new config rather than writing it","allowNo":false}},"args":[{"name":"filepath","description":"current config filepath, detected by default"},{"name":"output","description":"new config filepath to write to, defaults to FILEPATH"}]},"config:validate":{"id":"config:validate","description":"Validate a Percy config file","pluginName":"@percy/cli-config","pluginType":"core","aliases":[],"examples":["$ percy config:validate","$ percy config:validate ./config/percy.yml"],"flags":{},"args":[{"name":"filepath","description":"config filepath, detected by default"}]}}}
{
"name": "@percy/cli-config",
"version": "1.0.0-beta.29",
"version": "1.0.0-beta.30",
"license": "MIT",

@@ -39,8 +39,8 @@ "main": "dist/index.js",

"@oclif/config": "^1.17.0",
"@percy/config": "^1.0.0-beta.29",
"@percy/core": "^1.0.0-beta.29",
"@percy/logger": "^1.0.0-beta.29",
"@percy/config": "^1.0.0-beta.30",
"@percy/core": "^1.0.0-beta.30",
"@percy/logger": "^1.0.0-beta.30",
"path-type": "^4.0.0"
},
"gitHead": "d8ece55981a5b9ef52abda65783c2aa874ac87e6"
"gitHead": "584a401d8cb349a90d0eea964c6ac2a3682591f1"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc