{"id":15680459,"url":"https://github.com/raresail/prisma-mapper","last_synced_at":"2025-05-07T11:14:50.053Z","repository":{"id":58540155,"uuid":"531848578","full_name":"RaresAil/prisma-mapper","owner":"RaresAil","description":"Empower Your Prisma Schema with Camel Case and Customized Mapping! The CLI adds @map @@map, @updatedAt and more!!","archived":false,"fork":false,"pushed_at":"2025-01-18T12:34:40.000Z","size":327,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-07T11:14:21.602Z","etag":null,"topics":["camel-case","camelcase","cicd","cli","generate","generator","json","linux","macos","map","mapper","nodejs","prisma","schema","updated-at","updatedat","windows"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@raresail/prisma-mapper","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RaresAil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-02T08:44:13.000Z","updated_at":"2025-01-18T12:34:41.000Z","dependencies_parsed_at":"2023-11-13T09:46:14.096Z","dependency_job_id":"50424885-a555-4eaa-819a-760372ca6b44","html_url":"https://github.com/RaresAil/prisma-mapper","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.2142857142857143,"last_synced_commit":"bd0a85d76398a9c86ec78253c7cbd3c35a49fa02"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaresAil%2Fprisma-mapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaresAil%2Fprisma-mapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaresAil%2Fprisma-mapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaresAil%2Fprisma-mapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RaresAil","download_url":"https://codeload.github.com/RaresAil/prisma-mapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252865727,"owners_count":21816309,"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":["camel-case","camelcase","cicd","cli","generate","generator","json","linux","macos","map","mapper","nodejs","prisma","schema","updated-at","updatedat","windows"],"created_at":"2024-10-03T16:42:07.214Z","updated_at":"2025-05-07T11:14:50.032Z","avatar_url":"https://github.com/RaresAil.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @raresail/prisma-mapper\n\n\u003ccenter\u003e\n\n[![Web Documentation](https://packages.raresdesigns.com/badges/raresail-prisma-mapper.svg)](https://packages.raresdesigns.com/@raresail/prisma-mapper)\n\n\u003c/center\u003e\n\n\u003cbr/\u003e\n\n[![CodeQL](https://github.com/RaresAil/prisma-mapper/actions/workflows/codeql.yml/badge.svg?branch=master)](https://github.com/RaresAil/prisma-mapper/actions/workflows/codeql.yml)\n[![Node.js CI](https://github.com/RaresAil/prisma-mapper/actions/workflows/node.js.yml/badge.svg)](https://github.com/RaresAil/prisma-mapper/actions/workflows/node.js.yml)\n[![Yarn Audit CI](https://github.com/RaresAil/prisma-mapper/actions/workflows/audit.yml/badge.svg)](https://github.com/RaresAil/prisma-mapper/actions/workflows/audit.yml)\n![NPM Package Downloads](https://badgen.net/npm/dm/@raresail/prisma-mapper)\n\n---\n\nA CLI that adds @map and @@map based on a json\n\n### Installation\n\n### NPM\n\n```\nnpm install -g @raresail/prisma-mapper\n```\n\n### Yarn\n\n```\nyarn global add @raresail/prisma-mapper\n```\n\n### Features\n\n- Adds `@map` and `@@map`\n- Keeps the `@db.` attributes for fields\n- Adds the `@updatedAt` for fields with the name `updated_at` or `updatedAt`\n- The prisma schema is formatted by the `@prisma/internals` after generation\n- The cli does not modify the current schema and generates a new one with the information from the current one\n- `.pmignore` Can be used to avoid adding the `@map`/`@@map` for specific fields when running the `map` command\n\n### Node Versions\n\n| Version | Supported |\n| ------- | --------- |\n| \u003c= 19.x | ❌        |\n| 20.x    | ✅        |\n| 21.x    | ❌        |\n| \u003e= 22.x | ✅        |\n\n### Getting Started\n\nIf the prisma schema is often pulled you can use the cli like\n\n```bash\nyarn prisma db pull --force\n  \u0026\u0026 yarn prisma-mapper generate\n  \u0026\u0026 yarn prisma-mapper map\n  \u0026\u0026 yarn prisma generate\n```\n\nor for `camelCase` by default\n\n```bash\nyarn prisma db pull --force\n  \u0026\u0026 yarn prisma-mapper map --camel\n  \u0026\u0026 yarn prisma generate\n```\n\nWith db pull force you get the latest schema updates and\nforce overwrites the file.\n\nThe generate command creates a json called `prisma-mapper.json` in the root,\nif the json already exists it adds in it any new fields/models. **`(NOT FOR --camel option)`**\n\n```bash\nyarn prisma-mapper generate\n```\n\nThe json looks like the following:\n\n- The hasMap is added by generate if the prisma model has already a `@@map`\n- The name is to add `@@map` for a model name\n- In the fields object is to add `@map` for each field\n\n```json\n{\n  \"model\": {\n    \"hasMap\": false,\n    \"name\": null,\n    \"fields\": {\n      \"field_name_1\": null,\n      \"field_name_2\": null\n    }\n  }\n}\n```\n\nThe map command modifies the `schema.prisma` file and adds the `@map` and `@@map`\nfor each field and model, if the field/model-name is in the json file, the\nfield/model will be renamed to the new name.\n\n```bash\nyarn prisma-mapper map\n```\n\n### Options\n\nBoth 2 commands have an option `--schema \"new schema path` to use the schema from a different location\n\n#### For both commands\n\n- `--schema \"new schema path`\n  - is to use the schema from a different location\n- `--camel`\n  - for map it does the mapping without a json file\n  - for generate it defaults the namings to camel case in the generated json\n\n#### Map options\n\n- `-o --output \"output schema path\"`\n  - after mapping save the schema to another location\n\n### Ignore File\n\nExample for the `.pmignore` file\n\n```pmignore\nenum_ignore_s_contents.someValue\nenum_ignore_contents.*\nenum_ignore_model\n\nmodel_ignore_s_contents.updated_at\nmodel_ignore_s_contents.created_at\nmodel_ignore_s_contents.enum_three\nmodel_ignore_contents.*\nmodel_ignore\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraresail%2Fprisma-mapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraresail%2Fprisma-mapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraresail%2Fprisma-mapper/lists"}