$ npm install @putout/operator-rename-files
🐊Putout operator adds ability to rename files to plugins.
npm i putout @putout/operator-rename-files
If you want to create 🐊Putout plugin
that will rename files according to your needs just use for ESM:
const {operator} = require('putout');
const {renameFiles} = operator;
module.exports = renameFiles({
type: 'module',
mask: '*.mjs',
rename(name) {
return name.replace(/mjs$/, 'js');
},
});
And for CommonJS:
module.exports = renameFiles({
type: 'commonjs',
mask: '*.cjs',
rename(name) {
return name.replace(/cjs$/, 'js');
},
});
When you do not need to check type
field of package.json
, avoid type
field:
module.exports = renameFiles({
mask: '*.cjs',
rename(name) {
return name.replace(/cjs$/, 'js');
},
});
You can also use redlint
directly.
MIT
© 2010 - cnpmjs.org x YWFE | Home | YWFE