{"id":18984978,"url":"https://github.com/rbardini/metalsmith-move-up","last_synced_at":"2025-04-19T20:25:46.969Z","repository":{"id":31737438,"uuid":"35303442","full_name":"rbardini/metalsmith-move-up","owner":"rbardini","description":"A Metalsmith plugin for moving the full contents of a directory up one or more levels. ","archived":false,"fork":false,"pushed_at":"2024-08-04T10:03:47.000Z","size":172,"stargazers_count":10,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-16T19:20:36.471Z","etag":null,"topics":["directory","folder","metalsmith","metalsmith-plugin","move","plugin"],"latest_commit_sha":null,"homepage":"https://npm.im/metalsmith-move-up","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rbardini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"ko_fi":"rbardini","custom":["buymeacoffee.com/rbardini","paypal.me/rbardini"]}},"created_at":"2015-05-08T21:50:45.000Z","updated_at":"2023-08-21T08:19:51.000Z","dependencies_parsed_at":"2023-12-25T17:18:28.712Z","dependency_job_id":"f1688024-6297-46c0-9678-c8aaa0923c54","html_url":"https://github.com/rbardini/metalsmith-move-up","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbardini%2Fmetalsmith-move-up","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbardini%2Fmetalsmith-move-up/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbardini%2Fmetalsmith-move-up/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbardini%2Fmetalsmith-move-up/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rbardini","download_url":"https://codeload.github.com/rbardini/metalsmith-move-up/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249793629,"owners_count":21326567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["directory","folder","metalsmith","metalsmith-plugin","move","plugin"],"created_at":"2024-11-08T16:23:56.418Z","updated_at":"2025-04-19T20:25:46.928Z","avatar_url":"https://github.com/rbardini.png","language":"JavaScript","funding_links":["https://ko-fi.com/rbardini","buymeacoffee.com/rbardini","paypal.me/rbardini"],"categories":[],"sub_categories":[],"readme":"# metalsmith-move-up\n[![travis][travis-badge]][travis-url]\n[![git][git-badge]][git-url]\n[![npm][npm-badge]][npm-url]\n[![standard][standard-badge]][standard-url]\n\nMetalsmith MoveUp is a [MetalSmith][] plugin for moving the full contents of a directory up one or more\nlevels. By default this plugin will move everything in your destination directory up one. Metalsmith MoveUp\nsupports multiple transforms, which are processed in the order they are provided, allowing for more complex\ntransforms to be done with a single call.\n\nFor globbing support we use [minimatch][]. To make matching easier we set dot matching to true meaning a global\nmatch can be done using a single globstar `**`. MiniMatch options can be provided as a global or on a per transform\nbasis.\n\n## Installation\nTo install Metalsmith MoveUp, simply use npm:\n\n```\nnpm install metalsmith-move-up --save\n```\n\n## Usage\nThe example below can be found and ran from the [eg](./eg/) folder; it demonstrates\nhow to use Metalsmith MoveUp in a couple of different ways in a node.js app.\n\n### Javascript\n```javascript\n'use strict'\n\nvar metalsmith = require('metalsmith'),\n    moveUp = require('metalsmith-move-up')\n\n// move everything in the build folder up one. The\n// build folder always represents the root for operations.\nmetalsmith.use(moveUp())\n\n// defaults are added as needed so input is easier. Input\n// is simplified where possible. both lines will have a\n// default .by of 1 and will use dot:true for mini-match.\nmetalsmith.use(moveUp('pages/*'))\nmetalsmith.use(moveUp({pattern: 'pages/*'}))\n\n// multiple simple transforms are also supported.\nmetalsmith.use(moveUp([\n  'lib/**',\n  'test/*'\n]))\n\n// multiple, order specific, transforms can be done with one\n// call. Each job only begins after the previous one finishes.\nmetalsmith.use(moveUp([\n  '!*.css',\n  'index.css'\n]))\n\n// the .by field moves everything N or as many times as\n// possible. This means if a given match only has one path\n// part, it will only be moved up one directory.\nmetalsmith.use(moveUp({\n  pattern: 'pages/*',\n  by: 2\n}))\n\n// globbing is supported via minimatch. default options for\n// minimatch can be supplied at a global level using the .opts\n// field. Transforms are added to the .transforms array, any\n// transform that does not have a .opts field will get the\n// global .opts value. This is a replace, not a merge.\nmetalsmith.use(moveUp({\n  opts: {\n    dot: false\n  },\n  transforms: [\n    {pattern: 'pages/*', by: 2},\n    {pattern: 'css/*', by: 2, opts: {dot: true}}\n  ]\n}))\n```\n\n### Metalsmith JSON\n```json\n{\n  \"source\": \"./src\",\n  \"destination\": \"./dest\",\n  \"plugins\": {\n    \"metalsmith-move-up\": {\n      \"opts\": {\"dot\": \"true\"},\n      \"transforms\": [\n        {\"pattern\": \"**\", \"by\": \"2\"},\n        {\"pattern\": \"posts/*\", \"by\": \"2\", \"opts\": {\"dot\": \"false\"}}\n      ]\n    }\n  }\n}\n```\n\n### Transform\nThe transform object has three fields, if no transforms are passed a default pattern will be ran that\npulls all applicable files and folders in the build directory up by one.\n\n##### _pattern_\nThe glob pattern to use when locating files and directories for moving. See both [minimatch][] for\nexample patterns.\n\n##### _by_\nThe maximum number of path parts to remove. Matches with less path segments than the count will have\nall of their segments removed, as such, they will end up in the root (destination) folder.\n\n##### _opts_\nThe options to use with minimatch, order is field \u003e global \u003e default each overriding the last. Note\nthat these options do not merge, they overwrite.\n\n## Contributing\nMetalsmith MoveUp is an __open project__ and encourages participation. If you feel you can help in\nany way, be it with examples, extra testing, or new features please be our guest.\n\n_See our [Contribution Guide][] for information on obtaining the source and an overview of the tooling used._\n\n## License\n\nCopyright Dean McDonnell 2015, Licensed under [MIT](./LICENSE)\n\n[travis-badge]: https://img.shields.io/travis/rbardini/metalsmith-move-up.svg?style=flat-square\n[travis-url]: https://travis-ci.org/rbardini/metalsmith-move-up\n[git-badge]: https://img.shields.io/github/release/rbardini/metalsmith-move-up.svg?style=flat-square\n[git-url]: https://github.com/rbardini/metalsmith-move-up/releases\n[npm-badge]: https://img.shields.io/npm/v/metalsmith-move-up.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/metalsmith-move-up\n[standard-badge]: https://img.shields.io/badge/code%20style-standard-blue.svg?style=flat-square\n[standard-url]: https://npmjs.org/package/standard\n[Metalsmith]: http://metalsmith.io\n[MultiMatch]: https://www.npmjs.com/package/minimatch\n[MiniMatch]: https://www.npmjs.com/package/minimatch\n[Contribution Guide]: ./CONTRIBUTING.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbardini%2Fmetalsmith-move-up","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frbardini%2Fmetalsmith-move-up","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbardini%2Fmetalsmith-move-up/lists"}