Skip to content

Commit 6755c25

Browse files
committed
0.0.9
1 parent 8877de9 commit 6755c25

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed

Diff for: dist/action.mjs

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* NotionJAM v0.0.8 (https://github.com/victornpb/notion-jam)
2+
* NotionJAM v0.0.9 (https://github.com/victornpb/notion-jam)
33
* Copyright (c) victornpb
44
* @license UNLICENSED
55
*/
@@ -238,21 +238,25 @@ function plugin$1(frontmatter) {
238238
function parallel(items, handler, concurrency) {
239239
if (!Number.isInteger(concurrency) || concurrency < 1)
240240
throw new Error('concurrency must be a positive integer greater than 0');
241-
241+
if (items.length === 0) return Promise.resolve([]);
242242
return new Promise((resolve, reject) => {
243243
const results = [];
244244
let i = 0;
245245

246246
const next = (result) => {
247247
results.push(result);
248248
if (i < items.length) {
249-
handler(items[i++]).then(next).catch(reject);
249+
try {
250+
handler(items[i++]).then(next).catch(reject);
251+
} catch (err) { reject(err); }
250252
}
251253
else if (results.length === items.length) resolve(results);
252254
};
253255

254256
for (let x = 0; x < Math.min(concurrency, items.length); x++) {
255-
handler(items[i++]).then(next).catch(reject);
257+
try {
258+
handler(items[i++]).then(next).catch(reject);
259+
} catch (err) { reject(err); break; }
256260
}
257261
});
258262
}
@@ -562,7 +566,7 @@ async function run(options) {
562566
filterValues: 'Ready,Published',
563567
caseType: 'snake',
564568

565-
parallelPages: 3,
569+
parallelPages: 25,
566570
parallelDownloadsPerPage: 3,
567571
downloadImageTimeout: 30,
568572
skipDownloadedImages: true,

Diff for: dist/cli.mjs

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22

33
/*!
4-
* NotionJAM v0.0.8 (https://github.com/victornpb/notion-jam)
4+
* NotionJAM v0.0.9 (https://github.com/victornpb/notion-jam)
55
* Copyright (c) victornpb
66
* @license UNLICENSED
77
*/
@@ -239,21 +239,25 @@ function plugin$1(frontmatter) {
239239
function parallel(items, handler, concurrency) {
240240
if (!Number.isInteger(concurrency) || concurrency < 1)
241241
throw new Error('concurrency must be a positive integer greater than 0');
242-
242+
if (items.length === 0) return Promise.resolve([]);
243243
return new Promise((resolve, reject) => {
244244
const results = [];
245245
let i = 0;
246246

247247
const next = (result) => {
248248
results.push(result);
249249
if (i < items.length) {
250-
handler(items[i++]).then(next).catch(reject);
250+
try {
251+
handler(items[i++]).then(next).catch(reject);
252+
} catch (err) { reject(err); }
251253
}
252254
else if (results.length === items.length) resolve(results);
253255
};
254256

255257
for (let x = 0; x < Math.min(concurrency, items.length); x++) {
256-
handler(items[i++]).then(next).catch(reject);
258+
try {
259+
handler(items[i++]).then(next).catch(reject);
260+
} catch (err) { reject(err); break; }
257261
}
258262
});
259263
}
@@ -563,7 +567,7 @@ async function run(options) {
563567
filterValues: 'Ready,Published',
564568
caseType: 'snake',
565569

566-
parallelPages: 3,
570+
parallelPages: 25,
567571
parallelDownloadsPerPage: 3,
568572
downloadImageTimeout: 30,
569573
skipDownloadedImages: true,
@@ -614,7 +618,7 @@ dotenv.config();
614618

615619
async function main() {
616620
try {
617-
run({
621+
await run({
618622
notionSecret: process.env.NOTION_SECRET,
619623
notionDatabase: process.env.NOTION_DATABASE,
620624
filterProp: process.env.FILTER_PROP,

Diff for: package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "notion-jam",
33
"nameFull": "NotionJAM",
4-
"version": "0.0.8",
4+
"version": "0.0.9",
55
"description": "A notion-jam cli / action",
66
"license": "UNLICENSED",
77
"engines": {

0 commit comments

Comments
 (0)