Skip to content

Commit

Permalink
feat: new build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
makamekm committed Oct 28, 2024
1 parent 40251c3 commit adb8bca
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/cmd/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ async function handler(args: Arguments<YfmArgv>) {

const outputBundlePath = join(outputFolderPath, BUNDLE_FOLDER);

if (args.clean) {
await clearTemporaryFolders(userOutputFolder);
}

// Create build context that stores the information about the current build
const context = await makeRevisionContext(
args.cached,
Expand All @@ -248,7 +252,7 @@ async function handler(args: Arguments<YfmArgv>) {
const deps = new DependencyContextCli(context);

// Creating temp .input & .output folder
await preparingTemporaryFolders(context, args.clean);
await preparingTemporaryFolders(context);

// Read and prepare Preset & Toc data
await processServiceFiles(context, fs);
Expand Down Expand Up @@ -353,11 +357,7 @@ async function handler(args: Arguments<YfmArgv>) {
}

// Creating temp .input & .output folder
async function preparingTemporaryFolders(revisionContext: RevisionContext, cleanOutput: boolean) {
if (cleanOutput) {
shell.rm('-rf', revisionContext.userOutputFolder);
}

async function preparingTemporaryFolders(revisionContext: RevisionContext) {
shell.mkdir('-p', revisionContext.userOutputFolder);

// Create temporary input/output folders
Expand All @@ -373,3 +373,8 @@ async function preparingTemporaryFolders(revisionContext: RevisionContext, clean

shell.chmod('-R', 'u+w', revisionContext.tmpInputFolder);
}

// Clear output folder folders
async function clearTemporaryFolders(userOutputFolder: string) {
shell.rm('-rf', userOutputFolder);
}

Check failure on line 380 in src/cmd/build/index.ts

View workflow job for this annotation

GitHub Actions / Verify Files

Insert `⏎`

0 comments on commit adb8bca

Please sign in to comment.