confluence-content-extractor
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -45,6 +45,3 @@ "use strict"; | ||
if (attrs.id === 'atlassian-question_mark') | ||
return { type: node.type, attrs: __assign(__assign({}, attrs), { text: '⁉️' }) }; | ||
if (attrs.id.startsWith('atlassian-')) { | ||
console.info('** atlassian emoji', node); | ||
} | ||
return { type: node.type, attrs: __assign(__assign({}, attrs), { text: '❓' }) }; | ||
return node; | ||
@@ -51,0 +48,0 @@ }; |
import { Output } from '../output'; | ||
import { Content, Identifier } from '../confluence/api'; | ||
export declare const extractContent: (content: Content, output: Output) => Promise<void>; | ||
export declare const extractContentById: ({ id }: Pick<Identifier, 'id'>, output: Output) => Promise<void>; | ||
export declare type ExtractContentOptions = { | ||
force: boolean; | ||
}; | ||
export declare const extractContent: (content: Content, output: Output, options?: ExtractContentOptions) => Promise<void>; | ||
export declare const extractContentById: ({ id }: Pick<Identifier, 'id'>, output: Output, options?: ExtractContentOptions) => Promise<void>; |
@@ -64,3 +64,6 @@ "use strict"; | ||
var assets_1 = require("./assets"); | ||
var shouldExtractContentData = function (content, output) { | ||
var emojis_1 = require("./emojis"); | ||
var shouldExtractContentData = function (content, output, options) { | ||
if (options.force) | ||
return true; | ||
var targetDirectory = content.type === 'page' ? output.pages : output.blogs; | ||
@@ -117,37 +120,44 @@ var dataFile = path_1.default.resolve(targetDirectory, (0, util_1.titleToPath)(content.identifier.title), 'data.json'); | ||
}); }; | ||
var extractContent = function (content, output) { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!shouldExtractContentData(content, output)) return [3 /*break*/, 5]; | ||
console.info('▶️ extract content', content.identifier); | ||
return [4 /*yield*/, (0, objects_1.extractObjects)(content, output)]; | ||
case 1: | ||
_a.sent(); | ||
return [4 /*yield*/, (0, attachments_1.extractAttachments)(content, output)]; | ||
case 2: | ||
_a.sent(); | ||
return [4 /*yield*/, (0, assets_1.extractAssets)(content, output)]; | ||
case 3: | ||
_a.sent(); | ||
return [4 /*yield*/, saveContentData(content, output)]; | ||
case 4: | ||
_a.sent(); | ||
return [3 /*break*/, 6]; | ||
case 5: | ||
console.log('⚡️ skipped data extraction', content.identifier); | ||
_a.label = 6; | ||
case 6: | ||
// static templates might change, this is not an expensive call anyway | ||
return [4 /*yield*/, saveContentHtml(content, output)]; | ||
case 7: | ||
var extractContent = function (content, output, options) { | ||
if (options === void 0) { options = { force: false }; } | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!shouldExtractContentData(content, output, options)) return [3 /*break*/, 6]; | ||
console.info('▶️ extract content', content.identifier); | ||
return [4 /*yield*/, (0, objects_1.extractObjects)(content, output)]; | ||
case 1: | ||
_a.sent(); | ||
return [4 /*yield*/, (0, attachments_1.extractAttachments)(content, output)]; | ||
case 2: | ||
_a.sent(); | ||
return [4 /*yield*/, (0, assets_1.extractAssets)(content, output)]; | ||
case 3: | ||
_a.sent(); | ||
return [4 /*yield*/, (0, emojis_1.extractEmojis)(content, output)]; | ||
case 4: | ||
_a.sent(); | ||
return [4 /*yield*/, saveContentData(content, output)]; | ||
case 5: | ||
_a.sent(); | ||
return [3 /*break*/, 7]; | ||
case 6: | ||
console.log('⚡️ skipped data extraction', content.identifier); | ||
_a.label = 7; | ||
case 7: | ||
// static templates might change, this is not an expensive call anyway | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
return [4 /*yield*/, saveContentHtml(content, output)]; | ||
case 8: | ||
// static templates might change, this is not an expensive call anyway | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}); }; | ||
}; | ||
exports.extractContent = extractContent; | ||
var extractContentById = function (_a, output) { | ||
var extractContentById = function (_a, output, options) { | ||
var id = _a.id; | ||
if (options === void 0) { options = { force: false }; } | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -160,3 +170,3 @@ var content; | ||
content = _b.sent(); | ||
return [4 /*yield*/, (0, exports.extractContent)(content, output)]; | ||
return [4 /*yield*/, (0, exports.extractContent)(content, output, options)]; | ||
case 2: | ||
@@ -163,0 +173,0 @@ _b.sent(); |
@@ -85,3 +85,4 @@ #! /usr/bin/env node | ||
.description('extract specific content from a confluence space') | ||
.action(function (contentId) { return __awaiter(void 0, void 0, void 0, function () { | ||
.option('-f, --force', 'force extraction', false) | ||
.action(function (contentId, options) { return __awaiter(void 0, void 0, void 0, function () { | ||
var outputDirectory, output; | ||
@@ -93,3 +94,3 @@ return __generator(this, function (_a) { | ||
output = (0, output_1.setup)(outputDirectory); | ||
return [4 /*yield*/, (0, extract_1.extractContentById)({ id: contentId }, output)]; | ||
return [4 /*yield*/, (0, extract_1.extractContentById)({ id: contentId }, output, options)]; | ||
case 1: | ||
@@ -96,0 +97,0 @@ _a.sent(); |
@@ -9,2 +9,3 @@ export interface Output { | ||
avatars: string; | ||
emojis: string; | ||
}; | ||
@@ -11,0 +12,0 @@ templates: string; |
@@ -50,3 +50,4 @@ "use strict"; | ||
assets: { | ||
avatars: path_1.default.resolve(siteOutput, 'assets', 'avatars') | ||
avatars: path_1.default.resolve(siteOutput, 'assets', 'avatars'), | ||
emojis: path_1.default.resolve(siteOutput, 'assets', 'emojis') | ||
}, | ||
@@ -53,0 +54,0 @@ templates: path_1.default.resolve(destination, 'templates') |
{ | ||
"name": "confluence-content-extractor", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "confluence content extractor", | ||
@@ -5,0 +5,0 @@ "bin": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
91769
50
1344
7