mirror of
https://github.com/strapi/strapi.git
synced 2025-09-15 19:39:06 +00:00
22 lines
532 B
TypeScript
22 lines
532 B
TypeScript
![]() |
import type { Transform } from 'jscodeshift';
|
||
|
import { changeImportSpecifier } from '../../utils/change-import';
|
||
|
|
||
|
/**
|
||
|
* change useRBAC import from '@strapi/helper-plugin' to '@strapi/strapi/admin'
|
||
|
*/
|
||
|
const transform: Transform = (file, api) => {
|
||
|
const { j } = api;
|
||
|
|
||
|
const root = j.withParser('tsx')(file.source);
|
||
|
|
||
|
changeImportSpecifier(root, j, {
|
||
|
methodName: 'useRBAC',
|
||
|
oldDependency: '@strapi/helper-plugin',
|
||
|
newDependency: '@strapi/strapi/admin',
|
||
|
});
|
||
|
|
||
|
return root.toSource();
|
||
|
};
|
||
|
|
||
|
export default transform;
|