{"id":18561188,"url":"https://github.com/apostrophecms/piece-type-exporter","last_synced_at":"2025-09-09T06:23:58.280Z","repository":{"id":45575121,"uuid":"418593062","full_name":"apostrophecms/piece-type-exporter","owner":"apostrophecms","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-10T18:51:32.000Z","size":50,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T05:30:04.255Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/apostrophecms.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2021-10-18T17:00:34.000Z","updated_at":"2024-07-10T18:51:14.000Z","dependencies_parsed_at":"2024-07-10T21:57:14.849Z","dependency_job_id":"b56e33d9-9374-4840-ab6d-74fdfaaee3d7","html_url":"https://github.com/apostrophecms/piece-type-exporter","commit_stats":{"total_commits":47,"total_committers":3,"mean_commits":"15.666666666666666","dds":"0.17021276595744683","last_synced_commit":"7a3f0771f529de6975f734b7019ec6be6906f9f0"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fpiece-type-exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fpiece-type-exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fpiece-type-exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fpiece-type-exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apostrophecms","download_url":"https://codeload.github.com/apostrophecms/piece-type-exporter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247801178,"owners_count":20998331,"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":[],"created_at":"2024-11-06T22:06:05.422Z","updated_at":"2025-04-10T02:31:24.965Z","avatar_url":"https://github.com/apostrophecms.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CircleCI](https://circleci.com/gh/apostrophecms/piece-type-exporter/tree/main.svg?style=svg)](https://circleci.com/gh/apostrophecms/piece-type-exporter/tree/main)\n[![Chat on Discord](https://img.shields.io/discord/517772094482677790.svg)](https://chat.apostrophecms.org)\n\n# Apostrophe Pieces Exporter\n\n\u003e ⚠️ **NOTE:** This module is deprecated, its functionality has been incorporated into [@apostrophecms/import-export](https://github.com/apostrophecms/import-export).\n\nThis module adds an optional export feature to all piece type modules in an [Apostrophe](https://apostrophecms.com) project. This feature enables exporting *published* pieces of piece types where it is configured. Requires Apostrophe 3.\n\n## Installation\n\n```bash\nnpm install @apostrophecms/piece-type-exporter\n```\n\n## Use\n\n### Initialization\n\nConfigure `@apostrophecms/piece-type-exporter` and the form widgets in `app.js`.\n\n```javascript\nrequire('apostrophe')({\n  shortName: 'my-project',\n  modules: {\n    // The exporter module\n    '@apostrophecms/piece-type-exporter': {},\n    // A piece type that you want to make exportable\n    'article': {\n      options: {\n        export: true\n      }\n    }\n  }\n});\n```\n\nThe Pieces Exporter module improves all piece types in the site to add export functionality to them. To enable that functionality, **you must add the `export: true` option on the appropriate piece type(s)**. The example above demonstrates doing this in the `app.js` file. More often it will be preferable to set this option in the module's `index.js` file.\n\n```javascript\n// modules/article/index.js\nmodule.exports = {\n  extend: '@apostrophecms/piece-type',\n  options: {\n    label: 'Article',\n    pluralLabel: 'Articles',\n    export: true // 👈 Adding the export option.\n  },\n  // Other properties...\n}\n```\n\n### Additional options\n\n#### `omitFields`\n\nYou can specify properties to omit from exported documents with this option. The `export` option on the exportable piece type becomes an object with an `omitFields` property. `omitFields` takes an array of field names to omit.\n\nFor example, if you wanted to exclude the `archive` field from the export, you would configure your piece like this:\n\n```javascript\n// modules/article/index.js\nmodule.exports = {\n  extend: '@apostrophecms/piece-type',\n  options: {\n    label: 'Article',\n    pluralLabel: 'Articles',\n    export: {\n      omitFields: [ 'archive' ]\n    }\n  },\n  // Other properties...\n}\n```\n\n#### `expiration`\n\nBy default, exported files are automatically deleted after one hour. You can change this time span by setting an `expiration` property on the `export` option. It should be set to an integer representing the number of milliseconds until expiration.\n\n```javascript\n// modules/article/index.js\nmodule.exports = {\n  extend: '@apostrophecms/piece-type',\n  options: {\n    label: 'Article',\n    pluralLabel: 'Articles',\n    export: {\n      // 👇 Set to expire after two hours. Tip: Writing as an expression can\n      // help make it clearer to other people.\n      expiration: 1000 * 60 * 120\n    }\n  },\n  // Other properties...\n}\n```\n\n#### Export areas as plain text with `exportPlainText`\n\nBy default, this module exports areas as rich text. You will receive simple HTML markup corresponding to any rich text widgets present in those areas.\n\nIf you prefer, you can set the `exportPlainText: true` option *on an `area` schema field* to export it as plain text. In this case, tags are stripped and entities are un-escaped.\n\n```javascript\n// modules/article/index.js\nmodule.exports = {\n  extend: '@apostrophecms/piece-type',\n  options: {\n    label: 'Article',\n    pluralLabel: 'Articles',\n    export: true\n  },\n  fields: {\n    add: {\n      textArea: {\n        type: 'area',\n        widgets: {\n          '@apostrophecms/rich-text': {}\n        },\n        options: {\n          // 👇 The option set to export this area as plain text.\n          exportPlainText: true\n        }\n      }\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapostrophecms%2Fpiece-type-exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapostrophecms%2Fpiece-type-exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapostrophecms%2Fpiece-type-exporter/lists"}