wix-style-react
Version:
wix-style-react
20 lines (16 loc) • 576 B
JavaScript
const path = require('path');
const glob = require('glob');
const { transformFileAsync } = require('@babel/core');
const { writeFileAsync } = require('./utils');
module.exports = function ({ folder }) {
const files = glob.sync(`**/*.js`, { cwd: folder });
return Promise.all(
files.map(async file => {
const filepath = path.join(folder, file);
const something = await transformFileAsync(filepath, {
plugins: ['@babel/plugin-transform-modules-commonjs'],
});
return await writeFileAsync(file, folder, something.code);
}),
);
};