File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -52,26 +52,29 @@ function isNewExpressionChangedPayload(path) {
5252module . exports = function transformer ( file , api ) {
5353 const j = api . jscodeshift ;
5454 // Remove `import { ChangedPayload } from "almin"
55+ let hasAlmin = false ;
56+
5557 return (
5658 j (
5759 j ( file . source )
5860 . find ( j . ImportSpecifier )
5961 . filter ( path => {
60- return isChangedPayloadImportSpecifier ( path ) ;
62+ hasAlmin = isChangedPayloadImportSpecifier ( path ) ;
63+ return hasAlmin ;
6164 } )
6265 . remove ( )
6366 . toSource ( )
6467 )
6568 // Rewrite new ChangedPayload() => { type: "ChangedPayload" }
6669 . find ( j . NewExpression )
6770 . filter ( path => {
68- let newExpressionChangedPayload = isNewExpressionChangedPayload ( path ) ;
69- console . log ( newExpressionChangedPayload ) ;
70- return newExpressionChangedPayload ;
71+ if ( ! hasAlmin ) {
72+ return false ;
73+ }
74+ return isNewExpressionChangedPayload ( path ) ;
7175 } )
7276 . replaceWith ( path => {
7377 return `{ type: "ChangedPayload" }` ;
74- R ;
7578 } )
7679 . toSource ( )
7780 ) ;
You can’t perform that action at this time.
0 commit comments