ToolJet/plugins/create-operations-file.js
Kiran Ashok 3b96e99d6a
Woocommerce integration 🚀 (#2866)
* base structure

* tested all customer operations

* all product enpoints tested

* all order api tested

* typo fix

* icon updated

* tested all operation , cleanup

* added create coupon operation

* removing unwanted types

* cleanup

* updating test connection bug

* doc updated

* docs updated

* removing logs :: pr updates

* removing types :: pr updates

* cleanup :: pr changes

* operation structure updated

* restructured whole code for seperating operations

* typo bug updated

* updating pr updates remove host , test error case updated

* typo bug fixed

* updating naming conventions

* plugins operation.json reusable fields

* pr changes :: making all ids common

* fixing customer params

* updating all additional param types

* updating all product params

* including some more product params

* adding all order params

* adding all coupon params

* updating common defenitions

* capitalise labels

* updating all list operation definitions

* clearing some typos

* global defenition

* lock file changes

* lock file changes

* server lock file changes

* typo fix

* typo fix

Co-authored-by: gsmithun4 <[email protected]>
2022-05-19 11:38:14 +05:30

21 lines
736 B
JavaScript

const { readdirSync, writeFileSync, existsSync } = require('fs');
const packages = readdirSync('./packages', { withFileTypes: true }).filter(
(dirent) => dirent.isDirectory() && dirent.name !== 'common'
);
packages.forEach((dirent) => {
if (existsSync(`./packages/${dirent.name}/dist/operations/index.js`)) {
console.log(`Building operations.json for : ${dirent.name}`);
import(`./packages/${dirent.name}/dist/operations/index.js`)
.then((module) => {
writeFileSync(`./packages/${dirent.name}/lib/operations.json`, JSON.stringify(module.default.default), {
encoding: 'utf8',
});
})
.catch((err) => {
console.error(dirent.name, err);
throw err;
});
}
});