Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance by compressing in parallel ✈️ #2000

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 7 additions & 9 deletions docgen/post-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ const path = require('path');
const readline = require('readline');

async function main() {
await applyExtras();
await fixHomePage();
await fixTitles();
await Promise.all([
applyExtras(),
fixHomePage(),
fixTitles(),
]);
}

/**
Expand All @@ -32,9 +34,7 @@ async function main() {
*/
async function applyExtras() {
const extras = await getExtraFiles();
for (const source of extras) {
await applyExtraContentFrom(source);
}
await Promise.all(extras.map((source) => applyExtraContentFrom(source)));
sanjaiyan-dev marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand All @@ -60,9 +60,7 @@ async function fixHomePage() {
async function fixTitles() {
const markdownDir = path.join(__dirname, 'markdown');
const files = await fs.readdir(markdownDir);
for (const file of files) {
await fixTitleOf(path.join(markdownDir, file));
}
await Promise.all(files.map((file) => fixTitleOf(path.join(markdownDir, file))));

const tocFile = path.join(markdownDir, 'toc.yaml');
await fixTocTitles(tocFile);
Expand Down
6 changes: 4 additions & 2 deletions generate-esm-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ async function generateEsmWrapper(entryPoint, source) {
const target = getTarget(entryPoint);
const output = getEsmOutput(source, target);
await fs.mkdir(path.dirname(target), { recursive: true });
await fs.writeFile(target, output);
await fs.writeFile('./lib/esm/package.json', JSON.stringify({type: 'module'}));
await Promise.all([
fs.writeFile(target, output),
fs.writeFile('./lib/esm/package.json', JSON.stringify({type: 'module'}))
]);
}

function getTarget(entryPoint) {
Expand Down
6 changes: 3 additions & 3 deletions generate-reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ const tempConfigFile = 'api-extractor.tmp';

async function generateReports() {
const entryPoints = require('./entrypoints.json');
for (const entryPoint in entryPoints) {
await Promise.all(entryPoints.map((entryPoint) => {
const filePath = entryPoints[entryPoint].typings;
await generateReportForEntryPoint(entryPoint, filePath);
}
return generateReportForEntryPoint(entryPoint, filePath);
}));
}

async function generateReportForEntryPoint(entryPoint, filePath) {
Expand Down