codeshift.config.ts is intended to act as the source of truth for every codemod package. Configs serve a dual purpose of holding all relevant metadata and one or more codemods.
Config properties
maintainers: Github maintainer usernames to be pinged when an issue/pr is raised against a mod
description: Description of the package
target: Packages to target. This will be used by the github bot to trigger codemod runs in the future
transforms: Key-value pair of transforms organised by semver version. These are indented for package targeting
presets: Generic transforms that are related to the package
Example:
export default {
maintainers: ['danieldelcore'],
description: "Codemods for upgrading @atlaskit/avatar",
target: ["@atlaskit/avatar", "@atlaskit/avatar-group"],
transforms: {
// Transforms for migrating to v1 of atlaskit avatar
"1.0.0": require("./1.0.0/transform"),
"2.0.0": require("./2.0.0/transform"),
},
presets: {
// Generic codemods intended to support the use of @atlaskit/avatar
"remove-chilren-props": require("./remove-chilren-props/transform"),
},
};
There are two types of codemods:
transforms these are intended to move a package on NPM across versions. (v1->v2)
presets intended to support the package (remove deprecated api)
Problems
- With the separation of versioned codemods, and presets is a bit odd. Ideally we can flatten this structure a bit more
codeshift.config.tsis intended to act as the source of truth for every codemod package. Configs serve a dual purpose of holding all relevant metadata and one or more codemods.Config properties
maintainers: Github maintainer usernames to be pinged when an issue/pr is raised against a moddescription: Description of the packagetarget: Packages to target. This will be used by the github bot to trigger codemod runs in the futuretransforms: Key-value pair of transforms organised by semver version. These are indented for package targetingpresets: Generic transforms that are related to the packageExample:
There are two types of codemods:
transformsthese are intended to move a package on NPM across versions. (v1->v2)presetsintended to support the package (remove deprecated api)Problems