{"id":13534006,"url":"https://github.com/canjs/can-migrate","last_synced_at":"2025-04-23T04:37:03.686Z","repository":{"id":49958457,"uuid":"85086233","full_name":"canjs/can-migrate","owner":"canjs","description":"CLI \u0026 codemod scripts for upgrading to CanJS 3, 4 and 5","archived":false,"fork":false,"pushed_at":"2021-11-23T01:57:38.000Z","size":916,"stargazers_count":7,"open_issues_count":23,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T15:01:48.034Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://canjs.com/doc/guides/upgrade/using-codemods.html","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/canjs.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}},"created_at":"2017-03-15T15:02:32.000Z","updated_at":"2023-06-09T15:41:30.000Z","dependencies_parsed_at":"2022-08-30T07:01:14.615Z","dependency_job_id":null,"html_url":"https://github.com/canjs/can-migrate","commit_stats":null,"previous_names":["canjs/can-migrate-codemods"],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canjs%2Fcan-migrate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canjs%2Fcan-migrate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canjs%2Fcan-migrate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canjs%2Fcan-migrate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/canjs","download_url":"https://codeload.github.com/canjs/can-migrate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250372581,"owners_count":21419719,"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-08-01T07:01:25.318Z","updated_at":"2025-04-23T04:37:02.259Z","avatar_url":"https://github.com/canjs.png","language":"JavaScript","readme":"# can-migrate\n\n[![npm version](https://badge.fury.io/js/can-migrate.svg)](https://www.npmjs.com/package/can-migrate)\n[![Build Status](https://travis-ci.org/canjs/can-migrate.svg?branch=master)](https://travis-ci.org/canjs/can-migrate)\n[![Greenkeeper badge](https://badges.greenkeeper.io/canjs/can-migrate.svg)](https://greenkeeper.io/)\n\nCLI \u0026 codemod scripts for upgrading to CanJS 3 to 6.\n\n## Usage\n\nCheck out the [Using Codemods guide on canjs.com](https://canjs.com/doc/guides/upgrade/using-codemods.html) for an overview of this project, how to install `can-migrate`, how to use the CLI, and recommendations for how to migrate your app.\n\n## Generate template and tests\n\nThere is now a quick and easy way to create a transform and the associated tests and diff files. Running:\n```\n./bin/can-migrate-generate.js \u003cfolder\u003e \u003ctransform\u003e --can-version=6\n```\nWill either add the files to an existing folder or create a folder and add the files. It will create `transform.js` | `transform-test.js` | `transform-input.js` | `transform-output.js` as well as adding the information into the `transforms.json`.\n\n## transforms.json\n\nThere is one entry in the array per type of template/test required to generate the transforms.\nThe current groups of transforms are:\n\n- Component Rename: rename parts of a component\n- can.extend: swap out extend for assign or deep-assign\n- can-data: swap out .data() for domData\n- Replace imports/requires: Replace existing import/require statements and replace any references in the code\n- Replace can.*: Replace can.* methods and add the corresponding import/require\n\n```\n[\n  {\n    \"copy\": [ // Copy these files from src\n      {\n        \"input\": \"...\", // Source filename\n        \"output: \"...\", // Destination filename\n        \"type\": \"fixture|test|transform\" // Type of copy determines where the destination file ends up (more on that below)\n      }\n    ],\n    \"generate\": [ // Generate output from the template in src using \"transforms\n      {\n        \"template\": \"...\", // Source filename\n        \"outputPath: \"...\", // Destination filename\n        \"type\": \"fixture|test|transform\" // Type of copy determines where the destination file ends up (more on that below)\n      }\n    ],\n    \"transforms\": [\n      {\n        \"shortName\": \"component\", // Short name of the transform for debugging and template filename generation\n        \"oldSourceValues\": [ // List of ways this component could be imported/required. Used to replace these with newer component import\n          \"can/component/\",\n          \"can/component/component\",\n          \"can/component/component.js\"\n        ],\n        \"newSourceValue\": \"can-component\", // The new value of the import/require\n        \"exampleLocalName\": \"MyComponent\" // The example local name to include in generate documentation\n        \"oldObjectName\": \"can\", // Object name to look for\n        \"oldPropertyName\": \"addEvent\", // Property name to look for\n        \"newPropertyName\": addEventListener, // What should replace the object.property (false for nothing, could be a complex replacement like mutate.appendChild)\n        \"sourceValue\": \"can-construct\" // Key to look up the configurable naming in config.json\n      }\n    ]\n  }\n]\n```\n\n## Types\n\n- __test__: Copied to `lib`, file is added to `test/test.js`.\n- __fixture__ : Copied to `test/fixtures`\n- __transform__: Copied to `lib/transforms`\n","funding_links":[],"categories":["Misc"],"sub_categories":["ant-design"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanjs%2Fcan-migrate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcanjs%2Fcan-migrate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanjs%2Fcan-migrate/lists"}