@sillsdev/docu-notion 0.14.0-alpha.12 → 0.14.0-alpha.13
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/dist/images.js +8 -5
- package/package.json +6 -7
package/dist/images.js
CHANGED
|
@@ -38,7 +38,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
38
38
|
exports.cleanupOldImages = exports.parseImageBlock = exports.markdownToMDImageTransformer = exports.standardImageTransformer = exports.initImageHandling = void 0;
|
|
39
39
|
const fs = __importStar(require("fs-extra"));
|
|
40
40
|
const file_type_1 = __importDefault(require("file-type"));
|
|
41
|
-
const
|
|
41
|
+
const axios_1 = __importDefault(require("axios"));
|
|
42
42
|
const Path = __importStar(require("path"));
|
|
43
43
|
const MakeImagePersistencePlan_1 = require("./MakeImagePersistencePlan");
|
|
44
44
|
const log_1 = require("./log");
|
|
@@ -131,9 +131,12 @@ function processImageBlock(imageBlock, pathToParentDocument, relativePathToThisP
|
|
|
131
131
|
}
|
|
132
132
|
function readPrimaryImage(imageSet) {
|
|
133
133
|
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
// In Mar 2024, we started having a problem getting a particular gif from imgur using
|
|
135
|
+
// node-fetch. Switching to axios resolved it. I don't know why.
|
|
136
|
+
const response = yield axios_1.default.get(imageSet.primaryUrl, {
|
|
137
|
+
responseType: "arraybuffer",
|
|
138
|
+
});
|
|
139
|
+
imageSet.primaryBuffer = Buffer.from(response.data, "utf-8");
|
|
137
140
|
imageSet.fileType = yield file_type_1.default.fromBuffer(imageSet.primaryBuffer);
|
|
138
141
|
});
|
|
139
142
|
}
|
|
@@ -145,7 +148,7 @@ function saveImage(imageSet) {
|
|
|
145
148
|
// if we have a urls for the localized screenshot, download it
|
|
146
149
|
if ((localizedImage === null || localizedImage === void 0 ? void 0 : localizedImage.url.length) > 0) {
|
|
147
150
|
(0, log_1.verbose)(`Retrieving ${localizedImage.iso632Code} version...`);
|
|
148
|
-
const response = yield (
|
|
151
|
+
const response = yield fetch(localizedImage.url);
|
|
149
152
|
const arrayBuffer = yield response.arrayBuffer();
|
|
150
153
|
buffer = Buffer.from(arrayBuffer);
|
|
151
154
|
}
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"tsc": "tsc",
|
|
13
13
|
"// test out with a private sample notion db": "",
|
|
14
14
|
"large-site-test": "npm run ts -- -n $SIL_BLOOM_DOCS_NOTION_TOKEN -r $SIL_BLOOM_DOCS_NOTION_ROOT_PAGE --locales en,fr --log-level debug",
|
|
15
|
-
"pull-test-tagged": "npm run ts -- -n $DOCU_NOTION_INTEGRATION_TOKEN -r $DOCU_NOTION_TEST_ROOT_PAGE_ID --log-level
|
|
15
|
+
"pull-test-tagged": "npm run ts -- -n $DOCU_NOTION_INTEGRATION_TOKEN -r $DOCU_NOTION_TEST_ROOT_PAGE_ID --log-level info --status-tag test",
|
|
16
16
|
"pull-test-css": "npm run ts -- --css-output-directory ./test/css -n $DOCU_NOTION_INTEGRATION_TOKEN -r $DOCU_NOTION_TEST_ROOT_PAGE_ID --log-level debug --status-tag test",
|
|
17
17
|
"pull-sample-site": "npm run ts -- -n $DOCU_NOTION_INTEGRATION_TOKEN -r $DOCU_NOTION_SAMPLE_ROOT_PAGE --log-level debug",
|
|
18
18
|
"// test with a semi-stable/public site:": "",
|
|
@@ -20,26 +20,25 @@
|
|
|
20
20
|
"pull-sample-with-paths": "npm run ts -- -n $DOCU_NOTION_INTEGRATION_TOKEN -r $DOCU_NOTION_SAMPLE_ROOT_PAGE -m ./sample --img-output-path ./sample_img"
|
|
21
21
|
},
|
|
22
22
|
"//file-type": "have to use this version before they switched to ESM, which gives a compile error related to require()",
|
|
23
|
-
"//node-fetch@2.6.6file-type": "have to use this version before they switched to ESM, which gives a compile error related to require()",
|
|
24
23
|
"//chalk@4": "also ESM related problem",
|
|
25
24
|
"//notion-client@4": "also ESM related problem",
|
|
26
25
|
"//note: ts-node": "really is a runtime dependency",
|
|
27
26
|
"dependencies": {
|
|
28
27
|
"@notionhq/client": "2.2.3",
|
|
28
|
+
"axios": "^1.6.8",
|
|
29
29
|
"chalk": "^4.1.2",
|
|
30
30
|
"commander": "^9.2.0",
|
|
31
31
|
"cosmiconfig": "^8.0.0",
|
|
32
32
|
"cosmiconfig-typescript-loader": "^4.3.0",
|
|
33
|
-
"file-type": "16.5.
|
|
33
|
+
"file-type": "16.5.3",
|
|
34
34
|
"fs-extra": "^10.1.0",
|
|
35
35
|
"limiter": "^2.1.0",
|
|
36
36
|
"markdown-table": "^2.0.0",
|
|
37
|
-
"node-fetch": "2.6.6",
|
|
38
37
|
"notion-client": "^4",
|
|
39
38
|
"notion-to-md": "3.1.1",
|
|
40
39
|
"path": "^0.12.7",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
40
|
+
"sanitize-filename": "^1.6.3",
|
|
41
|
+
"ts-node": "^10.2.1"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
44
|
"@types/fs-extra": "^9.0.13",
|
|
@@ -91,5 +90,5 @@
|
|
|
91
90
|
"volta": {
|
|
92
91
|
"node": "18.16.0"
|
|
93
92
|
},
|
|
94
|
-
"version": "0.14.0-alpha.
|
|
93
|
+
"version": "0.14.0-alpha.13"
|
|
95
94
|
}
|