2024-01-30 11:29:07 -05:00
|
|
|
const { execAsync, monitorFile } = Utils;
|
2024-01-13 16:07:33 -05:00
|
|
|
|
|
|
|
|
2024-01-17 19:18:41 -05:00
|
|
|
/** @param {string} host */
|
|
|
|
const watchAndCompileSass = (host) => {
|
2024-01-13 16:07:33 -05:00
|
|
|
const reloadCss = () => {
|
2024-01-17 19:18:41 -05:00
|
|
|
const scss = `${App.configDir}/scss/${host}.scss`;
|
2024-01-13 16:07:33 -05:00
|
|
|
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-17 19:18:41 -05:00
|
|
|
/** @param {string} host */
|
|
|
|
export const transpileTypeScript = async(host) => {
|
2024-01-13 23:38:31 -05:00
|
|
|
await execAsync([
|
2024-01-17 19:18:41 -05:00
|
|
|
'bun', 'build', `${App.configDir}/${host}.ts`,
|
2024-01-13 23:38:31 -05:00
|
|
|
'--outdir', '/tmp/ags',
|
|
|
|
'--external', 'resource:///*',
|
|
|
|
'--external', 'gi://*',
|
|
|
|
'--external', 'cairo',
|
|
|
|
'--external', '*/fzf.es.js',
|
|
|
|
]).catch(print);
|
|
|
|
|
2024-02-05 22:46:43 -05:00
|
|
|
if (host !== 'greeter') {
|
|
|
|
watchAndCompileSass(host);
|
|
|
|
}
|
2024-01-13 23:38:31 -05:00
|
|
|
|
|
|
|
// The file is going to be there after transpilation
|
|
|
|
// @ts-ignore
|
2024-01-17 21:00:25 -05:00
|
|
|
return await import(`file:///tmp/ags/${host}.js`);
|
2024-01-13 16:07:33 -05:00
|
|
|
};
|