Comparing version 1.1.1 to 1.2.1
@@ -6,2 +6,3 @@ const path = require('path'); | ||
const yaml = require('js-yaml'); | ||
const { lookupPaths } = require('./fs'); | ||
@@ -32,20 +33,24 @@ exports.patch = async function (apiURL) { | ||
async function getCypressRoot() { | ||
let cypressRoot; | ||
async function getStateModulePath() { | ||
try { | ||
const cliBinPath = await getCypressCLIBinPath(); | ||
const cliBinPathElements = cliBinPath.split(path.sep); | ||
if (isWindowsBin(cliBinPath)) { | ||
cypressRoot = path.resolve( | ||
const candidates = [ | ||
path.join( | ||
path.dirname(cliBinPath), | ||
'node_modules', | ||
'cypress' | ||
); | ||
} else { | ||
cypressRoot = cliBinPathElements | ||
.slice(0, cliBinPathElements.length - 2) | ||
.join('/'); | ||
'cypress/lib/tasks/state.js' | ||
), | ||
path.join(path.dirname(cliBinPath), '..', 'lib/tasks/state.js'), | ||
path.join( | ||
path.dirname(cliBinPath), | ||
'..', | ||
'cypress', | ||
'lib/tasks/state.js' | ||
), | ||
]; | ||
const result = lookupPaths(candidates); | ||
if (!result) { | ||
throw new Error('Cannot detect cypress'); | ||
} | ||
return cypressRoot; | ||
return result; | ||
} catch (error) { | ||
@@ -56,4 +61,3 @@ throw new Error('Cannot detect cypress. Is cypress installed?'); | ||
async function getConfigFilesPaths() { | ||
const cypressRoot = await getCypressRoot(); | ||
const stateModulePath = path.resolve(cypressRoot, 'lib/tasks/state'); | ||
const stateModulePath = await getStateModulePath(); | ||
const state = require(stateModulePath); | ||
@@ -88,5 +92,1 @@ | ||
} | ||
function isWindowsBin(path) { | ||
return path.includes('.CMD'); | ||
} |
{ | ||
"name": "cy2", | ||
"version": "1.1.1", | ||
"version": "1.2.1", | ||
"main": "index.js", | ||
@@ -11,2 +11,6 @@ "author": "Andrew Goldis", | ||
}, | ||
"scripts": { | ||
"test": "jest", | ||
"release": "release-it" | ||
}, | ||
"dependencies": { | ||
@@ -34,4 +38,21 @@ "js-yaml": "^4.0.0", | ||
"devDependencies": { | ||
"jest": "^26.6.3" | ||
"@release-it/conventional-changelog": "^2.0.1", | ||
"jest": "^26.6.3", | ||
"release-it": "^14.6.2", | ||
"shelljs": "^0.8.4" | ||
}, | ||
"release-it": { | ||
"npm": { | ||
"publish": true | ||
}, | ||
"github": { | ||
"release": true | ||
}, | ||
"plugins": { | ||
"@release-it/conventional-changelog": { | ||
"preset": "angular", | ||
"infile": "CHANGELOG.md" | ||
} | ||
} | ||
} | ||
} |
@@ -34,3 +34,3 @@ # cy2 | ||
Path and run `cypress` | ||
Patch and run `cypress` | ||
@@ -75,2 +75,4 @@ ```ts | ||
-h, --help display help for command | ||
*/ | ||
``` |
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
8130
8
99
77
4
3