GithubHelp home page GithubHelp logo

dmtrek14 / prismicbulkeditscript Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 12 KB

Node.js script to iterate through json files and make changes. Specifically created to batch edit Prismic data that's been exported.

License: MIT License

JavaScript 100.00%
javascript prismic

prismicbulkeditscript's Introduction

Prismic Bulk Edit Script

Node.js script to iterate through json files and make changes. Written to add a field to a Prismic type and populate it programmatically so that users wouldn't have to edit a lot of records. This can be used as the basis for future needs to bulk edit data from Prismic (which is exported as individual json files for each record).

How to use

  1. If you are using this to populate a new Prismic field, make sure you have added that field to your model in Prismic.
  2. Clone or fork this repo.
  3. Run npm install to get the packages.
  4. Add a "ForEditing" folder (at the same level as the node_modules folder). Place files you wish to edit in the "For Editing" folder.
  5. Run node JsonFileIterateAndEdit.js in the console.
  6. Your files have been edited and you can now re-import them to Prismic.
  7. Once you're done, you can clear the files out of "For Editing."

Other considerations

This script was written to bulk edit a specific Prismic type of item. The script deletes any documents of a different type since we don't want to edit and upload anything other than the items of the target type.

For future use in bulk edits, simply change as needed. Change the targetPrismicType variable to target the Prismic type you want to edit, and make edits in the loop to handle whatever edits you need to make. In this case we are slug-ifying the existing title field and adding it as a 'uid' field.

prismicbulkeditscript's People

Contributors

dmtrek14 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.