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 fa9f405 commit e1200f3
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/cmd/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ function builder<T>(argv: Argv<T>) {
group: 'Build options:',
})
.option('host', {
default: false,
default: '0.0.0.0',
describe: 'Host for dev server (Default is 0.0.0.0)',
type: 'boolean',
group: 'Build options:',
})
.option('port', {
default: false,
default: 5000,
describe: 'Port for dev server (Default is 5000)',
type: 'number',
group: 'Build options:',
Expand Down Expand Up @@ -222,15 +222,15 @@ function builder<T>(argv: Argv<T>) {
let isCompiling = false;
let needToCompile = false;

const runCompile = debounce(async () => {
const runCompile = debounce(async (init = true) => {
if (isCompiling) {
needToCompile = true;
} else {
isCompiling = true;
needToCompile = false;

try {
await compile();
await compile(init);
} catch (error) {
//
}
Expand Down Expand Up @@ -269,21 +269,15 @@ async function handler(initArgs: Arguments<YfmArgv>) {

liveServer.start(params);

runCompile();
runCompile(true);

return await new Promise(() => null);
} else {
return await compile();
}
}

async function compile() {
let hasError = false;

const userOutputFolder = resolve(args.output);
const tmpInputFolder = resolve(args.output, TMP_INPUT_FOLDER);
const tmpOutputFolder = resolve(args.output, TMP_OUTPUT_FOLDER);

async function compile(init = true) {
if (typeof VERSION !== 'undefined') {
console.log(`Using v${VERSION} version`);

Check warning on line 282 in src/cmd/build/index.ts

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected console statement
}
Expand Down Expand Up @@ -319,7 +313,7 @@ async function compile() {

const outputBundlePath = join(outputFolderPath, BUNDLE_FOLDER);

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

Expand Down

0 comments on commit e1200f3

Please sign in to comment.