bdy 1.25.2-dev → 1.25.2-stage

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.
Files changed (40) hide show
  1. package/distTs/package.json +1 -1
  2. package/package.json +1 -1
  3. package/distTs/README.md +0 -181
  4. package/distTs/src/autocomplete.js +0 -90
  5. package/distTs/src/command/autocomplete/install.js +0 -16
  6. package/distTs/src/command/autocomplete/uninstall.js +0 -16
  7. package/distTs/src/command/autocomplete.js +0 -14
  8. package/distTs/src/command/environment/resolve.js +0 -47
  9. package/distTs/src/command/package/create.js +0 -64
  10. package/distTs/src/command/package/delete.js +0 -38
  11. package/distTs/src/command/package/docker/login.js +0 -26
  12. package/distTs/src/command/package/docker.js +0 -11
  13. package/distTs/src/command/package/download.js +0 -138
  14. package/distTs/src/command/package/get.js +0 -36
  15. package/distTs/src/command/package/list.js +0 -31
  16. package/distTs/src/command/package/publish.js +0 -241
  17. package/distTs/src/command/package/version/delete.js +0 -39
  18. package/distTs/src/command/package/version/get.js +0 -45
  19. package/distTs/src/command/package/version/list.js +0 -47
  20. package/distTs/src/command/package/version.js +0 -16
  21. package/distTs/src/command/package.js +0 -26
  22. package/distTs/src/command/project/get.js +0 -18
  23. package/distTs/src/command/project/set.js +0 -31
  24. package/distTs/src/command/sandbox/get/yaml.js +0 -30
  25. package/distTs/src/command/scrape/validation.js +0 -154
  26. package/distTs/src/command/scrape.js +0 -144
  27. package/distTs/src/command/ut/upload.js +0 -86
  28. package/distTs/src/command/ut.js +0 -12
  29. package/distTs/src/command/vt/close.js +0 -27
  30. package/distTs/src/command/vt/compare/validation.js +0 -46
  31. package/distTs/src/command/vt/compare.js +0 -100
  32. package/distTs/src/command/vt/exec.js +0 -82
  33. package/distTs/src/command/vt/installBrowser.js +0 -20
  34. package/distTs/src/command/vt/scrape.js +0 -193
  35. package/distTs/src/command/vt/shared/validation.js +0 -145
  36. package/distTs/src/command/vt/storybook.js +0 -138
  37. package/distTs/src/command/vt.js +0 -20
  38. package/distTs/src/main.js +0 -190
  39. package/distTs/src/types/options.js +0 -2
  40. package/distTs/src/types/scrape.js +0 -2
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const utils_1 = require("../../utils");
7
- const texts_1 = require("../../texts");
8
- const output_1 = __importDefault(require("../../output"));
9
- const commandVtInstallBrowser = (0, utils_1.newCommand)('install-browser', texts_1.DESC_COMMAND_VT_INSTALL_BROWSER);
10
- commandVtInstallBrowser.action(async () => {
11
- try {
12
- const { installBrowser } = require('../../visualTest/browser');
13
- await installBrowser();
14
- output_1.default.exitNormal('');
15
- }
16
- catch (error) {
17
- output_1.default.exitError(`${error}`);
18
- }
19
- });
20
- exports.default = commandVtInstallBrowser;
@@ -1,193 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const utils_1 = require("../../utils");
7
- const commander_1 = require("commander");
8
- const texts_1 = require("../../texts");
9
- const validation_1 = require("../../visualTest/validation");
10
- const output_1 = __importDefault(require("../../output"));
11
- const requests_1 = require("../../visualTest/requests");
12
- const zod_1 = require("zod");
13
- const node_zlib_1 = require("node:zlib");
14
- const tar_stream_1 = __importDefault(require("tar-stream"));
15
- const promises_1 = require("node:stream/promises");
16
- const node_fs_1 = require("node:fs");
17
- const node_path_1 = __importDefault(require("node:path"));
18
- const promises_2 = require("node:fs/promises");
19
- const commandScrape = (0, utils_1.newCommand)('scrape', texts_1.DESC_COMMAND_VT_SCRAPE);
20
- commandScrape.argument('<url>', texts_1.OPTION_SCRAPE_URL);
21
- commandScrape.option('--follow', texts_1.OPTION_SCRAPE_FOLLOW, false);
22
- commandScrape.addOption(new commander_1.Option('--outputType <type>', texts_1.OPTION_SCRAPE_OUTPUT_TYPE)
23
- .choices(['jpeg', 'png', 'md', 'html'])
24
- .makeOptionMandatory());
25
- commandScrape.option('--quality <quality>', texts_1.OPTION_SCRAPE_QUALITY);
26
- commandScrape.option('--fullPage', texts_1.OPTION_SCRAPE_FULL_PAGE, false);
27
- commandScrape.option('--cssSelector <selector>', texts_1.OPTION_SCRAPE_CSS_SELECTOR);
28
- commandScrape.option('--xpathSelector <selector>', texts_1.OPTION_SCRAPE_XPATH_SELECTOR);
29
- commandScrape.addOption(new commander_1.Option('--browser <browser>', texts_1.OPTION_SCRAPE_BROWSER)
30
- .choices(['chrome', 'firefox', 'safari'])
31
- .default('chrome'));
32
- commandScrape.option('--viewport <viewport>', texts_1.OPTION_SCRAPE_VIEWPORT, '1920x1080');
33
- commandScrape.option('--devicePixelRatio <ratio>', texts_1.OPTION_SCRAPE_DEVICE_PIXEL_RATIO, '1');
34
- commandScrape.option('--waitForElement <selector>', texts_1.OPTION_SCRAPE_WAIT_FOR_ELEMENT);
35
- commandScrape.option('--darkMode', texts_1.OPTION_SCRAPE_DARK_MODE, false);
36
- commandScrape.option('--delay <delay>', texts_1.OPTION_SCRAPE_DELAY, '0');
37
- commandScrape.option('--outputDir <dir>', texts_1.OPTION_SCRAPE_OUTPUT_DIR, '.');
38
- commandScrape.action(async (inputUrl, options) => {
39
- if (!(0, validation_1.checkToken)()) {
40
- output_1.default.exitError(texts_1.ERR_MISSING_VT_TOKEN);
41
- }
42
- const { url, follow, outputType, quality, outputDir, fullPage, cssSelector, xpathSelector, browser, viewport, devicePixelRatio, darkMode, delay, waitForElement, } = validateInputAndOptions(inputUrl, options);
43
- try {
44
- const { buildId } = await (0, requests_1.sendScrap)(url, outputType, follow, quality, fullPage, cssSelector, xpathSelector, browser, viewport, devicePixelRatio, darkMode, delay, waitForElement);
45
- output_1.default.normal('Starting scrape session');
46
- const status = await watchSessionStatus(buildId);
47
- if (!status.ok) {
48
- output_1.default.exitError(`Unexpected error while watching session status: ${status.error}`);
49
- }
50
- output_1.default.normal('Downloading scrape package');
51
- const scrapPackageStream = await (0, requests_1.downloadScrapPackage)(buildId);
52
- const brotliDecompressor = (0, node_zlib_1.createBrotliDecompress)();
53
- const unpack = tar_stream_1.default.extract();
54
- unpack.on('entry', async (header, stream, next) => {
55
- const currentDir = process.cwd();
56
- const preparedOutputDir = outputDir.startsWith('.')
57
- ? node_path_1.default.join(currentDir, outputDir)
58
- : outputDir;
59
- const newFilePath = node_path_1.default.join(preparedOutputDir, header.name);
60
- try {
61
- if (header.type === 'file') {
62
- await (0, promises_2.mkdir)(node_path_1.default.dirname(newFilePath), { recursive: true });
63
- const fileWriteStream = (0, node_fs_1.createWriteStream)(newFilePath);
64
- await (0, promises_1.pipeline)(stream, fileWriteStream);
65
- next();
66
- }
67
- else {
68
- stream.resume();
69
- next();
70
- }
71
- }
72
- catch (entryError) {
73
- output_1.default.error(`Error processing entry ${header.name}: ${entryError}`);
74
- next(entryError);
75
- }
76
- });
77
- await (0, promises_1.pipeline)(scrapPackageStream, brotliDecompressor, unpack);
78
- output_1.default.exitSuccess('Downloading scrape package finished');
79
- }
80
- catch (error) {
81
- output_1.default.exitError(`${error}`);
82
- }
83
- });
84
- function validateInputAndOptions(input, options) {
85
- const urlSchema = zod_1.z.string().url();
86
- const optionsSchema = zod_1.z.object({
87
- follow: zod_1.z.boolean(),
88
- outputType: zod_1.z.enum(['jpeg', 'png', 'md', 'html']),
89
- quality: zod_1.z.coerce.number().min(1).max(100).optional(),
90
- outputDir: zod_1.z.string().default('.'),
91
- fullPage: zod_1.z.boolean().optional(),
92
- cssSelector: zod_1.z.string().optional(),
93
- xpathSelector: zod_1.z.string().optional(),
94
- browser: zod_1.z.enum(['chrome', 'firefox', 'safari']),
95
- viewport: zod_1.z
96
- .string()
97
- .refine((value) => {
98
- const [width, height] = value.split('x');
99
- return (width &&
100
- height &&
101
- !isNaN(Number(width)) &&
102
- !isNaN(Number(height)) &&
103
- Number(width) > 0 &&
104
- Number(height) > 0);
105
- }, 'Invalid viewport format, example: 1920x1080')
106
- .transform((value) => {
107
- const [width, height] = value.split('x');
108
- return {
109
- width: Number(width),
110
- height: Number(height),
111
- };
112
- }),
113
- devicePixelRatio: zod_1.z.coerce.number().min(1).max(4),
114
- darkMode: zod_1.z.boolean(),
115
- delay: zod_1.z.coerce.number().min(0).max(10000),
116
- waitForElement: zod_1.z.string().optional(),
117
- });
118
- try {
119
- const url = urlSchema.parse(input);
120
- const { follow, outputType, quality, outputDir, fullPage, cssSelector, xpathSelector, browser, viewport, devicePixelRatio, darkMode, delay, waitForElement, } = optionsSchema.parse(options);
121
- if (typeof quality === 'number' && outputType !== 'jpeg') {
122
- output_1.default.exitError('Quality is only supported for jpeg output type, use --outputType jpeg');
123
- }
124
- if (cssSelector && xpathSelector) {
125
- output_1.default.exitError('Only one of --cssSelector or --xpathSelector can be used');
126
- }
127
- return {
128
- url,
129
- follow,
130
- outputType,
131
- quality,
132
- outputDir,
133
- fullPage,
134
- cssSelector,
135
- xpathSelector,
136
- browser,
137
- viewport,
138
- devicePixelRatio,
139
- darkMode,
140
- delay,
141
- waitForElement,
142
- };
143
- }
144
- catch (error) {
145
- if (error instanceof zod_1.ZodError) {
146
- output_1.default.exitError(error.errors.map((e) => `${e.path}: ${e.message}`).join(', '));
147
- }
148
- else {
149
- throw error;
150
- }
151
- }
152
- }
153
- async function watchSessionStatus(buildId) {
154
- return new Promise((resolve) => {
155
- const eventSource = (0, requests_1.connectToScrapSession)(buildId);
156
- eventSource.addEventListener('SESSION_STATUS', (event) => {
157
- const data = JSON.parse(event.data);
158
- if (data.status === 'GATHER_URLS_COMPLETED') {
159
- output_1.default.normal(`Gathering URLs completed, found ${data.text} URLs`);
160
- }
161
- else if (data.status === 'GATHER_URLS_FAILED') {
162
- output_1.default.error('Gathering URLs failed');
163
- }
164
- else if (data.status === 'SCRAPE_URL_COMPLETED') {
165
- output_1.default.normal(`Scraping ${data.text} completed`);
166
- }
167
- else if (data.status === 'SCRAPE_URL_FAILED') {
168
- output_1.default.error(`Scraping ${data.text} failed`);
169
- }
170
- else if (data.status === 'CREATE_PACKAGE_COMPLETED') {
171
- output_1.default.normal('Package created');
172
- }
173
- else if (data.status === 'CREATE_PACKAGE_FAILED') {
174
- output_1.default.error('Package creation failed');
175
- }
176
- else if (data.status === 'FINISHED') {
177
- eventSource.close();
178
- output_1.default.normal('Scrape session finished');
179
- resolve({ ok: true });
180
- }
181
- });
182
- eventSource.addEventListener('error', (event) => {
183
- if (event.code) {
184
- eventSource.close();
185
- if (event.code === 410) {
186
- output_1.default.normal('Scrape session finished');
187
- }
188
- resolve({ ok: event.code === 410, error: event.code });
189
- }
190
- });
191
- });
192
- }
193
- exports.default = commandScrape;
@@ -1,145 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.waitForSchema = exports.delaySchema = exports.headerSchema = exports.cookieSchema = exports.DEFAULT_SCOPE = void 0;
7
- exports.parseScopedSelector = parseScopedSelector;
8
- exports.parseScopedKeyValue = parseScopedKeyValue;
9
- const zod_1 = require("zod");
10
- const output_1 = __importDefault(require("../../../output"));
11
- exports.DEFAULT_SCOPE = '**';
12
- function parseScopedSelector(value) {
13
- return value?.map((v) => {
14
- let scope, type, selectorValue;
15
- if (v.includes('::CSS=') || v.includes('::XPATH=')) {
16
- const [scopePart, ...rest] = v.split('::');
17
- const [typePart, ...valuePart] = rest.join('::').split('=');
18
- type = typePart;
19
- selectorValue = valuePart.join('=');
20
- scope = scopePart;
21
- }
22
- else {
23
- const [typePart, ...valuePart] = v.split('=');
24
- type = typePart;
25
- selectorValue = valuePart.join('=');
26
- scope = exports.DEFAULT_SCOPE;
27
- }
28
- return { scope, type, value: selectorValue };
29
- });
30
- }
31
- function parseScopedKeyValue(rawValue) {
32
- let scope = exports.DEFAULT_SCOPE;
33
- let keyValue = rawValue;
34
- const scopeSeparatorIndex = rawValue.indexOf('::');
35
- if (scopeSeparatorIndex >= 0) {
36
- scope = rawValue.slice(0, scopeSeparatorIndex).trim();
37
- keyValue = rawValue.slice(scopeSeparatorIndex + 2).trim();
38
- }
39
- const equalSignIndex = keyValue.indexOf('=');
40
- if (equalSignIndex <= 0) {
41
- output_1.default.exitError("Option value must follow pattern '[scope::]key=value' (scope is optional)");
42
- }
43
- const key = keyValue.slice(0, equalSignIndex).trim();
44
- const value = keyValue.slice(equalSignIndex + 1).trim();
45
- if (!key) {
46
- output_1.default.exitError('Option key cannot be empty');
47
- }
48
- return { scope, key, value };
49
- }
50
- exports.cookieSchema = zod_1.z
51
- .array(zod_1.z
52
- .string()
53
- .max(4096, {
54
- message: 'Cookie must be less than 4096 characters',
55
- })
56
- .regex(/^(?:([^:]+)::)?([^=]+)=(.*)$/, {
57
- message: "Cookie option must follow pattern '[scope::]key=value[;attribute]' (scope is optional)",
58
- }))
59
- .optional()
60
- .transform((value) => value?.map((v) => {
61
- let scope = exports.DEFAULT_SCOPE;
62
- let cookieValue = v;
63
- if (v.includes('::')) {
64
- const [scopePart, valuePart] = v.split('::');
65
- scope = scopePart.trim();
66
- cookieValue = valuePart.trim();
67
- }
68
- const cookieParts = cookieValue.split(';').map((part) => part.trim());
69
- const mainPart = cookieParts[0];
70
- const firstEqualSignIndex = mainPart.indexOf('=');
71
- const key = mainPart.slice(0, firstEqualSignIndex).trim();
72
- const value = mainPart.slice(firstEqualSignIndex + 1).trim();
73
- const cookie = {
74
- scope,
75
- key,
76
- value,
77
- httpOnly: false,
78
- secure: false,
79
- };
80
- for (let i = 1; i < cookieParts.length; i++) {
81
- const part = cookieParts[i].toLowerCase();
82
- if (part === 'httponly') {
83
- cookie.httpOnly = true;
84
- }
85
- else if (part === 'secure') {
86
- cookie.secure = true;
87
- }
88
- else if (part.startsWith('domain=')) {
89
- cookie.domain = part.substring(7);
90
- }
91
- else if (part.startsWith('path=')) {
92
- cookie.path = part.substring(5);
93
- }
94
- else if (part.startsWith('samesite=')) {
95
- const sameSiteValue = part.substring(9);
96
- if (['strict', 'lax', 'none'].includes(sameSiteValue)) {
97
- cookie.sameSite = (sameSiteValue.charAt(0).toUpperCase() +
98
- sameSiteValue.slice(1));
99
- }
100
- }
101
- }
102
- return cookie;
103
- }));
104
- exports.headerSchema = zod_1.z
105
- .array(zod_1.z.string().regex(/^(?:([^:]+)::)?([^=]+)=(.*)$/, {
106
- message: "Header option must follow pattern '[scope::]key=value' (scope is optional)",
107
- }))
108
- .optional()
109
- .transform((value) => value?.map((v) => {
110
- const { scope, key, value } = parseScopedKeyValue(v);
111
- return { scope, key, value };
112
- }));
113
- exports.delaySchema = zod_1.z
114
- .array(zod_1.z.string().regex(/^(?:([^:]+)::)?(\d+)$/, {
115
- message: "Delay option must follow pattern '[scope::]milliseconds' (scope is optional)",
116
- }))
117
- .optional()
118
- .transform((value) => value?.map((v) => {
119
- let scope = exports.DEFAULT_SCOPE;
120
- let milliseconds;
121
- if (v.includes('::')) {
122
- const [scopePart, msPart] = v.split('::');
123
- scope = scopePart.trim();
124
- milliseconds = Number(msPart);
125
- }
126
- else {
127
- milliseconds = Number(v);
128
- }
129
- if (milliseconds < 1 || milliseconds > 60000) {
130
- throw new zod_1.z.ZodError([
131
- {
132
- code: 'custom',
133
- message: 'Delay must be between 1 and 60000 milliseconds',
134
- path: [],
135
- },
136
- ]);
137
- }
138
- return { scope, value: milliseconds };
139
- }));
140
- exports.waitForSchema = zod_1.z
141
- .array(zod_1.z.string().regex(/^(?:([^:]+)::)?(?:(CSS|XPATH))=(.+)$/, {
142
- message: "WaitFor option must follow pattern '[scope::]type=value' where type must be CSS or XPATH (scope is optional)",
143
- }))
144
- .optional()
145
- .transform(parseScopedSelector);
@@ -1,138 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const utils_1 = require("../../utils");
7
- const texts_1 = require("../../texts");
8
- const output_1 = __importDefault(require("../../output"));
9
- const node_fs_1 = require("node:fs");
10
- const node_path_1 = __importDefault(require("node:path"));
11
- const node_zlib_1 = require("node:zlib");
12
- const commandVtStorybook = (0, utils_1.newCommand)('storybook', texts_1.DESC_COMMAND_VT_STORYBOOK);
13
- commandVtStorybook.action(async () => {
14
- const { getCiAndGitInfo, formattedCiInfo } = require('@buddy-works/ci-info');
15
- const { checkToken } = require('../../visualTest/validation');
16
- const { getDefaultSettings, sendStorybook } = require('../../visualTest/requests');
17
- const { setDefaultSettings } = require('../../visualTest/snapshots');
18
- const { setCiAndCommitInfo } = require('../../visualTest/context');
19
- if (!checkToken('vt')) {
20
- output_1.default.exitError(texts_1.ERR_MISSING_VT_TOKEN);
21
- }
22
- const currentDirectoryFiles = getCurrentDirectoryFiles();
23
- if (!isStorybookDirectory(currentDirectoryFiles)) {
24
- output_1.default.exitError(texts_1.ERR_WRONG_STORYBOOK_DIRECTORY);
25
- }
26
- const storybookStoriesIndex = getStorybookStoriesIndex(currentDirectoryFiles);
27
- const storiesList = getStoriesList(storybookStoriesIndex);
28
- const storybookSnapshots = getStorybookSnapshots(storiesList);
29
- const defaultSettings = await getDefaultSettings();
30
- setDefaultSettings(defaultSettings);
31
- const ciAndGitInfo = await getCiAndGitInfo({
32
- baseBranch: defaultSettings.baseBranch,
33
- logger: output_1.default.warning,
34
- });
35
- setCiAndCommitInfo(ciAndGitInfo);
36
- output_1.default.normal(formattedCiInfo(ciAndGitInfo));
37
- try {
38
- const compressedStorybookDirectory = await createCompressedStorybookDirectory(currentDirectoryFiles);
39
- const { message } = await sendStorybook(storybookSnapshots, compressedStorybookDirectory);
40
- output_1.default.exitSuccess(message);
41
- }
42
- catch (error) {
43
- output_1.default.exitError(`${error}`);
44
- }
45
- });
46
- function getCurrentDirectoryFiles() {
47
- const cwd = process.cwd();
48
- const filesAndDirectories = (0, node_fs_1.readdirSync)(cwd, {
49
- encoding: 'utf8',
50
- recursive: true,
51
- });
52
- return filesAndDirectories.filter((file) => {
53
- const elementPath = node_path_1.default.join(cwd, file);
54
- const stats = (0, node_fs_1.statSync)(elementPath);
55
- return stats.isFile();
56
- });
57
- }
58
- async function createCompressedStorybookDirectory(files) {
59
- const tar = require('tar-stream');
60
- const cwd = process.cwd();
61
- const chunks = [];
62
- return new Promise((resolve, reject) => {
63
- const compressStream = (0, node_zlib_1.createBrotliCompress)({
64
- params: {
65
- [node_zlib_1.constants.BROTLI_PARAM_QUALITY]: 6,
66
- },
67
- });
68
- compressStream.on('data', (chunk) => {
69
- chunks.push(chunk);
70
- });
71
- compressStream.on('end', () => {
72
- resolve(Buffer.concat(chunks));
73
- });
74
- compressStream.on('error', reject);
75
- const packStream = tar.pack();
76
- packStream.pipe(compressStream);
77
- let filesProcessed = 0;
78
- for (const file of files) {
79
- const filePath = node_path_1.default.join(cwd, file);
80
- const stats = (0, node_fs_1.statSync)(filePath);
81
- const entry = packStream.entry({
82
- name: file,
83
- size: stats.size,
84
- }, (error) => {
85
- if (error) {
86
- reject(error);
87
- }
88
- else {
89
- filesProcessed += 1;
90
- if (filesProcessed === files.length) {
91
- packStream.finalize();
92
- }
93
- }
94
- });
95
- const fileStream = (0, node_fs_1.createReadStream)(filePath);
96
- fileStream.pipe(entry);
97
- fileStream.on('error', reject);
98
- }
99
- });
100
- }
101
- function isStorybookDirectory(files) {
102
- return (files.length > 0 &&
103
- files.includes('index.html') &&
104
- files.includes('iframe.html'));
105
- }
106
- function getStorybookStoriesIndex(files) {
107
- const indexFiles = files.find((file) => file === 'index.json');
108
- if (indexFiles) {
109
- return indexFiles;
110
- }
111
- else {
112
- return output_1.default.exitError(texts_1.ERR_MISSING_STORYBOOK_INDEX_FILE);
113
- }
114
- }
115
- function getStoriesList(storybookStoriesIndex) {
116
- const storiesListFile = (0, node_fs_1.readFileSync)(storybookStoriesIndex);
117
- try {
118
- const json = JSON.parse(storiesListFile.toString());
119
- if (![4, 5].includes(json.v)) {
120
- output_1.default.exitError(texts_1.ERR_UNSUPPORTED_STORYBOOK);
121
- }
122
- return json;
123
- }
124
- catch {
125
- output_1.default.exitError(texts_1.ERR_PARSING_STORIES);
126
- }
127
- }
128
- function getStorybookSnapshots(storiesList) {
129
- const stories = Object.entries(storiesList.entries)
130
- .filter(([, value]) => value.type === 'story')
131
- .map(([key, value]) => ({
132
- id: key,
133
- name: `${value.title}/${value.name}`,
134
- }));
135
- output_1.default.normal((0, texts_1.TXT_STORIES_AMOUNT)(stories.length));
136
- return stories;
137
- }
138
- exports.default = commandVtStorybook;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const texts_1 = require("../texts");
7
- const utils_1 = require("../utils");
8
- const close_1 = __importDefault(require("./vt/close"));
9
- const storybook_1 = __importDefault(require("./vt/storybook"));
10
- const exec_1 = __importDefault(require("./vt/exec"));
11
- const installBrowser_1 = __importDefault(require("./vt/installBrowser"));
12
- const compare_1 = __importDefault(require("./vt/compare"));
13
- const commandVt = (0, utils_1.newCommand)('visual', texts_1.DESC_COMMAND_VT);
14
- commandVt.alias('vt');
15
- commandVt.addCommand(close_1.default);
16
- commandVt.addCommand(storybook_1.default);
17
- commandVt.addCommand(exec_1.default);
18
- commandVt.addCommand(installBrowser_1.default);
19
- commandVt.addCommand(compare_1.default);
20
- exports.default = commandVt;