Skip to content

Commit

Permalink
send notification when error occurs [test]
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadhabibi14 committed Aug 1, 2023
1 parent 7a1022f commit 73e867f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion build.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ const svelteJsPathResolver = {

function createBuilder( entryPoints ) {
console.log( 'pages:', entryPoints );
console.log('createBuilder');

// TODO ::::::
return esbuild.build( {
entryPoints: entryPoints.map( s => s + '.ts' ),
bundle: true,
Expand All @@ -98,7 +100,13 @@ function createBuilder( entryPoints ) {
incremental: !!watch,
sourcemap: false,
minify,
} );
} ).catch(() => {
console.log('error');
notifier.notify({
title: 'Error occurs',
message: 'error'
});
});
}

function layoutFor( path, content = {} ) {
Expand Down Expand Up @@ -268,6 +276,8 @@ function layoutFor( path, content = {} ) {
let cache = {};

function saveFiles( files = builder, layoutChanged = false ) {
console.log('saveFiles');

const output = {};
let unchanged = 0;
// path = bla.svelte.js or bla.svelte.css
Expand Down Expand Up @@ -302,6 +312,8 @@ function layoutFor( path, content = {} ) {
path = resolve( path + '.html' );
compiledFiles.add( path );
console.log( 'compiled:', relative( resolve( __dirname ), path ) );

// TODO ::::::
writeFileSync( path, content );
} );
}
Expand Down

0 comments on commit 73e867f

Please sign in to comment.