confluence-content-extractor
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -8,4 +8,5 @@ export interface Configuration { | ||
CONFLUENCE_CLOUD_TOKEN: string; | ||
TWITTER_SITE: string; | ||
} | ||
declare const config: Configuration; | ||
export { config }; |
@@ -60,2 +60,4 @@ "use strict"; | ||
var adf_processor_1 = require("./confluence/adf-processor"); | ||
var server_1 = __importDefault(require("react-dom/server")); | ||
var static_wrapper_1 = require("./static-wrapper"); | ||
var shouldExtractContentData = function (content, output) { | ||
@@ -100,2 +102,15 @@ var targetDirectory = content.type === 'page' ? output.pages : output.blogs; | ||
}); }; | ||
var saveContentHtml = function (content, output) { return __awaiter(void 0, void 0, void 0, function () { | ||
var indexHtml, subPath, templatePath; | ||
return __generator(this, function (_a) { | ||
indexHtml = server_1.default.renderToStaticMarkup((0, static_wrapper_1.StaticWrapper)(content)); | ||
subPath = content.type === 'page' ? 'notes' : 'articles'; | ||
templatePath = content.asHomepage | ||
? output.templates | ||
: path_1.default.resolve(output.templates, subPath, (0, util_1.titleToPath)(content.identifier.title)); | ||
fs_1.default.mkdirSync(templatePath, { recursive: true }); | ||
fs_1.default.writeFileSync(path_1.default.resolve(templatePath, 'index.html'), "<!DOCTYPE html>\n".concat(indexHtml)); | ||
return [2 /*return*/]; | ||
}); | ||
}); }; | ||
var extractContent = function (content, output) { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -123,3 +138,9 @@ return __generator(this, function (_a) { | ||
_a.label = 6; | ||
case 6: return [2 /*return*/]; | ||
case 6: | ||
// static templates might change, this is not an expensive call anyway | ||
return [4 /*yield*/, saveContentHtml(content, output)]; | ||
case 7: | ||
// static templates might change, this is not an expensive call anyway | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
@@ -126,0 +147,0 @@ }); |
@@ -65,2 +65,5 @@ "use strict"; | ||
resolvedObjects.forEach(function (item) { | ||
if (!item.body) { | ||
return; | ||
} | ||
var data = item.body.data; | ||
@@ -67,0 +70,0 @@ var url = data.url, name = data.name, generator = data.generator; |
@@ -10,4 +10,5 @@ export interface Output { | ||
}; | ||
templates: string; | ||
} | ||
declare const setup: (destination: string) => Output; | ||
export { setup }; |
@@ -47,3 +47,4 @@ "use strict"; | ||
avatars: path_1.default.resolve(siteOutput, 'assets', 'avatars') | ||
} | ||
}, | ||
templates: path_1.default.resolve(destination, 'templates') | ||
}; | ||
@@ -50,0 +51,0 @@ makeOutputDirectories(output); |
{ | ||
"name": "confluence-content-extractor", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "confluence content extractor", | ||
@@ -41,2 +41,4 @@ "bin": { | ||
"@types/node": "^17.0.5", | ||
"@types/react": "^18.0.5", | ||
"@types/react-dom": "^18.0.0", | ||
"axios": "^0.26.1", | ||
@@ -49,2 +51,4 @@ "commander": "^9.1.0", | ||
"prettier": "^2.5.1", | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0", | ||
"ts-jest": "^27.1.2", | ||
@@ -51,0 +55,0 @@ "ts-node": "^10.7.0", |
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
78522
44
1151
17