2024-01-13 16:07:33 -05:00
|
|
|
import App from 'resource:///com/github/Aylur/ags/app.js';
|
|
|
|
import { execAsync, monitorFile } from 'resource:///com/github/Aylur/ags/utils.js';
|
|
|
|
|
|
|
|
|
2024-01-13 23:38:31 -05:00
|
|
|
const watchAndCompileSass = () => {
|
2024-01-13 16:07:33 -05:00
|
|
|
const reloadCss = () => {
|
|
|
|
const scss = `${App.configDir}/scss/main.scss`;
|
|
|
|
const css = '/tmp/ags/style.css';
|
|
|
|
|
|
|
|
execAsync(`sassc ${scss} ${css}`).then(() => {
|
|
|
|
App.resetCss();
|
|
|
|
App.applyCss(css);
|
2024-01-13 23:38:31 -05:00
|
|
|
}).catch(print);
|
2024-01-13 16:07:33 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
monitorFile(
|
|
|
|
`${App.configDir}/scss`,
|
|
|
|
reloadCss,
|
|
|
|
'directory',
|
|
|
|
);
|
|
|
|
reloadCss();
|
|
|
|
};
|
|
|
|
|
2024-01-13 23:38:31 -05:00
|
|
|
export const transpileTypeScript = async() => {
|
|
|
|
await execAsync([
|
|
|
|
'bun', 'build', `${App.configDir}/ts/main.ts`,
|
|
|
|
'--outdir', '/tmp/ags',
|
|
|
|
'--external', 'resource:///*',
|
|
|
|
'--external', 'gi://*',
|
|
|
|
'--external', 'cairo',
|
|
|
|
'--external', '*/fzf.es.js',
|
|
|
|
]).catch(print);
|
|
|
|
|
|
|
|
watchAndCompileSass();
|
|
|
|
|
|
|
|
// The file is going to be there after transpilation
|
|
|
|
// @ts-ignore
|
|
|
|
return await import('file:///tmp/ags/main.js');
|
2024-01-13 16:07:33 -05:00
|
|
|
};
|