5.0.0 β€’ Published 5 months ago

@putout/operator-rename-files v5.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@putout/operator-rename-files NPM version

🐊Putout operator adds ability to rename files to plugins.

Install

npm i putout @putout/operator-rename-files

API

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.

License

MIT

4.0.0

6 months ago

5.0.0

5 months ago

3.0.0

7 months ago

2.0.1

8 months ago

2.0.0

11 months ago

1.0.0

2 years ago