@applitools/eyes-storybook 3.35.0 → 3.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +113 -0
- package/README.md +0 -0
- package/package.json +26 -51
- package/src/cli.js +1 -1
- package/src/eyesStorybook.js +11 -1
- package/src/findNpmModuleCommandPath.js +46 -0
- package/src/processResults.js +4 -4
- package/src/storybookConnector.js +1 -1
- package/src/validateAndPopulateConfig.js +20 -17
- package/src/wrapBundle.js +1 -1
- package/src/yargsOptions.js +1 -1
- package/History.md +0 -1390
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,119 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## [3.37.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/eyes-storybook@3.36.0...js/eyes-storybook@3.37.0) (2023-07-18)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* support retries on stuck requests ([#1773](https://github.com/applitools/eyes.sdk.javascript1/issues/1773)) ([4db470e](https://github.com/applitools/eyes.sdk.javascript1/commit/4db470ee6829c13cfaf7e521ef91e20854266edd))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* fix lint config and remove extranous deps ([aea605c](https://github.com/applitools/eyes.sdk.javascript1/commit/aea605c4a1d6cca37d84b464af369cdbff3c6234))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Dependencies
|
|
21
|
+
|
|
22
|
+
* @applitools/req bumped from 1.4.0 to 1.5.0
|
|
23
|
+
#### Features
|
|
24
|
+
|
|
25
|
+
* support retries on stuck requests ([be673bb](https://github.com/applitools/eyes.sdk.javascript1/commit/be673bb505c9b21d6aea37d86e88513e95e3cb02))
|
|
26
|
+
* @applitools/ufg-client bumped from 1.4.1 to 1.5.0
|
|
27
|
+
#### Features
|
|
28
|
+
|
|
29
|
+
* support retries on stuck requests ([be673bb](https://github.com/applitools/eyes.sdk.javascript1/commit/be673bb505c9b21d6aea37d86e88513e95e3cb02))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
* @applitools/core bumped to 3.6.2
|
|
34
|
+
|
|
35
|
+
* @applitools/core-base bumped from 1.4.0 to 1.4.1
|
|
36
|
+
|
|
37
|
+
* @applitools/ec-client bumped from 1.7.0 to 1.7.1
|
|
38
|
+
|
|
39
|
+
* @applitools/tunnel-client bumped from 1.1.0 to 1.1.1
|
|
40
|
+
|
|
41
|
+
* @applitools/nml-client bumped from 1.5.2 to 1.5.3
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## [3.36.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/eyes-storybook-v3.35.1...js/eyes-storybook@3.36.0) (2023-07-05)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Features
|
|
48
|
+
|
|
49
|
+
* added support for storybook installed in parent module ([#1060](https://github.com/applitools/eyes.sdk.javascript1/issues/1060)) ([e2b9fbb](https://github.com/applitools/eyes.sdk.javascript1/commit/e2b9fbbb41938b2363a2c675874ad28e41859076))
|
|
50
|
+
* support dns caching ([#1680](https://github.com/applitools/eyes.sdk.javascript1/issues/1680)) ([9bbff34](https://github.com/applitools/eyes.sdk.javascript1/commit/9bbff34f50c9d18758b55a6bcb45571ca1148180))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Dependencies
|
|
54
|
+
|
|
55
|
+
* @applitools/core bumped from 3.4.0 to 3.5.0
|
|
56
|
+
#### Features
|
|
57
|
+
|
|
58
|
+
* added auto applitools lib detection ([#1707](https://github.com/applitools/eyes.sdk.javascript1/issues/1707)) ([7d439b5](https://github.com/applitools/eyes.sdk.javascript1/commit/7d439b52af55f3b0596c9d35d6ba85c717448023))
|
|
59
|
+
* support dns caching ([#1680](https://github.com/applitools/eyes.sdk.javascript1/issues/1680)) ([9bbff34](https://github.com/applitools/eyes.sdk.javascript1/commit/9bbff34f50c9d18758b55a6bcb45571ca1148180))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
#### Bug Fixes
|
|
63
|
+
|
|
64
|
+
* some fix ([660a137](https://github.com/applitools/eyes.sdk.javascript1/commit/660a1376a49dd28f8f399690502cd3d1f77665fa))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
* @applitools/core-base bumped from 1.2.1 to 1.3.0
|
|
69
|
+
#### Features
|
|
70
|
+
|
|
71
|
+
* support dns caching ([#1680](https://github.com/applitools/eyes.sdk.javascript1/issues/1680)) ([9bbff34](https://github.com/applitools/eyes.sdk.javascript1/commit/9bbff34f50c9d18758b55a6bcb45571ca1148180))
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
* @applitools/req bumped from 1.3.3 to 1.4.0
|
|
76
|
+
#### Features
|
|
77
|
+
|
|
78
|
+
* support dns caching ([#1680](https://github.com/applitools/eyes.sdk.javascript1/issues/1680)) ([9bbff34](https://github.com/applitools/eyes.sdk.javascript1/commit/9bbff34f50c9d18758b55a6bcb45571ca1148180))
|
|
79
|
+
* @applitools/driver bumped from 1.12.4 to 1.13.0
|
|
80
|
+
#### Features
|
|
81
|
+
|
|
82
|
+
* added auto applitools lib detection ([#1707](https://github.com/applitools/eyes.sdk.javascript1/issues/1707)) ([7d439b5](https://github.com/applitools/eyes.sdk.javascript1/commit/7d439b52af55f3b0596c9d35d6ba85c717448023))
|
|
83
|
+
* @applitools/ec-client bumped from 1.5.0 to 1.6.0
|
|
84
|
+
#### Features
|
|
85
|
+
|
|
86
|
+
* added support of regional execution cloud servers ([#1711](https://github.com/applitools/eyes.sdk.javascript1/issues/1711)) ([2e26c69](https://github.com/applitools/eyes.sdk.javascript1/commit/2e26c6944bb15f6121fb37c1dba95aba162c1f6a))
|
|
87
|
+
* support dns caching ([#1680](https://github.com/applitools/eyes.sdk.javascript1/issues/1680)) ([9bbff34](https://github.com/applitools/eyes.sdk.javascript1/commit/9bbff34f50c9d18758b55a6bcb45571ca1148180))
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
#### Bug Fixes
|
|
91
|
+
|
|
92
|
+
* fixed auto tunnel cleanup after unexpected end of the process ([3c1ad08](https://github.com/applitools/eyes.sdk.javascript1/commit/3c1ad0837d2d3560becc6d89370aa878becb3270))
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
* @applitools/tunnel-client bumped from 0.1.1 to 1.0.0
|
|
97
|
+
#### Features
|
|
98
|
+
|
|
99
|
+
* added binaries and made them available in jfrog ([92033fe](https://github.com/applitools/eyes.sdk.javascript1/commit/92033fed7edc58bbc4a4e37269068418fe3afc3d))
|
|
100
|
+
* release as 1.0.0 ([93bf312](https://github.com/applitools/eyes.sdk.javascript1/commit/93bf31205b07d19bc2cb4f50b974c7bad0f49cea))
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
* @applitools/ufg-client bumped from 1.2.22 to 1.3.0
|
|
105
|
+
#### Features
|
|
106
|
+
|
|
107
|
+
* support dns caching ([#1680](https://github.com/applitools/eyes.sdk.javascript1/issues/1680)) ([9bbff34](https://github.com/applitools/eyes.sdk.javascript1/commit/9bbff34f50c9d18758b55a6bcb45571ca1148180))
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
* @applitools/spec-driver-webdriver bumped from 1.0.36 to 1.0.37
|
|
112
|
+
|
|
113
|
+
* @applitools/nml-client bumped from 1.5.0 to 1.5.1
|
|
114
|
+
|
|
115
|
+
* @applitools/screenshoter bumped from 3.8.1 to 3.8.2
|
|
116
|
+
|
|
117
|
+
* @applitools/spec-driver-puppeteer bumped from 1.1.67 to 1.1.68
|
|
118
|
+
|
|
119
|
+
|
|
7
120
|
## 3.35.0 - 2023/6/13
|
|
8
121
|
|
|
9
122
|
### Features
|
package/README.md
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-storybook",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.37.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -18,30 +18,24 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "SEE LICENSE IN LICENSE",
|
|
20
20
|
"author": "Applitools Team <team@applitools.com>",
|
|
21
|
-
"
|
|
22
|
-
"storybook"
|
|
23
|
-
],
|
|
24
|
-
"bin": {
|
|
25
|
-
"eyes-storybook": "./bin/eyes-storybook.js"
|
|
26
|
-
},
|
|
21
|
+
"bin": "./bin/eyes-storybook.js",
|
|
27
22
|
"files": [
|
|
28
23
|
"src",
|
|
29
24
|
"bin",
|
|
30
25
|
"dist"
|
|
31
26
|
],
|
|
32
27
|
"scripts": {
|
|
33
|
-
"lint": "eslint '**/*.js'",
|
|
28
|
+
"lint": "run --top-level eslint '**/*.js'",
|
|
34
29
|
"build": "rollup -c rollup.config.js",
|
|
35
30
|
"build:heavy": "node scripts/bitmap.js",
|
|
36
31
|
"test": "yarn build && yarn test:mocha && yarn lint",
|
|
37
|
-
"test:
|
|
38
|
-
"test:
|
|
39
|
-
"test:
|
|
40
|
-
"test:
|
|
41
|
-
"test:
|
|
42
|
-
"test:e2e": "mocha --no-timeouts --trace-warnings 'test/e2e/*.e2e.test.js'",
|
|
32
|
+
"test:mocha": "run --top-level mocha --no-timeouts --trace-warnings 'test/{unit,it,e2e}/*.test.js'",
|
|
33
|
+
"test:unit": "run --top-level mocha --no-timeouts --trace-warnings 'test/unit/*.test.js'",
|
|
34
|
+
"test:it": "run --top-level mocha --no-timeouts --trace-warnings 'test/it/*.test.js'",
|
|
35
|
+
"test:versions": "run --top-level yarn build && yarn test:e2e:versions && yarn lint",
|
|
36
|
+
"test:e2e": "run --top-level mocha --no-timeouts --trace-warnings 'test/e2e/*.e2e.test.js'",
|
|
43
37
|
"test:e2e:versions": "npx mocha --no-timeouts --trace-warnings --require test/fixtures/storybook-versions/mochaHooks.js test/versions/*.e2e.versions.test.js",
|
|
44
|
-
"test:e2e:versions_local": "
|
|
38
|
+
"test:e2e:versions_local": "APPLITOOLS_FRAMEWORK_VERSION=latest npx mocha --no-timeouts --trace-warnings --require test/fixtures/storybook-versions/mochaHooks.js test/versions/*.e2e.versions.test.js",
|
|
45
39
|
"test:heavy": "node bin/eyes-storybook.js -f test/fixtures/heavyStorybook/applitools.config.js",
|
|
46
40
|
"storybook": "start-storybook -c test/fixtures/appWithStorybook -p 9001 -s test/fixtures",
|
|
47
41
|
"storybook:httpHeaders": "start-storybook -c test/fixtures/appWithCustomHttpHeaders -p 9007",
|
|
@@ -60,66 +54,44 @@
|
|
|
60
54
|
"changelog": "git changelog -x -p -f v$npm_package_version > History.md && git add ./History.md && git commit -am 'changelog'",
|
|
61
55
|
"changelog:init": "git config changelog.format \"* %s [[%h]($(echo $npm_package_repository_url|cut -d+ -f2|cut -d. -f1-2)/commit/%H)]\"",
|
|
62
56
|
"changelog:install": "sudo apt-get install git-extras",
|
|
63
|
-
"
|
|
64
|
-
"prepublish:setup": "echo 'setup is a no-op. Move along, nothing to see here.'",
|
|
65
|
-
"deps": "bongo deps",
|
|
66
|
-
"postinstall": "node src/postinstall",
|
|
67
|
-
"preversion": "bongo preversion --verifyPendingChanges",
|
|
68
|
-
"version": "bongo version --withPendingChanges",
|
|
69
|
-
"postversion": "bongo postversion"
|
|
70
|
-
},
|
|
71
|
-
"husky": {
|
|
72
|
-
"hooks": {
|
|
73
|
-
"pre-push": "yarn bongo lint"
|
|
74
|
-
}
|
|
57
|
+
"postinstall": "node src/postinstall"
|
|
75
58
|
},
|
|
76
59
|
"dependencies": {
|
|
77
|
-
"@applitools/core": "3.2
|
|
78
|
-
"@applitools/driver": "1.
|
|
60
|
+
"@applitools/core": "^3.6.2",
|
|
61
|
+
"@applitools/driver": "^1.13.1",
|
|
79
62
|
"@applitools/functional-commons": "1.6.0",
|
|
80
|
-
"@applitools/logger": "2.0.
|
|
63
|
+
"@applitools/logger": "^2.0.5",
|
|
81
64
|
"@applitools/monitoring-commons": "1.0.19",
|
|
82
|
-
"@applitools/spec-driver-puppeteer": "1.1.
|
|
83
|
-
"@applitools/
|
|
84
|
-
"@applitools/
|
|
85
|
-
"@applitools/utils": "1.3.37",
|
|
65
|
+
"@applitools/spec-driver-puppeteer": "^1.1.69",
|
|
66
|
+
"@applitools/ufg-client": "^1.5.0",
|
|
67
|
+
"@applitools/utils": "^1.5.0",
|
|
86
68
|
"boxen": "4.2.0",
|
|
87
69
|
"chalk": "3.0.0",
|
|
88
70
|
"detect-port": "1.3.0",
|
|
89
71
|
"lodash.flatten": "4.4.0",
|
|
90
72
|
"lodash.pick": "4.4.0",
|
|
91
73
|
"ora": "3.4.0",
|
|
92
|
-
"puppeteer": "19.
|
|
74
|
+
"puppeteer": "19.8.0",
|
|
93
75
|
"strip-ansi": "6.0.0",
|
|
94
76
|
"throat": "6.0.1",
|
|
95
|
-
"yargs": "
|
|
77
|
+
"yargs": "17.7.2"
|
|
96
78
|
},
|
|
97
79
|
"devDependencies": {
|
|
98
|
-
"@applitools/bongo": "^
|
|
80
|
+
"@applitools/bongo": "^5.0.4",
|
|
99
81
|
"@applitools/sdk-shared": "0.9.15",
|
|
100
82
|
"@applitools/snaptdout": "^1.0.1",
|
|
83
|
+
"@applitools/test-server": "^1.2.2",
|
|
84
|
+
"@babel/eslint-parser": "^7.22.9",
|
|
101
85
|
"@storybook/addon-interactions": "^6.4.18",
|
|
102
86
|
"@storybook/react": "^6.4.18",
|
|
103
87
|
"@storybook/testing-library": "^0.0.9",
|
|
104
88
|
"@testing-library/dom": "^5.6.1",
|
|
105
|
-
"babel-core": "^6.26.3",
|
|
106
|
-
"babel-eslint": "^10.1.0",
|
|
107
|
-
"babel-loader": "^8.0.6",
|
|
108
|
-
"babel-preset-env": "^1.7.0",
|
|
109
|
-
"babel-preset-react": "^6.24.1",
|
|
110
89
|
"bitmap-manipulation": "^2.0.0",
|
|
111
90
|
"chai": "^4.2.0",
|
|
112
91
|
"core-js": "^3.6.1",
|
|
113
|
-
"eslint": "^6.6.0",
|
|
114
|
-
"eslint-plugin-mocha-no-only": "^1.1.0",
|
|
115
|
-
"eslint-plugin-node": "^10.0.0",
|
|
116
|
-
"eslint-plugin-prettier": "^3.1.1",
|
|
117
92
|
"express": "^4.17.1",
|
|
118
93
|
"filenamify": "^4.1.0",
|
|
119
|
-
"husky": "^4.3.8",
|
|
120
|
-
"mocha": "^8.0.1",
|
|
121
94
|
"node-fetch": "^2.6.0",
|
|
122
|
-
"prettier": "^1.19.1",
|
|
123
95
|
"react": "^16.12.0",
|
|
124
96
|
"react-dom": "^16.12.0",
|
|
125
97
|
"rollup": "^1.28.0",
|
|
@@ -127,6 +99,9 @@
|
|
|
127
99
|
"ua-parser-js": "^0.7.21"
|
|
128
100
|
},
|
|
129
101
|
"engines": {
|
|
130
|
-
"node": ">=
|
|
102
|
+
"node": ">=14.15.0"
|
|
103
|
+
},
|
|
104
|
+
"publishConfig": {
|
|
105
|
+
"access": "public"
|
|
131
106
|
}
|
|
132
|
-
}
|
|
107
|
+
}
|
package/src/cli.js
CHANGED
|
@@ -18,7 +18,7 @@ const {presult} = require('@applitools/functional-commons');
|
|
|
18
18
|
const chalk = require('chalk');
|
|
19
19
|
const {performance, timeItAsync} = makeTiming();
|
|
20
20
|
|
|
21
|
-
(async function() {
|
|
21
|
+
(async function () {
|
|
22
22
|
try {
|
|
23
23
|
const argv = yargs
|
|
24
24
|
.usage('Usage: $0 [options]')
|
package/src/eyesStorybook.js
CHANGED
|
@@ -47,7 +47,14 @@ async function eyesStorybook({
|
|
|
47
47
|
: Number(process.env.APPLITOOLS_CONCURRENT_TABS);
|
|
48
48
|
logger.log(`Running with ${CONCURRENT_TABS} concurrent tabs`);
|
|
49
49
|
|
|
50
|
-
const {
|
|
50
|
+
const {
|
|
51
|
+
storybookUrl,
|
|
52
|
+
readStoriesTimeout,
|
|
53
|
+
reloadPagePerStory,
|
|
54
|
+
proxy,
|
|
55
|
+
testConcurrency,
|
|
56
|
+
useDnsCache,
|
|
57
|
+
} = config;
|
|
51
58
|
|
|
52
59
|
let iframeUrl;
|
|
53
60
|
try {
|
|
@@ -57,6 +64,7 @@ async function eyesStorybook({
|
|
|
57
64
|
throw new Error(`Storybook URL is not valid: ${storybookUrl}`);
|
|
58
65
|
}
|
|
59
66
|
const agentId = `eyes-storybook/${require('../package.json').version}`;
|
|
67
|
+
process.env.PUPPETEER_DISABLE_HEADLESS_WARNING = true;
|
|
60
68
|
const browser = await puppeteer.launch(config.puppeteerOptions);
|
|
61
69
|
logger.log('browser launched');
|
|
62
70
|
const page = await browser.newPage();
|
|
@@ -78,6 +86,7 @@ async function eyesStorybook({
|
|
|
78
86
|
serverUrl: config.serverUrl,
|
|
79
87
|
apiKey: config.apiKey,
|
|
80
88
|
agentId,
|
|
89
|
+
useDnsCache,
|
|
81
90
|
};
|
|
82
91
|
const [error, account] = await presult(core.getAccountInfo({settings, logger}));
|
|
83
92
|
|
|
@@ -96,6 +105,7 @@ async function eyesStorybook({
|
|
|
96
105
|
...account,
|
|
97
106
|
proxy,
|
|
98
107
|
concurrency: testConcurrency,
|
|
108
|
+
useDnsCache,
|
|
99
109
|
},
|
|
100
110
|
logger,
|
|
101
111
|
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Find the path to the given npm command.
|
|
6
|
+
* It goes recursively up the directory tree until it finds the command, like npm itself does.
|
|
7
|
+
* @param {string} npmModuleCommand - The npm command to find.
|
|
8
|
+
* @param {string} packageJsonDirPath - the directory in which to start searching for the command.
|
|
9
|
+
* @returns {Promise<string|null>} The path to the command.
|
|
10
|
+
*/
|
|
11
|
+
module.exports = async function findNpmModuleCommandPath(npmModuleCommand, packageJsonDirPath) {
|
|
12
|
+
const isWindows = process.platform.startsWith('win');
|
|
13
|
+
|
|
14
|
+
let checkRootPath = path.resolve(packageJsonDirPath);
|
|
15
|
+
while (checkRootPath !== '') {
|
|
16
|
+
const commandPath = path.join(
|
|
17
|
+
checkRootPath,
|
|
18
|
+
'node_modules',
|
|
19
|
+
'.bin',
|
|
20
|
+
npmModuleCommand + (isWindows ? '.cmd' : ''),
|
|
21
|
+
);
|
|
22
|
+
if (await doesFileExist(commandPath)) return commandPath;
|
|
23
|
+
|
|
24
|
+
const nextPath = path.dirname(checkRootPath);
|
|
25
|
+
if (nextPath === checkRootPath) break; // the top of the file tree is reached
|
|
26
|
+
|
|
27
|
+
checkRootPath = nextPath;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return null;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Check whether a file exists asynchronously.
|
|
35
|
+
* @param {string} filePath
|
|
36
|
+
* @returns {Promise<boolean>}
|
|
37
|
+
*/
|
|
38
|
+
function doesFileExist(filePath) {
|
|
39
|
+
return new Promise(resolve => {
|
|
40
|
+
fs.stat(filePath, (err, stats) => {
|
|
41
|
+
if (err) resolve(false);
|
|
42
|
+
else if (stats != null && stats.isFile()) resolve(true);
|
|
43
|
+
else resolve(false);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
package/src/processResults.js
CHANGED
|
@@ -79,10 +79,10 @@ function processResults({
|
|
|
79
79
|
`\nA total of ${unresolved.length} difference${pluralize(unresolved, [
|
|
80
80
|
's were',
|
|
81
81
|
' was',
|
|
82
|
-
])} found and ${errors.length} stor${pluralize(errors, [
|
|
83
|
-
|
|
84
|
-
'
|
|
85
|
-
|
|
82
|
+
])} found and ${errors.length} stor${pluralize(errors, ['ies', 'y'])} failed for ${pluralize(
|
|
83
|
+
errors,
|
|
84
|
+
['', 'an '],
|
|
85
|
+
)}unexpected error${pluralize(errors)}.`,
|
|
86
86
|
);
|
|
87
87
|
} else if (warnForUnsavedNewTests) {
|
|
88
88
|
const countText =
|
|
@@ -15,7 +15,7 @@ class StorybookConnector extends EventEmitter {
|
|
|
15
15
|
sbArg,
|
|
16
16
|
}) {
|
|
17
17
|
super();
|
|
18
|
-
this._storybookPath =
|
|
18
|
+
this._storybookPath = storybookPath;
|
|
19
19
|
this._storybookPort = storybookPort;
|
|
20
20
|
this._storybookHost = storybookHost;
|
|
21
21
|
this._storybookConfigDir = storybookConfigDir;
|
|
@@ -11,13 +11,9 @@ const {
|
|
|
11
11
|
} = require('./errMessages');
|
|
12
12
|
const startStorybookServer = require('./startStorybookServer');
|
|
13
13
|
const {isIE} = require('./shouldRenderIE');
|
|
14
|
-
const {resolve} = require('path');
|
|
15
|
-
const {exec} = require('child_process');
|
|
16
|
-
const {promisify: p} = require('util');
|
|
17
|
-
const pexec = p(exec);
|
|
18
|
-
// eslint-disable-next-line
|
|
19
|
-
const semver = require('semver');
|
|
20
14
|
const {makeLogger} = require('@applitools/logger');
|
|
15
|
+
const findNpmModuleCommandPath = require('./findNpmModuleCommandPath');
|
|
16
|
+
const {resolve} = require('path');
|
|
21
17
|
|
|
22
18
|
async function validateAndPopulateConfig({config, packagePath = '', logger = makeLogger()}) {
|
|
23
19
|
if (!config.apiKey) {
|
|
@@ -82,23 +78,30 @@ async function validateAndPopulateConfig({config, packagePath = '', logger = mak
|
|
|
82
78
|
}
|
|
83
79
|
|
|
84
80
|
async function determineStorybookVersion(packagePath) {
|
|
85
|
-
let
|
|
86
|
-
|
|
81
|
+
let sbArg,
|
|
82
|
+
storybookPath,
|
|
87
83
|
isVersion7 = false;
|
|
84
|
+
|
|
88
85
|
const storybookPathV6 = resolve(packagePath, 'node_modules/.bin/start-storybook');
|
|
89
86
|
const storybookPathV7 = resolve(packagePath, 'node_modules/.bin/sb');
|
|
90
87
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
88
|
+
// first we look for the binaries in the local node_modules/.bin folder in case there are multiple versions of storybook installed
|
|
89
|
+
if (fs.existsSync(storybookPathV6)) {
|
|
90
|
+
storybookPath = storybookPathV6;
|
|
91
|
+
} else if (fs.existsSync(storybookPathV7)) {
|
|
92
|
+
storybookPath = storybookPathV7;
|
|
93
|
+
isVersion7 = true;
|
|
94
|
+
sbArg = 'dev';
|
|
95
|
+
} else {
|
|
96
|
+
// the binary is not in the local node_modules/.bin folder, so we need to find it
|
|
97
|
+
storybookPath = await findNpmModuleCommandPath('start-storybook', packagePath);
|
|
98
|
+
if (!storybookPath) {
|
|
99
|
+
storybookPath = await findNpmModuleCommandPath('sb', packagePath);
|
|
98
100
|
isVersion7 = true;
|
|
101
|
+
sbArg = 'dev';
|
|
102
|
+
} else {
|
|
103
|
+
isVersion7 = false;
|
|
99
104
|
}
|
|
100
|
-
} else {
|
|
101
|
-
storybookPath = storybookPathV6;
|
|
102
105
|
}
|
|
103
106
|
|
|
104
107
|
return {storybookPath, isVersion7, sbArg};
|
package/src/wrapBundle.js
CHANGED
package/src/yargsOptions.js
CHANGED
|
@@ -54,7 +54,7 @@ module.exports = {
|
|
|
54
54
|
'A string that represents a story title or a regex (starts and ends with /) to match stories title',
|
|
55
55
|
requiresArg: false,
|
|
56
56
|
string: true,
|
|
57
|
-
coerce: function(arg) {
|
|
57
|
+
coerce: function (arg) {
|
|
58
58
|
if (arg.startsWith('/') && arg.endsWith('/')) {
|
|
59
59
|
// create a regex and remove slashes from the start and end of the input
|
|
60
60
|
return new RegExp(arg.substring(1, arg.length - 1));
|