bdy 1.17.13-dev → 1.17.15-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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.17.13-dev",
4
+ "version": "1.17.15-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -101,7 +101,10 @@ const initRepo = async (workspace, project, path, git, options) => {
101
101
  output_1.default.exitNormal();
102
102
  }
103
103
  }
104
- await (0, utils_1.execLocally)("git config credential.helper '!bdy project git credential'", {
104
+ await (0, utils_1.execLocally)('git config --local credential.helper ""', {
105
+ cwd: path,
106
+ });
107
+ await (0, utils_1.execLocally)("git config --local credential.helper '!bdy project git credential'", {
105
108
  cwd: path,
106
109
  });
107
110
  };
@@ -12,8 +12,9 @@ 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");
16
15
  const ci_info_1 = require("@buddy-works/ci-info");
16
+ const tar_stream_1 = __importDefault(require("tar-stream"));
17
+ const node_zlib_1 = require("node:zlib");
17
18
  const commandVtStorybook = (0, utils_1.newCommand)('storybook', texts_1.DESC_COMMAND_VT_STORYBOOK);
18
19
  commandVtStorybook.action(async () => {
19
20
  if (!(0, validation_1.checkToken)()) {
@@ -34,8 +35,8 @@ commandVtStorybook.action(async () => {
34
35
  });
35
36
  (0, context_1.setCiAndCommitInfo)(ciAndGitInfo);
36
37
  output_1.default.normal((0, ci_info_1.formattedCiInfo)(ciAndGitInfo));
37
- const compressedStorybookDirectory = await createCompressedStorybookDirectory(currentDirectoryFiles);
38
38
  try {
39
+ const compressedStorybookDirectory = await createCompressedStorybookDirectory(currentDirectoryFiles);
39
40
  const { message } = await (0, requests_1.sendStorybook)(storybookSnapshots, compressedStorybookDirectory);
40
41
  output_1.default.exitSuccess(message);
41
42
  }
@@ -59,34 +60,42 @@ async function createCompressedStorybookDirectory(files) {
59
60
  const cwd = process.cwd();
60
61
  const chunks = [];
61
62
  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
- }
63
+ const compressStream = (0, node_zlib_1.createBrotliCompress)({
64
+ params: {
65
+ [node_zlib_1.constants.BROTLI_PARAM_QUALITY]: 6,
66
+ },
73
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_stream_1.default.pack();
76
+ packStream.pipe(compressStream);
77
+ let filesProcessed = 0;
74
78
  for (const file of files) {
75
79
  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);
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
+ }
87
94
  });
95
+ const fileStream = (0, node_fs_1.createReadStream)(filePath);
96
+ fileStream.pipe(entry);
97
+ fileStream.on('error', reject);
88
98
  }
89
- zipper.end();
90
99
  });
91
100
  }
92
101
  function isStorybookDirectory(files) {
@@ -205,8 +205,8 @@ async function sendStorybook(snapshots, compressedStorybookDirectory) {
205
205
  };
206
206
  const files = [
207
207
  {
208
- id: 'storybook-static.zip',
209
- body: new Blob([compressedStorybookDirectory.buffer]),
208
+ id: 'storybook-static.tar.br',
209
+ body: new Blob([new Uint8Array(compressedStorybookDirectory)]),
210
210
  },
211
211
  ];
212
212
  const formData = createFormData(info, files);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.17.13-dev",
4
+ "version": "1.17.15-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {