@percy/cli-config
Advanced tools
Comparing version 1.0.0-beta.34 to 1.0.0-beta.35
@@ -86,19 +86,20 @@ "use strict"; | ||
let body = _config.default.stringify(format, migrated); // update the package.json entry via string replacement | ||
let body = _config.default.stringify(format, migrated); | ||
if (!dry) { | ||
let content = body; // update the package.json entry by requiring it and modifying it | ||
if (!dry && _path.default.basename(output) === 'package.json') { | ||
_fs.default.writeFileSync(output, _fs.default.readFileSync(output).replace(/(\s+)("percy":\s*){.*\1}/s, `$1$2${body.replace(/\n/g, '$$1')}`)); // write to output | ||
if (_path.default.basename(output) === 'package.json') { | ||
let pkg = JSON.parse(_fs.default.readFileSync(output)); | ||
content = _config.default.stringify(format, { ...pkg, | ||
percy: migrated | ||
}); // rename input if it is the output | ||
} else if (input === output) { | ||
let old = input.replace(_path.default.extname(input), '.old$&'); | ||
} else if (!dry) { | ||
// rename input if it is the output | ||
if (input === output) { | ||
let ext = _path.default.extname(input); | ||
_fs.default.renameSync(input, old); | ||
} // write to output | ||
let old = input.replace(ext, `.old${ext}`); | ||
_fs.default.renameSync(input, old); | ||
} | ||
_fs.default.writeFileSync(output, body); | ||
_fs.default.writeFileSync(output, content); | ||
} | ||
@@ -105,0 +106,0 @@ |
@@ -1,1 +0,1 @@ | ||
{"version":"1.0.0-beta.34","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.35","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.34", | ||
"version": "1.0.0-beta.35", | ||
"license": "MIT", | ||
@@ -39,6 +39,6 @@ "main": "dist/index.js", | ||
"@oclif/config": "^1.17.0", | ||
"@percy/config": "^1.0.0-beta.34", | ||
"@percy/logger": "^1.0.0-beta.34" | ||
"@percy/config": "^1.0.0-beta.35", | ||
"@percy/logger": "^1.0.0-beta.35" | ||
}, | ||
"gitHead": "33915b5865c49bf8ef38c6f7a9eaf9e164869518" | ||
"gitHead": "d158a3033eb018341d24473ccec964c90ddcdf1c" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16577
222
Updated@percy/config@^1.0.0-beta.35
Updated@percy/logger@^1.0.0-beta.35