{"name":"@putout/operator-rename-files","version":"6.0.1","keywords":["putout","putout-operator","operator","rename-files"],"author":{"url":"https://github.com/coderaiser","name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"license":"MIT","_id":"@putout/operator-rename-files@6.0.1","maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"homepage":"https://github.com/coderaiser/putout/tree/master/packages/operator-rename-files#readme","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"tag":false,"dist":{"shasum":"ad1377e5fd6935de696418911bce73d8ff5511a0","tarball":"http://registry-npm.ywwl.com/@putout/operator-rename-files/download/@putout/operator-rename-files-6.0.1.tgz","fileCount":4,"integrity":"sha512-1XPD4+9t+SPkoqGgzsjJE9Ic6NfAPbfu657f+L7X72P6GZ7h8UxMnJRBp80NkhUw6F6vjHvjn5mhfqNyvcZ3XA==","signatures":[{"sig":"MEUCIGPTf2w1xlRZFk/nXDTqSV5b2The3ryaRfCga/5aLAstAiEAxlKTZF/W5Aa2pGeC5kaTBJl7Nn1EXbHfZfXEmZC1SNU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5540,"size":2411,"noattachment":false,"key":"/@putout/operator-rename-files/-/@putout/operator-rename-files-6.0.1.tgz"},"main":"lib/rename-files.js","type":"module","engines":{"node":">=22"},"gitHead":"5ffa9c7794702d7378110f29a6fd88834fff43db","release":false,"scripts":{"lint":"madrun lint","test":"madrun test","report":"madrun report","coverage":"madrun coverage","fix:lint":"madrun fix:lint","fresh:lint":"madrun fresh:lint","lint:fresh":"madrun lint:fresh","watch:test":"madrun watch:test"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"changelog":false,"repository":{"url":"git+https://github.com/coderaiser/putout.git","type":"git"},"_npmVersion":"11.4.2","description":"🐊Putout operator adds ability to rename files to plugins","directories":{},"_nodeVersion":"25.2.1","dependencies":{"@putout/operator-filesystem":"^10.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.0.0","eslint":"^10.0.0-alpha.0","madrun":"^12.0.0","montag":"^1.2.1","nodemon":"^3.0.1","supertape":"^12.0.0","try-catch":"^4.0.0","@putout/test":"^15.0.0","eslint-plugin-n":"^17.0.0","@putout/eslint-flat":"^3.0.0","eslint-plugin-putout":"^29.0.0","@putout/operator-json":"^2.1.0","@putout/plugin-nodejs":"*"},"peerDependencies":{"putout":">=41"},"_npmOperationalInternal":{"tmp":"tmp/operator-rename-files_6.0.1_1767613263398_0.7986519042816353","host":"s3://npm-registry-packages-npm-production"},"readme":"# @putout/operator-rename-files [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-rename-files.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/operator-rename-files \"npm\"\n\n🐊[**Putout**](https://github.com/coderaiser/putout) operator adds ability to rename files to plugins.\n\n## Install\n\n```\nnpm i putout @putout/operator-rename-files\n```\n\n## API\n\nIf you want to create 🐊[**Putout**](https://github.com/coderaiser/putout) `plugin` that will rename files according to your needs just use for **ESM**:\n\n```js\nimport {operator} from 'putout';\n\nconst {renameFiles} = operator;\n\nexport const {\n    report,\n    fix,\n    scan,\n} = renameFiles({\n    type: 'module',\n    mask: '*.mjs',\n    rename(name) {\n        return name.replace(/mjs$/, 'js');\n    },\n});\n```\n\nAnd for **CommonJS**:\n\n```js\nmodule.exports = renameFiles({\n    type: 'commonjs',\n    mask: '*.cjs',\n    rename(name) {\n        return name.replace(/cjs$/, 'js');\n    },\n});\n```\n\nWhen you do not need to check `type` field of `package.json`, avoid `type` field:\n\n```js\nmodule.exports = renameFiles({\n    mask: '*.cjs',\n    rename(name) {\n        return name.replace(/cjs$/, 'js');\n    },\n});\n```\n\n### renameFiles({mask, from, to})\n\nYou can pass `from` and `to` instead of `rename` for declarative renaming.\n\n```js\nexport const {\n    report,\n    fix,\n    scan,\n} = renameFiles({\n    mask: '*.spec.*',\n    from: 'spec',\n    to: 'test',\n});\n```\n\n### renameFiles({from, to, near})\n\nRename files located near `package.json`:\n\n```js\nexport const {\n    report,\n    fix,\n    scan,\n} = renameFiles({\n    from: 'madrun.js',\n    to: '.madrun.js',\n    near: 'package.json',\n});\n```\n\nYou can also use [`redlint`](https://github.com/putoutjs/redlint) directly.\n\n## License\n\nMIT\n","publish_time":1767613263531,"_cnpm_publish_time":1767613263531,"dist-tags":{"latest":"6.2.1"}}