henrhie / Note.js

Vscode extension that allows you to prototype frontend projects quickly right in vscode
https://marketplace.visualstudio.com/items?itemName=henryansah.notejs
MIT License
13 stars 0 forks source link

Looks really cool, just need help with esbuild #1

Closed ericmlantz closed 2 years ago

ericmlantz commented 2 years ago

Hi, looks like a great idea! I am in a html, javascript, and css class right now and this could help a-lot. I am getting an error though when I try to run a script and I'm not sure what it means, could you help me figure out what I need to fix

Screen Shot 2022-03-03 at 7 55 03 AM
henrhie commented 2 years ago

Hi Eric.. i'm looking into it. I'll get back to you ASAP

ericmlantz commented 2 years ago

Awesome, thank you!

On Mar 3, 2022, at 8:36 AM, Henry Ansah @.***> wrote:

Hi Eric.. i'm looking into it. I'll get back to you ASAP

— Reply to this email directly, view it on GitHub https://github.com/henrhie/Note.js/issues/1#issuecomment-1058048405, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASSIXOFGS66AWXJO62TQ2NDU6C56ZANCNFSM5P2MT5DQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.

henrhie commented 2 years ago

Which OS are you using?

yilmazdurmaz commented 2 years ago

according to error message this is a problem of "windows/mac-to-linux/docker" or "windows-to-wsl" transition.

Are you using docker and bind-mount your working directory? or use "COPY . . " in a dockerfile? when you use "npm install esbuild", I think it copies files under "node_modules" of your working directory, but with executable type of your system. And if you use this "COPY . .", then "everything" is copied to docker container, thus wrong architecture. consider using a "dockerignore" file when you use a dockerfile and ready to publish.

Or, if you bind-mount your working directory, then your host and container will see same content, but from container's perspective it will be wrong architecture. your "package.json" file includes what you have installed. so delete "node_modules" folder (backup if you modified some), then "npm install" inside container.

you will not be able to work with both architecture at the same time, unless host and container has the same.

OR

if you are not using docker, just remove "node_modules" folder (unless you modified libraries inside) and do "npm install" again in your system. this should refresh your modules with your system's architecture.

henrhie commented 2 years ago

I think it's a problem related to the architecture of his system. I did the development on a windows machine so I only downloaded the windows binaries for esbuild. I guess the way forward is to have binaries of other architectures downloaded.

henrhie commented 2 years ago

@yilmazdurmaz I was wondering whether there is a way to download the platform-specific binary when installing the extension. Any ideas?

ericmlantz commented 2 years ago

I am not using docker, so where is the node_modules folder I need to remove? Thanks!

-Eric

On Mar 3, 2022, at 9:54 AM, Yılmaz Durmaz @.***> wrote:

according to error message this is a problem of "windows/mac-to-linux/docker" or "windows-to-wsl" transition.

Are you using docker and bind-mount your working directory? or use "COPY . . " in a dockerfile? when you use "npm install esbuild", I think it copies files under "node_modules" of your working directory, but with executable type of your system. And if you use this "COPY . .", then "everything" is copied to docker container, thus wrong architecture. consider using a "dockerignore" file when you use a dockerfile and ready to publish.

Or, if you bind-mount your working directory, then your host and container will see same content, but from container's perspective it will be wrong architecture. your "package.json" file includes what you have installed. so delete "node_modules" folder (backup if you modified some), then "npm install" inside container.

you will not be able to work with both architecture at the same time, unless host and container has the same.

OR

if you are not using docker, just remove "node_modules" folder (unless you modified libraries inside) and do "npm install" again in your system. this should refresh your modules with your system's architecture.

— Reply to this email directly, view it on GitHub https://github.com/henrhie/Note.js/issues/1#issuecomment-1058121902, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASSIXOCOXEM3VM6YG7ZG4TLU6DHA7ANCNFSM5P2MT5DQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.

yilmazdurmaz commented 2 years ago

@henrhie , @ericmlantz I wanted to try this myself in a docker container. It went sideways than I expected.

It seems VSCode installs only "esbuild-windows-64" for some reason instead of selecting platform binaries from esbuild. It might be a thing from esbuild itself or a setting in your project.

I will check if I can find a solution on esbuild's notes.

ericmlantz commented 2 years ago

Okay, np! Let me know if you need anything from me. It’s no rush, just a cool project so was curious! Thanks guys!

-Eric

On Mar 3, 2022, at 11:37 AM, Yılmaz Durmaz @.***> wrote:

@henrhie https://github.com/henrhie , @ericmlantz https://github.com/ericmlantz I wanted to try this myself in a docker container. It went sideways than I expected.

It seems VSCode installs only "esbuild-windows-64" for some reason instead of selecting platform binaries from esbuild. It might be a thing from esbuild itself or a setting in your project.

I will check if I can find a solution on esbuild's notes.

— Reply to this email directly, view it on GitHub https://github.com/henrhie/Note.js/issues/1#issuecomment-1058241262, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASSIXOHDGHJULUOPOLNPQD3U6DTFBANCNFSM5P2MT5DQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.

yilmazdurmaz commented 2 years ago

@ericmlantz

btw, if you have node.js installed, you may try this (assuming you use mac):

I use windows and tried in linux docker so it was natural fail for me trying above steps in my pc.

henrhie commented 2 years ago

@ericmlantz Can you confirm whether @yilmazdurmaz 's solution worked? I don't have a mac either. If it did work, then a temporary workaround would be to bundle the extension together with all esbuild platform-specific binaries which could significantly increase extension size.

yilmazdurmaz commented 2 years ago

@henrhie I have tried some tricks to get other binaries, unfortunately, I couldn't make it work. Last thing I could get in Alpine container is "The service was stopped".

The following are the ones I tried to check. I will leave the rest to you.

I did not try to clone/install inside the container.

henrhie commented 2 years ago

@yilmazdurmaz Thanks for the info. First point seems to make more sense - I'll definitely take a stab at it

henrhie commented 2 years ago

@ericmlantz I have published a platform-specific version of the extensions. Try updating and let me know how things pan out.

yilmazdurmaz commented 2 years ago

@henrhie

I have tested new packages on Alpine container and Ubuntu remote and they are working fine. Only problem for now that Linux packages are not yet on the VSCode Marketplace.

However, 2 of Mac and 1 Windows packages are already published, so an update should be visible in VSCode itself. @ericmlantz

by the way, if there are others following this issue, please check this CI actions page for the packages ready to fly. I used Linux files from here.

henrhie commented 2 years ago

@yilmazdurmaz Thanks for confirming. I'll publish the linux packages right away.

ericmlantz commented 2 years ago

I got this now:

On Mar 3, 2022, at 9:10 PM, Henry Ansah @.***> wrote:

@yilmazdurmaz https://github.com/yilmazdurmaz Thanks for confirming. I'll publish the linux packages right away.

— Reply to this email directly, view it on GitHub https://github.com/henrhie/Note.js/issues/1#issuecomment-1058755923, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASSIXOEMN2NJNEMM5EEELDTU6FWIXANCNFSM5P2MT5DQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.

ericmlantz commented 2 years ago

it worked when I went into the folder in my finder and opened a terminal there and did the npm install es… thing! How do I get the results of my variable declarations to occur? Thanks!

-Eric

On Mar 3, 2022, at 9:10 PM, Henry Ansah @.***> wrote:

@yilmazdurmaz https://github.com/yilmazdurmaz Thanks for confirming. I'll publish the linux packages right away.

— Reply to this email directly, view it on GitHub https://github.com/henrhie/Note.js/issues/1#issuecomment-1058755923, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASSIXOEMN2NJNEMM5EEELDTU6FWIXANCNFSM5P2MT5DQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.

yilmazdurmaz commented 2 years ago

@ericmlantz it is nice to know this manual fix works. However, I have good news, kinda?!

@henrhie has made some changes and automated a few processes, and now there are many platform versions on VSCode's extensions page.

the bad news is just about the arm64 version that another user reported a few hours ago, #2 . actually, it is the same problem you had, but I don't know if you both have exact same setup, so I treat this separately.

you should still be able to fix the same way you did in 0.0.19


as for the question about variables, can you make it a bit clearer with an example in a separate post? a short answer might be "console.log" in any cell because cells are connected.

henrhie commented 2 years ago

@ericmlantz @yilmazdurmaz All platform-specific packages have been published. Please update the extension to the latest version v0.0.22 and let me know what happens.

yilmazdurmaz commented 2 years ago

@henrhie I dont own any mac, but I have checked the arm64 vsix file and it has "esbuild-darwin-64" in it, not "esbuild-darwin-arm64".

I have also checked other platform files. It is either the build process or build machines, but files use only 3 of packages "esbuild-darwin-64", "esbuild-linux-64", and "esbuild-windows-64". None has any arm64 package (or others) despite the names.

One good news among is Alpine container is happy to use "esbuild-linux-64", so containers are covered.

By the way, thanks for the invite, but my github knowledge is very limited. I dont think I may be of use other than these small checks I am doing, So you may reconsider the invitation.

henrhie commented 2 years ago

That is right. Apparently, the build machines are not installing the arm version of the binaries.

henrhie commented 2 years ago

I have manually installed the darwin arm64 version of the binaries and published them. Anybody with a Mac should try it out and let me know so I can publish the arm versions for other operating systems

henrhie commented 2 years ago

According to this issue. They are yet to support M1 VMs for their build machines so, in the meantime, arm based packages have to be published manually.

ericmlantz commented 2 years ago

So I uploaded to the new version, .23. (I’m not sure how to do version specific, plus just going to install a new version and doing that which I did.) It didn’t work, but when I went into the folder and opened terminal and followed the same steps as before, these,

It worked! This is what came up in my console though if that helps!

Also, I’m not sure if it’s supposed to do this, but when I try to console a log an array from a different string, it just keeps running until I stop it myself. It’s like it’s consistently looking for it. But if I put it in same cell it works which is still awesome! Thanks!! Lemme know if I can try anything or do anything to help, I love the idea of this!

-Eric

On Mar 4, 2022, at 10:09 PM, Henry Ansah @.***> wrote:

According to this issue https://github.com/actions/virtual-environments/issues/2187. They are yet to support M1 VMs for their build machines so, in the meantime, arm based packages have to be published manually.

— Reply to this email directly, view it on GitHub https://github.com/henrhie/Note.js/issues/1#issuecomment-1059665544, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASSIXOFK7NXKIWBBQ4RIN2LU6LF43ANCNFSM5P2MT5DQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.

yilmazdurmaz commented 2 years ago

Honestly, about the use cases, I haven't fully read the readme file :) But I can say each cell is a separate file, giving them file names at the top such as /*constants*/ and /*index*/, and you need to export/import them as you would do with normal files: export const PI=3.14 and import {PI} from "./constants" (haven't tried ES5 "require").

henrhie commented 2 years ago

@yilmazdurmaz is right. Each cell is treated as a javascript module so in order to use a variable in one cell in another cell, you need to export the variable and import it in the cell you are using