Show HN: Tasklemon – A JavaScript Alternative to Bash Scripting
github.com
github.com
It would also be worthwhile to use a different file extension, like .tmj/.tmt (for js and typescript flavours).
The different extensions are a good idea; my current recommendation is to use .lem.js (for compatibility with editors), so that could be changed to .lem.ts easily!
I'd love to have proper TypeScript support at some point, too.
#!/usr/local/bin/tasklemon stdlib
home.children().forEach(child => {
if (child.extension === 'tmp') child.delete();
});
where 'stdlib' in a tasklemon config dir has the preamble: const fs = require('fs');
const os = require('os');
const path = require('path');
const home = {
children: function() {
const homeDir = os.homedir();
fs.readdirSync(homeDir).map((file) => {
return {
extension: path.parse(file).ext,
delete: function() {
const absPath = path.join(homeDir, file);
fs.unlinkSync(absPath);
},
};
});
},
};
So basically each 'feature' of Tasklemon is just a nice DSL for js/ts.And for handing async callbacks, run the contents of the script in an async function so you can await values anywhere rather than have to pass in callbacks.
Did the intro maybe give you the impression that TL was built standalone, instead of on Node?