Open Ninja243 opened 1 year ago
Copy pasting the file I'm trying to convert into https://yoyo930021.github.io/vc2c/ also doesn't work, so I think it might not be my environment that's the issue
It looks like the use of "$refs" is what causes the crash above. The following code is not transformed using the service above:
import Vue from 'vue'
import { Prop, Component, Ref, Model, Provide, Inject } from 'vue-property-decorator'
import Component from "vue-class-component";
import { Inject, Prop, Vue, Watch } from "vue-property-decorator";
import { Types } from "@/config/types";
import { ConfirmDialogComponent } from "@/modules/core/components/confirm-dialog/confirm-dialog.component";
import { MessageService } from "@/modules/core/services/message-service";
/**
* My basic tag
*/
@Component({
components: {
"confirm-dialog": ConfirmDialogComponent,
},
mounted() {
this.activeTabName = this.activeTab ? this.activeTab : this.firstTab();
},
})
export default class CctTabsComponent extends Vue {
private firstTab(): string {
const panes = (<any>this.$refs.cctTab).panes;
return panes?.[0]?.name;
}
}
This may be related to https://github.com/vuejs/vue-class-component/issues/94
Edit: patching my input file as suggested in the thread above does not fix this
Update: trying this with different versions of typescript (3, 3.5, 3.9.7 (as suggested in package.json), 4, 4.9) doesn't help.
Smaller update: despite forcing the versions of the dependencies of my project to exactly match the versions in this project's package.json, there seems to be an issue with prettier formatting vc2c's output code after it's generated. Here's a small extract of the output when prettier crashes:
SyntaxError: ',' expected. (45:52)
43 | const customerService = inject<>(Types.CUSTOMER_SERVICE);
44 | const breadCrumbService = inject<>(Types.BREAD_CRUMB_SERVICE);
> 45 | const tabsErrorValidation = public (nextTab: string, currentTab: string): boolean => {
| ^
46 | const currTab = (<any>/* TODO: Check this convert result, it can work well in 80% case.*/ context.root.$refs[currentTab])?.$v;
47 | const invalid = currTab?.$invalid;
48 | if (invalid)
at A (/Users/mweyaruider/IdeaProjects/cct-frontend/node_modules/prettier/parser-typescript.js:1:15163)
at cT (/Users/mweyaruider/IdeaProjects/cct-frontend/node_modules/prettier/parser-typescript.js:257:10765)
and here's a gist with the full output: https://gist.github.com/Ninja243/ea7502f705e0ed2d15aa45c66b60d323 Edit: dev dependencies from my package.json can be found here: https://gist.github.com/Ninja243/51ca95866e6660920f150b82f2aebf0b
Hey - I came across this project and was interested in using it, but it didn't work for me either. I am in the process of fixing it in this fork (https://github.com/someguy20336/vc2c) (temp PR with fixes) if you are interested. I will try to submit a PR for this repo once finished, but I am not sure how active this is anymore.
Note:
.vue
files, so I have not (and will not) be testing with those (couldn't get the tests to work so I removed them for now)Oh yeah that's awesome! Thanks for your help, I'll check this out as soon as I get back home!
Have a great Easter weekend!
someguy20336 @.***> schrieb am Sa., 8. Apr. 2023, 15:28:
Hey - I came across this project and was interested in using it, but it didn't work for me either. I am in the process of fixing it in this fork ( https://github.com/someguy20336/vc2c) (temp PR with fixes https://github.com/someguy20336/vc2c/pull/1) if you are interested. I will try to submit a PR for this repo once finished, but I am not sure how active this is anymore.
Note:
- I have not completed fixing it just yet, but it seems most of it works. Thought I would send it your way in case you wanted to try it and were still looking for a tool
- I have not fully tested this on our projects yet, just the unit tests
- We don't use .vue files, so I have not (and will not) be testing with those (couldn't get the tests to work so I removed them for now)
— Reply to this email directly, view it on GitHub https://github.com/yoyo930021/vc2c/issues/43#issuecomment-1500891993, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRWXDC3BY7KHOSP5PAIEQLXAFRWZANCNFSM6AAAAAATNDSPSM . You are receiving this because you authored the thread.Message ID: @.***>
If you can provide a minimal repro case of code, I can study it.
Hey, so as I mentioned, I fixed it along with several other things in this fork: https://github.com/someguy20336/vc2c/pull/1
I am happy to create a PR into this repo if you would like - otherwise, I plan to archive the fork. I can't guarantee the code is in the best state, but at this point it worked for all our projects for the most part (some manual fixing). I appreciate you making this tool! It helped a lot!
Hello, I don't seem to be able to convert any files using this tool. I get the following output:
Am I missing some dependencies? This happens for every file I try this with.