Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add file name migrations #1216

Merged
merged 2 commits into from
Jan 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 123 additions & 41 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"warp10": "^2.0.1"
},
"devDependencies": {
"@marko/migrate": "^1.2.0",
"@marko/migrate": "^3.0.0",
"babel-cli": "^6.24.1",
"babel-core": "^6.24.1",
"babel-plugin-minprops": "^2.0.1",
Expand Down
5 changes: 4 additions & 1 deletion src/taglibs/migrate/all-tags/w-bind.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ module.exports = function migrate(el, context) {
.then(shouldMigrate => {
if (shouldMigrate) {
el.removeAttribute("w-bind");
return helpers.run("componentFile", componentModule);
return helpers.run("componentFile", {
templateFile: context.filename,
componentFile: componentModule.filename
});
}
});
}
Expand Down
24 changes: 12 additions & 12 deletions test/migrate/fixtures/include-tag/snapshot-expected.marko
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import ExampleE from "./example-e/index.marko"
<${ExampleA}/>
<!-- Import: with attributes -->
<${ExampleB} ...{
a: 1
} b=2/>
a: 1
} b=2/>
<!-- Import: index -->
<${ExampleC}/>
<!-- Import: name conflict -->
Expand All @@ -21,33 +21,33 @@ $ const ExampleD = undefined;
<!-- Import: with body -->
<${ExampleE}>
<div>Hi</div>
</${ExampleE}>
</>
<!-- Dynamic: basic -->
<if(typeof input.x === 'string')>${input.x}</if>
<if(typeof input.x === "string")>${input.x}</if>
<else>
<${input.x}/>
</else>
<!-- Dynamic: with attributes -->
<if(typeof input.x === 'string')>${input.x}</if>
<if(typeof input.x === "string")>${input.x}</if>
<else>
<${input.x} ...{
a: 1
} b=2/>
a: 1
} b=2/>
</else>
<!-- Dynamic: with body -->
<if(typeof input.x === 'string')>${input.x}</if>
<if(typeof input.x === "string")>${input.x}</if>
<else>
<${input.x}>
<div>Hi</div>
</${input.x}>
</>
</else>
<!-- Directive -->
<div>
<span/>
<if(typeof x === 'string')>${x}</if>
<if(typeof x === "string")>${x}</if>
<else>
<${x} ...{
a: 1
}/>
a: 1
}/>
</else>
</div>
20 changes: 10 additions & 10 deletions test/migrate/fixtures/layout-use/snapshot-expected.marko
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@ import ExampleD_1 from "./example-d.marko"
<!-- Import: basic -->
<${ExampleA}>
<div/>
</${ExampleA}>
</>
<!-- Import: with attributes -->
<${ExampleB} ...{
a: 1
} b=2>
a: 1
} b=2>
<div/>
</${ExampleB}>
</>
<!-- Import: index -->
<${ExampleC}>
<div/>
</${ExampleC}>
</>
<!-- Import: name conflict -->
$ const ExampleD = undefined;
<${ExampleD_1}>
<div/>
</${ExampleD_1}>
</>
<!-- Dynamic: basic -->
<${input.x}>
<div/>
</${input.x}>
</>
<!-- Dynamic: with attributes -->
<${input.x} ...{
a: 1
} b=2>
a: 1
} b=2>
<div/>
</${input.x}>
</>
5 changes: 5 additions & 0 deletions test/migrate/fixtures/w-bind-prompt-y/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ module.exports = [
question:
"A widget file was discovered, would you like to migrate that as well?\nNote: widget migrations are not 100% safe and should be tested after migration.",
answer: true
},
{
question:
"Would you like to rename the component file?\nNote: Marko 4 automatically discovers these files based on the naming convention, you may be able to remove them from a browser.json file after this.",
answer: true
}
];
Loading