{"name":"@putout/operator-rename-files","version":"6.1.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.1.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":"5cccb878c9d66a603b8ac406be71a67feb4a477a","tarball":"http://registry-npm.ywwl.com/@putout/operator-rename-files/download/@putout/operator-rename-files-6.1.1.tgz","fileCount":6,"integrity":"sha512-Ij2TfdxuTkYt4BPvBJTe85vxFINjvRQVKw/CAsYEQ+lPP127l+WewSuN0oOQZf/DYPtW4Rd8tJMHE5QzQ49FUg==","signatures":[{"sig":"MEYCIQCngn+9x75n+H2azGijZGnoJufaOVFHheiDMY0iYea+LwIhAL7L0FxUHnlwXYHc+bn2961kgLKYbzRc8x9/RzDmVJyM","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7287,"size":2862,"noattachment":false,"key":"/@putout/operator-rename-files/-/@putout/operator-rename-files-6.1.1.tgz"},"main":"lib/rename-files.js","type":"module","engines":{"node":">=22"},"gitHead":"8ef43c0cc67841aa15439ece0175787c8e9af298","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.3.0","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":"^3.0.0","@putout/plugin-nodejs":"*"},"peerDependencies":{"putout":">=41"},"_npmOperationalInternal":{"tmp":"tmp/operator-rename-files_6.1.1_1768411325959_0.6745734961719385","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":1768411326108,"_cnpm_publish_time":1768411326108,"dist-tags":{"latest":"6.2.1"}}