@micromag/cli 0.2.300 → 0.2.301
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/bin/export.js +3 -10
- package/lib/index.js +38 -49
- package/package.json +9 -9
package/bin/export.js
CHANGED
|
@@ -110,28 +110,21 @@ const captureStory = async (story, location, settings = {}) => {
|
|
|
110
110
|
height
|
|
111
111
|
} = defaultViewport;
|
|
112
112
|
const {
|
|
113
|
-
components: screens = null
|
|
114
|
-
metadata
|
|
113
|
+
components: screens = null
|
|
115
114
|
} = story || {};
|
|
116
|
-
const {
|
|
117
|
-
language = 'fr'
|
|
118
|
-
} = metadata || {};
|
|
119
115
|
const browser = await puppeteer__default['default'].launch({
|
|
120
116
|
devtools: DEBUG,
|
|
121
117
|
...(executablePath !== null ? {
|
|
122
118
|
executablePath
|
|
123
119
|
} : null),
|
|
124
120
|
defaultViewport,
|
|
125
|
-
args: ['--no-sandbox'
|
|
121
|
+
args: ['--no-sandbox']
|
|
126
122
|
}); // try {
|
|
127
123
|
|
|
128
124
|
const pages = await browser.pages();
|
|
129
125
|
const hasPage = pages.length > 0;
|
|
130
126
|
const page = hasPage ? pages[0] : await browser.newPage();
|
|
131
|
-
await page.
|
|
132
|
-
'Accept-Language': language
|
|
133
|
-
});
|
|
134
|
-
await page.goto(`http://127.0.0.1:${serverPort}`); //
|
|
127
|
+
await page.goto(`http://127.0.0.1:${serverPort}`);
|
|
135
128
|
|
|
136
129
|
if (screens !== null) {
|
|
137
130
|
const count = screens.length;
|
package/lib/index.js
CHANGED
|
@@ -151,10 +151,6 @@ var captureStory = /*#__PURE__*/function () {
|
|
|
151
151
|
_ref2,
|
|
152
152
|
_ref2$components,
|
|
153
153
|
screens,
|
|
154
|
-
metadata,
|
|
155
|
-
_ref3,
|
|
156
|
-
_ref3$language,
|
|
157
|
-
language,
|
|
158
154
|
browser,
|
|
159
155
|
pages,
|
|
160
156
|
hasPage,
|
|
@@ -181,66 +177,59 @@ var captureStory = /*#__PURE__*/function () {
|
|
|
181
177
|
server = _context2.sent;
|
|
182
178
|
serverPort = server.address().port;
|
|
183
179
|
width = defaultViewport.width, height = defaultViewport.height;
|
|
184
|
-
_ref2 = story || {}, _ref2$components = _ref2.components, screens = _ref2$components === void 0 ? null : _ref2$components
|
|
185
|
-
|
|
186
|
-
_context2.next = 11;
|
|
180
|
+
_ref2 = story || {}, _ref2$components = _ref2.components, screens = _ref2$components === void 0 ? null : _ref2$components;
|
|
181
|
+
_context2.next = 10;
|
|
187
182
|
return puppeteer__default['default'].launch(_objectSpread__default['default'](_objectSpread__default['default']({
|
|
188
183
|
devtools: DEBUG
|
|
189
184
|
}, executablePath !== null ? {
|
|
190
185
|
executablePath: executablePath
|
|
191
186
|
} : null), {}, {
|
|
192
187
|
defaultViewport: defaultViewport,
|
|
193
|
-
args: ['--no-sandbox'
|
|
188
|
+
args: ['--no-sandbox']
|
|
194
189
|
}));
|
|
195
190
|
|
|
196
|
-
case
|
|
191
|
+
case 10:
|
|
197
192
|
browser = _context2.sent;
|
|
198
|
-
_context2.next =
|
|
193
|
+
_context2.next = 13;
|
|
199
194
|
return browser.pages();
|
|
200
195
|
|
|
201
|
-
case
|
|
196
|
+
case 13:
|
|
202
197
|
pages = _context2.sent;
|
|
203
198
|
hasPage = pages.length > 0;
|
|
204
199
|
|
|
205
200
|
if (!hasPage) {
|
|
206
|
-
_context2.next =
|
|
201
|
+
_context2.next = 19;
|
|
207
202
|
break;
|
|
208
203
|
}
|
|
209
204
|
|
|
210
205
|
_context2.t0 = pages[0];
|
|
211
|
-
_context2.next =
|
|
206
|
+
_context2.next = 22;
|
|
212
207
|
break;
|
|
213
208
|
|
|
214
|
-
case
|
|
215
|
-
_context2.next =
|
|
209
|
+
case 19:
|
|
210
|
+
_context2.next = 21;
|
|
216
211
|
return browser.newPage();
|
|
217
212
|
|
|
218
|
-
case
|
|
213
|
+
case 21:
|
|
219
214
|
_context2.t0 = _context2.sent;
|
|
220
215
|
|
|
221
|
-
case
|
|
216
|
+
case 22:
|
|
222
217
|
page = _context2.t0;
|
|
223
|
-
_context2.next =
|
|
224
|
-
return page.setExtraHTTPHeaders({
|
|
225
|
-
'Accept-Language': language
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
case 26:
|
|
229
|
-
_context2.next = 28;
|
|
218
|
+
_context2.next = 25;
|
|
230
219
|
return page["goto"]("http://127.0.0.1:".concat(serverPort));
|
|
231
220
|
|
|
232
|
-
case
|
|
221
|
+
case 25:
|
|
233
222
|
if (!(screens !== null)) {
|
|
234
|
-
_context2.next =
|
|
223
|
+
_context2.next = 51;
|
|
235
224
|
break;
|
|
236
225
|
}
|
|
237
226
|
|
|
238
227
|
count = screens.length;
|
|
239
228
|
index = 0;
|
|
240
229
|
|
|
241
|
-
case
|
|
230
|
+
case 28:
|
|
242
231
|
if (!(index < count)) {
|
|
243
|
-
_context2.next =
|
|
232
|
+
_context2.next = 51;
|
|
244
233
|
break;
|
|
245
234
|
}
|
|
246
235
|
|
|
@@ -253,7 +242,7 @@ var captureStory = /*#__PURE__*/function () {
|
|
|
253
242
|
console.log("Screen ".concat(screenNumber, "/").concat(count, " (").concat(type, ")..."));
|
|
254
243
|
|
|
255
244
|
if (!(type === 'video' || type === 'video-360')) {
|
|
256
|
-
_context2.next =
|
|
245
|
+
_context2.next = 36;
|
|
257
246
|
break;
|
|
258
247
|
}
|
|
259
248
|
|
|
@@ -290,10 +279,10 @@ var captureStory = /*#__PURE__*/function () {
|
|
|
290
279
|
}
|
|
291
280
|
}
|
|
292
281
|
}, _callee);
|
|
293
|
-
})(), "t1",
|
|
282
|
+
})(), "t1", 36);
|
|
294
283
|
|
|
295
|
-
case
|
|
296
|
-
_context2.next =
|
|
284
|
+
case 36:
|
|
285
|
+
_context2.next = 38;
|
|
297
286
|
return page.evaluate(function (storyToRender, storyProps) {
|
|
298
287
|
return renderStory(storyToRender, storyProps);
|
|
299
288
|
}, singleScreenStory, {
|
|
@@ -306,46 +295,46 @@ var captureStory = /*#__PURE__*/function () {
|
|
|
306
295
|
googleApiKey: googleApiKey
|
|
307
296
|
});
|
|
308
297
|
|
|
309
|
-
case
|
|
310
|
-
_context2.prev =
|
|
311
|
-
_context2.next =
|
|
298
|
+
case 38:
|
|
299
|
+
_context2.prev = 38;
|
|
300
|
+
_context2.next = 41;
|
|
312
301
|
return page.waitForSelector('[data-screen-ready="true"]', {
|
|
313
302
|
timeout: READY_WAIT_TIMEOUT
|
|
314
303
|
});
|
|
315
304
|
|
|
316
|
-
case
|
|
317
|
-
_context2.next =
|
|
305
|
+
case 41:
|
|
306
|
+
_context2.next = 46;
|
|
318
307
|
break;
|
|
319
308
|
|
|
320
|
-
case
|
|
321
|
-
_context2.prev =
|
|
322
|
-
_context2.t2 = _context2["catch"](
|
|
309
|
+
case 43:
|
|
310
|
+
_context2.prev = 43;
|
|
311
|
+
_context2.t2 = _context2["catch"](38);
|
|
323
312
|
console.log("Timeout reached: ".concat(id));
|
|
324
313
|
|
|
325
|
-
case
|
|
326
|
-
_context2.next =
|
|
314
|
+
case 46:
|
|
315
|
+
_context2.next = 48;
|
|
327
316
|
return page.screenshot({
|
|
328
317
|
path: getOutputPath(location, "".concat(screenNumber, ".png"))
|
|
329
318
|
});
|
|
330
319
|
|
|
331
|
-
case
|
|
320
|
+
case 48:
|
|
332
321
|
index += 1;
|
|
333
|
-
_context2.next =
|
|
322
|
+
_context2.next = 28;
|
|
334
323
|
break;
|
|
335
324
|
|
|
336
|
-
case
|
|
337
|
-
_context2.next =
|
|
325
|
+
case 51:
|
|
326
|
+
_context2.next = 53;
|
|
338
327
|
return browser.close();
|
|
339
328
|
|
|
340
|
-
case
|
|
329
|
+
case 53:
|
|
341
330
|
server.close();
|
|
342
331
|
|
|
343
|
-
case
|
|
332
|
+
case 54:
|
|
344
333
|
case "end":
|
|
345
334
|
return _context2.stop();
|
|
346
335
|
}
|
|
347
336
|
}
|
|
348
|
-
}, _callee2, null, [[
|
|
337
|
+
}, _callee2, null, [[38, 43]]);
|
|
349
338
|
}));
|
|
350
339
|
|
|
351
340
|
return function captureStory(_x, _x2) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.301",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/runtime": "^7.13.10",
|
|
47
|
-
"@micromag/core": "^0.2.
|
|
48
|
-
"@micromag/elements": "^0.2.
|
|
49
|
-
"@micromag/fields": "^0.2.
|
|
50
|
-
"@micromag/screens": "^0.2.
|
|
51
|
-
"@micromag/transforms": "^0.2.
|
|
52
|
-
"@micromag/viewer": "^0.2.
|
|
53
|
-
"@micromag/viewer-build": "^0.2.
|
|
47
|
+
"@micromag/core": "^0.2.301",
|
|
48
|
+
"@micromag/elements": "^0.2.301",
|
|
49
|
+
"@micromag/fields": "^0.2.301",
|
|
50
|
+
"@micromag/screens": "^0.2.301",
|
|
51
|
+
"@micromag/transforms": "^0.2.301",
|
|
52
|
+
"@micromag/viewer": "^0.2.301",
|
|
53
|
+
"@micromag/viewer-build": "^0.2.301",
|
|
54
54
|
"change-case": "^4.1.2",
|
|
55
55
|
"classnames": "^2.2.6",
|
|
56
56
|
"commander": "^7.2.0",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "64ad343d46608aef6d024a68ff5a988174097f21"
|
|
71
71
|
}
|