Convert Scripting definition files (.sdefs
) to TypeScript(d.ts)
Install with npm:
npm install @jxa/sdef-to-dts
Convert ./input/*.sdef
file and output it as d.ts
to ./output
directory.
const fs = require("fs");
const path = require("path");
const { transform } = require("@jxa/sdef-to-dts");
const sdefDir = path.join(__dirname, "./input");
const outputDir = path.join(__dirname, "./output");
const promises = fs.readdirSync(sdefDir).map(async caseName => {
const fileName = path.basename(caseName, ".sdef");
const normalizedTestName = fileName.replace(/\s/g, "");
const actualContent = fs.readFileSync(path.join(fixturesDir, caseName), "utf-8");
console.log("transform " + normalizedTestName);
const actual = await transform(normalizedTestName, actualContent);
fs.writeFileSync(path.join(outputDir, normalizedTestName) + ".d.ts", actual, "utf-8");
});
Promise.all(promises).then(() => {
console.log("All write");
});
Convert application bundles (e.g. /Applications/Safari.app
) and output as d.ts
.
Scripting definition files (sdefs) to TypeScript (d.ts)
Usage
$ npx @jxa/sdef-to-dts <input> --output <output>
<input> path to an Application.app to read
Options
--output, -o path to an Application.d.ts or a directory to write to
--version show the version
--help show this help page
Examples
$ npx @jxa/sdef-to-dts /Applications/Safari.app --output ./safari.d.ts
yarn test
See Releases page.
Pull requests and stars are always welcome.
For bugs and feature requests, please create an issue.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
MIT © azu