-
Notifications
You must be signed in to change notification settings - Fork 662
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
Migration from 3.0.9 to 4.0 #1200
Comments
I've been working on two independent example repos that "npm install vexflow" so I can check for integration / migration issues. The first repo is in JS, and the second repo is in TS. I use npm link / npm link vexflow to point
This error makes sense, because my node script is in JS but we're pointing it at TS sources. Our package.json specifies the main entry point to be index.ts. It should probably be the minimized production build: https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#including-declarations-in-your-npm-package Additionally, we'll need to build a *.d.ts declarations file.
Here's what Tone.js does: I got my example repo to work by changing our package.json to point to webpacked production JS file:
However, I'm not an expert in all the different fields of package.json. Anybody else have a clue? Otherwise I'm inclined to copy other projects' approaches :-). The Tone.js approach seems OK. They are a popular MIT licensed TS audio/music project, so I'm sure they don't mind if we learn from their package.json and webpack settings. The relevant package.json fields might be:
Once I'm done with my two demo repos, I'll post the link here. |
Ron, can you try it with https://github.com/0xfe/vextab please? I have instructions there around using Re: fields of |
Edit: correct the file name with the issue. I think there is an issue with our current build that we may want to fix before we release. It looks like the symbol is only created in releases/vexflow-tests.js, which I assume was the output of the build at an earlier time. If you don't have anything in your releases directory, the build will fail with unknown symbol 'Vex'. I think it will work just to replace that line with: const VF = Flow; |
This issue is fixed in my branch. With That test case is intentionally accessing We are just verifying that the global Vex.Flow exists, and things like Vex.Flow.Accidental are equivalent to Accidental. |
Migration done! You can open any MusicXML file They look quite different indeed |
The notes are going beyond the staves :( @sschmidTU you know that I use VexFlow with OSMD, any tip? |
This looks like an issue with clefNote. What are you using to compute the width - is it |
OSMD uses the following:
@sschmidTU this is the calculation, is not it? |
@AaronDavidNewman @sschmidTU I made an error updating the web page and I left and early version of the TS migrated code. The latest one looks much better indeed! Old 1.2.93 version |
I woulld say that it looks also finally better than 1.2.93! This is great! I will try wit other scores. |
Oh thanks for your help! My current commit that I've tested is b1473d9 on https://github.com/ronyeh/vexflow/tree/setFont The @loadFonts bit was inspired by your tsconfig paths for I assume your project is 100% TS and you are compiling with vexflow (via npm install / npm link)? |
yes, 100% TS via npm install / npm link |
Same output with b1473d9 |
The FontFace API is part of the web standard, and on my vscode is available via TypeScript's lib.dom.d.ts. I didn't have to do anything for VSCode to recognize this type. For example I wonder why your VSCode doesn't recognize that type? |
I might be missing a npm install in my project? I say that because I have no problem compiling b1473d9. |
I found a related question and answer on:
Does that mean I can just add that typings file as a dependency for VexFlow? |
I installed
I do not know |
Weird. But when you compile my branch, it compiles fine? If you ctrl+click (or alt+click on Mac) the name Anyways, thanks for your help. I'll see if I can repro this. |
Can you dig around and see if you can find your copy of lib.dom.d.ts? Where is it stored? Which distro / OS are you using? Even though the TS compiler and VS Code should recognize FontFace natively, I don't want this to be a stumbling block for developers who want to use VexFlow. Either we need to find an npm package (of typings) that will make this work seamlessly, or perhaps I can declare FontFace as a global any, and then just drop in an eslint-disable to squash the warnings, haha. |
I will do.
I have also placed complete paths in imports on all the files #1209. This is also to avoid the problems with npm link, linux...
I use Fedora 34
|
I pushed one last update for tonight.
cbebfb0
I just added a src/types/fontface.d.ts
Hopefully that will allow the types to work!
…On Sun, Oct 31, 2021 at 3:16 AM Rodrigo Vilar ***@***.***> wrote:
I will do.
I have also placed complete paths in imports on all the files in
migration/4.0. This is also to avoid the problems with linux...
I use Fedora 34
El dom, 31 de oct de 2021 a las 03:13:03 AM, Ron B. Yeh
***@***.***> escribió:
> Can you dig around and see if you can find your copy of lib.dom.d.ts?
> Where is it stored? Which distro / OS are you using?
>
> Even though the TS compiler and VS Code should recognize FontFace
> natively, I don't want this to be a stumbling block for developers
> who want to use VexFlow.
>
> Either we need to find a npm package (of typings) that will make this
> work seamlessly, or perhaps I can declare FontFace as a global any,
> and then just drop in an eslint-disable to squash the warnings, haha.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#1200 (comment)>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AFOOLBMGSNNDBHJOAIU5YXLUJUJC7ANCNFSM5G2U3ECQ
>.
>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1200 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAB2MCNZYXXJNEQEXOUSPM3UJUJPHANCNFSM5G2U3ECQ>
.
|
This is what the file looks like:
ronyeh/vexflow@cbebfb0
https://github.com/ronyeh/vexflow/tree/setFont
Good night! Putting my laptop (and me) to sleep. :-)
…On Sun, Oct 31, 2021 at 3:19 AM Ron Yeh ***@***.***> wrote:
I pushed one last update for tonight.
cbebfb0
I just added a src/types/fontface.d.ts
Hopefully that will allow the types to work!
On Sun, Oct 31, 2021 at 3:16 AM Rodrigo Vilar ***@***.***>
wrote:
> I will do.
>
> I have also placed complete paths in imports on all the files in
> migration/4.0. This is also to avoid the problems with linux...
>
> I use Fedora 34
>
> El dom, 31 de oct de 2021 a las 03:13:03 AM, Ron B. Yeh
> ***@***.***> escribió:
> > Can you dig around and see if you can find your copy of lib.dom.d.ts?
> > Where is it stored? Which distro / OS are you using?
> >
> > Even though the TS compiler and VS Code should recognize FontFace
> > natively, I don't want this to be a stumbling block for developers
> > who want to use VexFlow.
> >
> > Either we need to find a npm package (of typings) that will make this
> > work seamlessly, or perhaps I can declare FontFace as a global any,
> > and then just drop in an eslint-disable to squash the warnings, haha.
> >
> > —
> > You are receiving this because you commented.
> > Reply to this email directly, view it on GitHub
> > <#1200 (comment)>,
> > or unsubscribe
> > <
> https://github.com/notifications/unsubscribe-auth/AFOOLBMGSNNDBHJOAIU5YXLUJUJC7ANCNFSM5G2U3ECQ
> >.
> >
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#1200 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAB2MCNZYXXJNEQEXOUSPM3UJUJPHANCNFSM5G2U3ECQ>
> .
>
|
Just updating folks on this thread. Rodrigo and I are collaborating over chat at the moment. We have figured out the FontFace error. The API declaration was introduced in TypeScript 4.4, and he's running TS 4.3.5. So I put in @ts-ignore comments in the appropriate places to ask VS Code / TS compiler to ignore errors in that method for now. I'm now trying to figure out our path alias issue. |
See this thread for first steps on migrating your project to 4.0.0: Quick Start:
Please respond with the errors you're seeing. I can help point you in the right direction. Or if I'm away from keyboard, I'm sure Rodrigo can also help, since he seems to be intimately familiar with my code.... Also, we're 8 hrs offset from each other, so you'll almost have 24 hr tech support for this upgrade. One time special offer! ;-) |
@sschmidTU Ron and I decided to give a try at vanilla OSMD migration without my app PianoPlay.
edit package.json:
At this stage the compilation will fail because vexflow is missing.
@ronyeh @sschmidTU I believe that the steps are now the right ones and I get a lot of errors (thoughts?): |
@sschmidTU can you try the mini guide above and provide some feedback/help? Am I missing something or doing something wrong? I am not progressing. :( |
I successfully migrated VexTab to VexFlow 4.0.0. This is the patch for the migration of VexTab: 0xfe/vextab#137 I had to modify VexFlow a bit to restore some backwards compatibility. I also added some new accessors: I can cherry pick that commit and submit it as a separate PR if it makes it easier to merge. Here is the process I used to migrate VexTab. It might help others with migrating their own projects to VexFlow 4.
There were some errors, but I was able to debug & fix them. Not too bad. Here are the screenshots after the VexTab migration. |
@ronyeh @sschmidTU the problem in the migration is that the imported vex can be used to instantiate objects (ie.: Vex.Flow.StaveNote):
I have made a pul request to my own fork so that you can see the changes https://github.com/rvilarl/opensheetmusicdisplay/pull/2/files |
This meta issue tracks any known stumbling blocks when migrating a project from 3.0.9 to 4.0.
These stumbling blocks can be addressed in our CHANGELOG file.
One idea is to use
npm link
to point the VexTab project at VexFlow 4.0, and then see what errors pop up. You can do the same with your own project, and list some of the errors here.We can promote some to independent issues, if they are bad enough to warrant a bug fix.
The text was updated successfully, but these errors were encountered: