{"name":"@putout/plugin-filesystem","version":"13.4.0","keywords":["putout","putout-plugin","plugin","config"],"author":{"url":"https://github.com/coderaiser","name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"license":"MIT","_id":"@putout/plugin-filesystem@13.4.0","maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"homepage":"https://github.com/coderaiser/putout/tree/master/packages/plugin-filesystem#readme","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"tag":false,"dist":{"shasum":"efed1ca26332d53455344213b250c21bc642f518","tarball":"http://registry-npm.ywwl.com/@putout/plugin-filesystem/download/@putout/plugin-filesystem-13.4.0.tgz","fileCount":33,"integrity":"sha512-n5Ed4ct0dS7A7uxyXTz7TWOiRHlJ4hamGyLHpv/39/iHRQaZ3Rsszf/ucPTT9jBMxnrMbZFVfQpxMJpOWsTtpg==","signatures":[{"sig":"MEQCIAHJ/JN7hjXcs58GpW8OMkj2BF1GczgIVH9M+kuAL9dWAiAnqIZnEJvgS6DsOP1/cQ8kQkReGAEqxzF8qY6N5BH2Bw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":39788,"size":9415,"noattachment":false,"key":"/@putout/plugin-filesystem/-/@putout/plugin-filesystem-13.4.0.tgz"},"main":"lib/index.js","type":"module","engines":{"node":">=22"},"exports":{".":"./lib/index.js","./to-simple":"./lib/convert-filesystem-to-simple-filesystem/index.js","./from-simple":"./lib/convert-simple-filesystem-to-filesystem/index.js","./replace-cwd":"./lib/replace-cwd/index.js","./read-all-files":"./lib/read-all-files/index.js","./write-all-files":"./lib/write-all-files/index.js"},"gitHead":"0c52f15dc840639974bf56b48a1cb93ec35207fe","imports":{"#filesystem":"./lib/index.js"},"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 plugin operates with filesystem","directories":{},"_nodeVersion":"26.3.0","dependencies":{"@putout/babel":"^5.0.0","@putout/operate":"^15.0.0","@putout/operator-json":"^3.0.0","@putout/operator-filesystem":"^11.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^10.0.0","madrun":"^13.0.0","nodemon":"^3.0.1","superc8":"^12.0.0","clean-css":"^5.3.3","supertape":"^13.0.0","try-catch":"^4.0.0","@putout/test":"^15.0.0","eslint-plugin-putout":"^31.0.0","@putout/plugin-webpack":"*"},"peerDependencies":{"putout":">=42"},"_npmOperationalInternal":{"tmp":"tmp/plugin-filesystem_13.4.0_1780862926674_0.2997388265345815","host":"s3://npm-registry-packages-npm-production"},"readme":"## Install\n\n```\nnpm i @putout/plugin-filesystem -D\n```\n\n## Rules\n\n- ✅ [bundle](#bundle);\n- ✅ [convert-filesystem-to-simple-filesystem](#convert-filesystem-to-simple-filesystem);\n- ✅ [convert-js-to-json](#convert-js-to-json);\n- ✅ [convert-yaml-to-toml](#convert-yaml-to-toml);\n- ✅ [convert-json-to-toml](#convert-json-to-toml);\n- ✅ [convert-toml-to-json](#convert-toml-to-json);\n- ✅ [convert-toml-to-yaml](#convert-toml-to-yaml);\n- ✅ [convert-json-to-yaml](#convert-json-to-yaml);\n- ✅ [convert-yaml-to-json](#convert-yaml-to-json);\n- ✅ [convert-json-to-js](#convert-json-to-js);\n- ✅ [convert-simple-filesystem-to-filesystem](#convert-simple-filesystem-to-filesystem);\n- ✅ [move-referenced-file](#move-referenced-file);\n- ✅ [read-all-files](#read-all-files);\n- ✅ [rename-file](#rename-file);\n- ✅ [remove-files](#remove-files);\n- ✅ [rename-referenced-file](#rename-referenced-file);\n- ✅ [rename-spec-to-test](#rename-spec-to-test);\n- ✅ [rename-test-to-spec](#rename-test-to-spec);\n- ✅ [replace-cwd](#replace-cwd);\n- ✅ [write-all-files](#write-all-files);\n\n## Config\n\n```json\n{\n    \"rules\": {\n        \"filesystem/bundle\": \"off\",\n        \"filesystem/read-all-files\": [\"off\", {\n            \"mask\": \"*\"\n        }],\n        \"filesystem/write-all-files\": \"off\",\n        \"filesystem/rename-file\": \"off\",\n        \"filesystem/remove-files\": \"off\",\n        \"filesystem/rename-spec-to-test\": \"off\",\n        \"filesystem/rename-test-to-spec\": \"off\",\n        \"filesystem/rename-referenced-file\": \"off\",\n        \"filesystem/move-referenced-file\": \"off\",\n        \"filesystem/convert-simple-filesystem-to-filesystem\": \"off\",\n        \"filesystem/convert-filesystem-to-simple-filesystem\": \"off\",\n        \"filesystem/replace-cwd\": [\"off\", {\n            \"from\": \"/home/coderaiser/putout\",\n            \"to\": \"/\"\n        }],\n        \"filesystem/convert-json-to-yaml\": [\"off\", {\n            \"filename\": \"actions.json\"\n        }],\n        \"filesystem/convert-yaml-to-toml\": [\"off\", {\n            \"filename\": \"bunfig.yaml\"\n        }],\n        \"filesystem/convert-json-to-toml\": [\"off\", {\n            \"filename\": \"bunfig.json\"\n        }],\n        \"filesystem/convert-toml-to-json\": [\"off\", {\n            \"filename\": \"bunfig.toml\"\n        }],\n        \"filesystem/convert-toml-to-yaml\": [\"off\", {\n            \"filename\": \"bunfig.toml\"\n        }],\n        \"filesystem/convert-json-to-js\": [\"off\", {\n            \"filename\": \"package.json\"\n        }],\n        \"filesystem/convert-yaml-to-json\": [\"off\", {\n            \"filename\": \"actions.yaml\"\n        }],\n        \"filesystem/convert-js-to-json\": [\"off\", {\n            \"filename\": \"package.js\"\n        }]\n    }\n}\n```\n\n## bundle\n\nBundle and minify `css` files.\n\n```json\n{\n    \"rules\": {\n        \"filesystem/rename-file\": [\"on\", {\n            \"from\": \"README.md\",\n            \"to\": \"readme.md\"\n        }]\n    }\n}\n```\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/547738d2faf984e50f12a1379c221c83/3f77d711f8acc4da50899d6ef0ebe5e7c0df1479).\n\nBefore:\n\n```\n/\n|-- css/\n|  `-- hello.css\n|  `-- world.css\n```\n\nAfter:\n\n```\n/\n|-- css/\n|  `-- hello.css\n|  `-- world.css\n|-- dist/\n|   `-- main.css\n```\n\nJust minify styles:\n\n```json\n{\n    \"rules\": {\n        \"filesystem/rename-file\": [\"on\", {\n            \"mask\": \"*.test.*\",\n            \"from\": \"test\",\n            \"to\": \"spec\"\n        }]\n    }\n}\n```\n\nBefore:\n\n```\n/\n|-- css/\n|  `-- hello.css\n|  `-- world.css\n```\n\nAfter:\n\n```\n/\n|-- css/\n|  `-- hello.css\n|  `-- world.css\n|-- dist/\n|   `-- hello.css\n|   `-- world.css\n```\n\nCreate subdirectory:\n\n```json\n{\n    \"rules\": {\n        \"filesystem/remove-files\": [\"on\", {\n            \"names\": [\"coverage\"],\n            \"dismiss\": [\n                \".travis.yml\"\n            ]\n        }]\n    }\n}\n```\n\nBefore:\n\n```\n/\n|-- css/\n|  `-- hello.css\n|  `-- world.css\n```\n\nAfter:\n\n```\n/\n|-- css/\n|  `-- hello.css\n|  `-- world.css\n|-- dist/\n|   `-- columns\n|       `-- hello.css\n|       `-- world.css\n```\n\nFilter css files by mask:\n\n```json\n{\n    \"rules\": {\n        \"filesystem/rename-referenced-file\": [\"on\", {\n            \"from\": \"hello.js\",\n            \"to\": \"world.js\"\n        }]\n    }\n}\n```\n\nBefore:\n\n```\n/\n|-- css/\n|  `-- hello.css\n|  `-- world.good.css\n```\n\nAfter:\n\n```\n/\n|-- css/\n|  `-- hello.css\n|  `-- world.css\n|-- dist/\n|   `-- world.good.css\n```\n\nYou can even override `transform` with your own `config`:\n\n```ts\n// hello.spec.js\nimport hello from './hello.js';\n```\n\nConcut files:\n\n```json\n```\n\nBefore:\n\n```\n/\n|-- css/\n|  `-- hello.css\n|  `-- world.css\n```\n\nAfter:\n\n```\n/\n|-- css/\n|  `-- hello.css\n|  `-- world.css\n|-- dist/\n|   `-- hello.css\n```\n\n## convert-simple-filesystem-to-filesystem\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/e15d077626f832dd0b98458b1b8ff284/e2d9d2767c9bfab3e4d337f149069666d2aafe79).\n\n## convert-filesystem-to-simple-filesystem\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/79ce3ebdd5878d9fdcf80b762ceb8e76/52c9a16861c541abd601b83ad1c2ae988f97b28f).\n\n## convert-json-to-js\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/f0b2fc640398820c5c25c13bcbfe8ae4/170eff778a433dc809e75158a6d8a9a0578c9cfd).\n\nFilesystem:\n\n```diff\n-[\"/\", \"/package.json\"]\n+[\"/\", \"/package.js\"]\n```\n\n## convert-json-to-toml\n\nFilesystem:\n\n```diff\n-[\"/\", \"/bunfig.json\"]\n+[\"/\", \"/bunfig.toml\"]\n```\n\n## convert-toml-to-json\n\nFilesystem:\n\n```diff\n-[\"/\", \"/bunfig.toml\"]\n+[\"/\", \"/bunfig.json\"]\n```\n\n## convert-toml-to-yaml\n\nFilesystem:\n\n```diff\n-[\"/\", \"/bunfig.toml\"]\n+[\"/\", \"/bunfig.yaml\"]\n```\n\n### ❌ Example of incorrect code\n\n```js\n// hello.spec.js\nimport hello from './world.js';\n```\n\n### ✅ Example of correct code\n\n```js\n// world.js\nexport const hello = 'world';\n```\n\n## convert-json-to-yaml\n\nFilesystem:\n\n```diff\n-[\"/\", \"/actions.json\"]\n+[\"/\", \"/actions.yaml\"]\n```\n\n### ❌ Example of incorrect code\n\n```js\n__putout_processor_json({\n    rules: {\n        'filesystem/move-referenced-file': ['on', {\n            name: 'hello.js',\n            directory: 'lib',\n        }],\n    },\n});\n```\n\n### ✅ Example of correct code\n\n```js\n// test/hello.spec.js\nimport hello from '../src/hello.js';\n```\n\n## convert-yaml-to-toml\n\nFilesystem:\n\n```diff\n-[\"/\", \"/bunfig.yaml\"]\n+[\"/\", \"/bunfig.toml\"]\n```\n\n## convert-yaml-to-json\n\nFilesystem:\n\n```diff\n-[\"/\", \"/actions.yaml\"]\n+[\"/\", \"/actions.json\"]\n```\n\n### ❌ Example of incorrect code\n\n```js\n// src/hello.js\nexport const hello = 'world';\n```\n\n### ✅ Example of correct code\n\n```js\n// test/hello.spec.js\nimport hello from '../lib/hello.js';\n```\n\n## convert-js-to-json\n\nCheckout in 🐊**Putout Editor**:\n\n- [**Replacer**](https://putout.cloudcmd.io/#/gist/1d24f6b52a49cfecbfe104982d292244/a469d79ca6bc296eeb94af0712e5841d79aac237);\n- [**Scanner**](https://putout.cloudcmd.io/#/gist/f0f290d79b06d718d13252d05ee739e7/3f063d9b62fe20fd26579792549a7deb32cd987a);\n\nFilesystem:\n\n```diff\n-[\"/\", \"/package.js\"]\n+[\"/\", \"/package.json\"]\n```\n\n### ❌ Example of incorrect code\n\n```json\n```\n\n### ✅ Example of correct code\n\n```json\n```\n\n## move-referenced-file\n\nUpdate `.putout.json` to enable rule:\n\n```json\n```\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/02d0fefd171f6552c611dc6c11d0bbec/2b530c289e16e3fae375d44ce69ab3f8143e092e).\n\nBefore:\n\n```\n/\n|-- test/\n|  `-- hello.spec.js\n|-- src/\n|   `-- hello.js\n`-- lib/\n```\n\n```js\n__putout_processor_filesystem({\n    type: 'directory',\n    filename: '/',\n    files: [{\n        type: 'file',\n        filename: '/hello.txt',\n    }, {\n        type: 'file',\n        filename: '/world.txt',\n        content: 'hello world',\n    }, {\n        type: 'directory',\n        filename: '/abc',\n        files: [],\n    }],\n});\n```\n\n```js\n__putout_processor_filesystem([\n    '/',\n    '/hello.txt',\n    ['/world.txt', 'hello world'],\n    '/abc/',\n]);\n```\n\nAfter:\n\n```\n/\n|-- test/\n|   `-- hello.spec.js\n|-- src/\n`-- lib/\n    `-- hello.js\n```\n\n```diff\n-src/hello.js\n+lib/hello.js\n```\n\n```js\n__putout_processor_json({\n    rules: {\n        'filesystem/bundle': ['on', {\n            groups: [\n                ['__:columns/__', [\n                    'name-size-date.css',\n                    'name-size.css',\n                ]],\n                [\n                    'main.css',\n                    ['hello.css', 'world.css'],\n                ],\n                '1:1',\n            ],\n        }],\n    },\n});\n```\n\n```js\n__putout_processor_json({\n    rules: {\n        'filesystem/bundle': ['on', {\n            groups: ['1:1'],\n        }],\n    },\n});\n```\n\n## rename-file\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/0614c2da35a1864b59ac284f18656328/66daa5b325666a0d5befa586965c56e9636a5db4).\n\nUpdate `.putout.json` to enable rule:\n\n```json\n{\n    \"rules\": {\n        \"filesystem/bundle\": [\"on\", {\n            \"groups\": [\n                [\"__:columns/__\", [\n                    \"name-size-date.css\",\n                    \"name-size.css\"\n                ]]\n            ]\n        }]\n    }\n}\n```\n\nIt will make next modifications to filesystem:\n\n```diff\n-README.md\n+readme.md\n```\n\nFor more sophisticated example, use `mask`:\n\n```json\n{\n    \"rules\": {\n        \"filesystem/bundle\": [\"on\", {\n            \"mask\": \"*.good.css\",\n            \"groups\": [\"1:1\"]\n        }]\n    }\n}\n```\n\nIt will rename 'test' to 'spec' in `*.test.*` files:\n\n```diff\n-index.test.js\n+index.spec.js\n```\n\n### ❌ Example of incorrect code\n\n```json\n```\n\n## remove-files\n\nRemove next files:\n\n- `*.swp`;\n- `*.swo`;\n- `*.lock`;\n- `.DS_Store`;\n- `.travis.yml`;\n\nApply overrides:\n\n```json\n{\n    \"rules\": {\n        \"filesystem/bundle\": [\"on\", {\n            \"groups\": [\"hello.css\"]\n        }]\n    }\n}\n```\n\nIt will make next modifications to filesystem:\n\n```diff\n /\n |-- test/\n |   `-- hello.spec.js\n-|-- coverage/\n `-- lib/\n     `-- hello.js\n```\n\n### ❌ Example of incorrect code\n\n```json\n{\n    \"rules\": {\n        \"filesystem/replace-cwd\": [\"on\", {\n            \"from\": \"/home/coderaiser/putout\",\n            \"to\": \"/\"\n        }]\n    }\n}\n```\n\n### ✅ Example of correct code\n\n```toml\n[install]\nlockfile = false\nlinker = \"hoisted\"\n```\n\n## rename-spec-to-test\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/ab52a74195eeb2f689e7284a1c987a03/d3a0e2ffac0bb33cc243004975d242d07d6d0bff).\n\n```diff\n-index.spec.js\n+index.test.js\n```\n\n### ❌ Example of incorrect code\n\n```toml\n[install]\nlockfile = false\nlinker = \"hoisted\"\n```\n\n### ✅ Example of correct code\n\n```json\n```\n\n## rename-test-to-spec\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/28e4d3a847f0968401da67fff04fb784/1e3bfd4ddb241dd0de6c2402f49252af0806b719).\n\n```diff\n-index.test.js\n+index.spec.js\n```\n\n### ❌ Example of incorrect code\n\n```toml\n[install]\nlockfile = false\nlinker = \"hoisted\"\n```\n\n### ✅ Example of correct code\n\n```yaml\ninstall:\n  lockfile: false\n  linker: hoisted\n```\n\n## rename-referenced-file\n\nUpdate `.putout.json` to enable rule:\n\n```json\n```\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/688ef036984ed06a6b2ba349fdb84409/5597aa2b224d572b9204288f986ed06226a7c541).\n\nBefore:\n\n```js\n__putout_processor_json(['/', '/hello.xyz']);\n```\n\n```js\n__putout_processor_json([\n    '/',\n    ['/hello.xyz', 'hello world'],\n]);\n```\n\nAfter:\n\n```diff\n-hello.js\n+world.js\n```\n\n```js\n__putout_processor_json([\n    '/',\n    ['/hello.xyz', 'hello world'],\n]);\n```\n\n```js\n__putout_processor_json({\n    plugins: [],\n});\n```\n\n### ❌ Example of incorrect code\n\n```json\n{\n    \"install\": {\n        \"lockfile\": false,\n        \"linker\": \"hoisted\"\n    }\n}\n```\n\n### ✅ Example of correct code\n\n```yaml\nname: Node CI\non:\n    push:\n        branches: master\n```\n\n## replace-cwd\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/97a4cb9bc9f79abc9585bf5b47392450/b6b9de0a407258643bfa469453d967e089648a59).\n\nWhen `from=/home/coderaiser/putout` and `to=/`:\n\n```json\n{\n    \"install\": {\n        \"lockfile\": false,\n        \"linker\": \"hoisted\"\n    }\n}\n```\n\n### ❌ Example of incorrect code\n\n```yaml\ninstall:\n  lockfile: false\n  linker: hoisted\n```\n\n### ✅ Example of correct code\n\n```toml\n[install]\nlockfile = false\nlinker = \"hoisted\"\n```\n\n## read-all-files\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/fb221770d2f35e89faf19d70eb945a1c/c857e8c2bf0511157f30a36f167266da3ea31647).\n\n### ❌ Example of incorrect code\n\n```yaml\nname: Node CI\non:\n    push:\n    branches: master\n```\n\n### ✅ Example of correct code\n\n```json\n{\n    \"name\": \"Node CI\",\n    \"on\": {\n        \"push\": {\n            \"branches\": \"master\"\n        }\n    }\n}\n```\n\n## write-all-files\n\nWrite all files that was read before to Filesystem.\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/2dda6b05987bbf91a1b18d7032489c05/286d2f04eb0e002cef14d102fa3e59bdf17bda47).\n\n```json\n{\n    \"name\": \"Node CI\",\n    \"on\": {\n        \"push\": {\n            \"branches\": \"master\"\n        }\n    }\n}\n```\n\n### ❌ Example of incorrect code\n\n```json\n{\n    \"plugins\": []\n}\n```\n\n### ✅ Example of correct code\n\n```js\nexport default {\n    plugins: [],\n};\n```\n\n## License\n\nMIT\n","publish_time":1780862926814,"_cnpm_publish_time":1780862926814,"dist-tags":{"latest":"13.6.0"}}