bdy 1.13.0-dev → 1.14.0-dev
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/distTs/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bdy",
|
|
3
3
|
"preferGlobal": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.14.0-dev",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
"uuid": "10.0.0",
|
|
53
53
|
"which": "4.0.0",
|
|
54
54
|
"ws": "8.18.0",
|
|
55
|
-
"zod": "3.24.2"
|
|
55
|
+
"zod": "3.24.2",
|
|
56
|
+
"fflate": "0.8.2"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@eslint/js": "9.13.0",
|
|
@@ -12,6 +12,7 @@ const snapshots_1 = require("../../visualTest/snapshots");
|
|
|
12
12
|
const context_1 = require("../../visualTest/context");
|
|
13
13
|
const node_fs_1 = require("node:fs");
|
|
14
14
|
const node_path_1 = __importDefault(require("node:path"));
|
|
15
|
+
const fflate_1 = require("fflate");
|
|
15
16
|
const ci_info_1 = require("@buddy-works/ci-info");
|
|
16
17
|
const commandVtStorybook = (0, utils_1.newCommand)('storybook', texts_1.DESC_COMMAND_VT_STORYBOOK);
|
|
17
18
|
commandVtStorybook.action(async () => {
|
|
@@ -33,8 +34,9 @@ commandVtStorybook.action(async () => {
|
|
|
33
34
|
});
|
|
34
35
|
(0, context_1.setCiAndCommitInfo)(ciAndGitInfo);
|
|
35
36
|
output_1.default.normal((0, ci_info_1.formattedCiInfo)(ciAndGitInfo));
|
|
37
|
+
const compressedStorybookDirectory = await createCompressedStorybookDirectory(currentDirectoryFiles);
|
|
36
38
|
try {
|
|
37
|
-
const { message } = await (0, requests_1.sendStorybook)(storybookSnapshots,
|
|
39
|
+
const { message } = await (0, requests_1.sendStorybook)(storybookSnapshots, compressedStorybookDirectory);
|
|
38
40
|
output_1.default.exitSuccess(message);
|
|
39
41
|
}
|
|
40
42
|
catch (error) {
|
|
@@ -53,6 +55,40 @@ function getCurrentDirectoryFiles() {
|
|
|
53
55
|
return stats.isFile();
|
|
54
56
|
});
|
|
55
57
|
}
|
|
58
|
+
async function createCompressedStorybookDirectory(files) {
|
|
59
|
+
const cwd = process.cwd();
|
|
60
|
+
const chunks = [];
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
const zipper = new fflate_1.Zip((err, data, final) => {
|
|
63
|
+
if (err) {
|
|
64
|
+
reject(err);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (data) {
|
|
68
|
+
chunks.push(data);
|
|
69
|
+
}
|
|
70
|
+
if (final) {
|
|
71
|
+
resolve(Buffer.concat(chunks));
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
for (const file of files) {
|
|
75
|
+
const filePath = node_path_1.default.join(cwd, file);
|
|
76
|
+
const zipFile = new fflate_1.AsyncZipDeflate(file, { level: 9 });
|
|
77
|
+
zipper.add(zipFile);
|
|
78
|
+
const fileStream = (0, node_fs_1.createReadStream)(filePath);
|
|
79
|
+
fileStream.on('data', (chunk) => {
|
|
80
|
+
zipFile.push(chunk, false);
|
|
81
|
+
});
|
|
82
|
+
fileStream.on('end', () => {
|
|
83
|
+
zipFile.push(new Uint8Array(0), true);
|
|
84
|
+
});
|
|
85
|
+
fileStream.on('error', (err) => {
|
|
86
|
+
reject(err);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
zipper.end();
|
|
90
|
+
});
|
|
91
|
+
}
|
|
56
92
|
function isStorybookDirectory(files) {
|
|
57
93
|
return (files.length > 0 &&
|
|
58
94
|
files.includes('index.html') &&
|
|
@@ -15,7 +15,6 @@ exports.connectToScrapSession = connectToScrapSession;
|
|
|
15
15
|
const context_1 = require("./context");
|
|
16
16
|
const undici_1 = require("undici");
|
|
17
17
|
const uuid_1 = require("uuid");
|
|
18
|
-
const node_fs_1 = require("node:fs");
|
|
19
18
|
const output_1 = __importDefault(require("../output"));
|
|
20
19
|
const texts_1 = require("../texts");
|
|
21
20
|
const eventsource_1 = require("eventsource");
|
|
@@ -182,7 +181,7 @@ async function getDefaultSettings() {
|
|
|
182
181
|
}
|
|
183
182
|
return response;
|
|
184
183
|
}
|
|
185
|
-
async function sendStorybook(snapshots,
|
|
184
|
+
async function sendStorybook(snapshots, compressedStorybookDirectory) {
|
|
186
185
|
const info = {
|
|
187
186
|
snapshots,
|
|
188
187
|
buildId: context_1.buildId,
|
|
@@ -201,10 +200,12 @@ async function sendStorybook(snapshots, filePaths) {
|
|
|
201
200
|
cliId: context_1.cliId,
|
|
202
201
|
executionUrl: context_1.executionUrl,
|
|
203
202
|
};
|
|
204
|
-
const files =
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
203
|
+
const files = [
|
|
204
|
+
{
|
|
205
|
+
id: 'storybook-static.zip',
|
|
206
|
+
body: new Blob([compressedStorybookDirectory.buffer]),
|
|
207
|
+
},
|
|
208
|
+
];
|
|
208
209
|
const formData = createFormData(info, files);
|
|
209
210
|
const [message, response] = await sendRequest({
|
|
210
211
|
path: '/storybook',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bdy",
|
|
3
3
|
"preferGlobal": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.14.0-dev",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
"uuid": "10.0.0",
|
|
53
53
|
"which": "4.0.0",
|
|
54
54
|
"ws": "8.18.0",
|
|
55
|
-
"zod": "3.24.2"
|
|
55
|
+
"zod": "3.24.2",
|
|
56
|
+
"fflate": "0.8.2"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@eslint/js": "9.13.0",
|