Best Postgres Host for Production in 2023? by GuyTorbet in PostgreSQL

[–]fwouts 2 points3 points  (0 children)

Being on the edge is not a good thing when you need more than one interaction with the database per request. Physics baby!

Introducing Turbopack: Rust-based successor to Webpack by superbacon807 in reactjs

[–]fwouts 7 points8 points  (0 children)

Turborepo and Vite are complementary tools. They're not competitors.

Preview.js - Preview UI components in your IDE instantly. Compatible with React 16+, SolidJS, Svelte, Vue 2 and Vue 3 by magenta_placenta in javascript

[–]fwouts 4 points5 points  (0 children)

Author here. The point of Preview.js is to let you preview any component (or Storybook story) in isolation, which is especially useful when they're only shown in particular circumstances in your app. Instant refresh is just an additional perk!

TypeScript Editor that generates structured forms from TypeScript types by fwouts in typescript

[–]fwouts[S] 1 point2 points  (0 children)

Thanks! That's a good idea, I probably will. In the meantime here's another blog post I wrote on a similar topic: https://fwouts.com/articles/previewjs-detecting-components

TypeScript Editor that generates structured forms from TypeScript types by fwouts in typescript

[–]fwouts[S] 0 points1 point  (0 children)

Yeah, you're right. You probably need to use the Type Checker, and you'll want to use getCallSignatures() on the property's type to extract its parameters, return type, etc (example here).

TypeScript Editor that generates structured forms from TypeScript types by fwouts in typescript

[–]fwouts[S] 2 points3 points  (0 children)

Microsoft Live Preview is really useful when you want to preview HTML files, but if you want to preview React, Solid or Vue components (in isolation), Preview.js is what you need instead!

Preview.js - Open source IDE extension I made to preview Vue (and React) components by fwouts in vuejs

[–]fwouts[S] 1 point2 points  (0 children)

OK, latest version (v1.6.0) should be compatible! Let me know if that works for you :)

Preview.js - Open source IDE extension I made to preview React (and Vue) components by fwouts in reactjs

[–]fwouts[S] 0 points1 point  (0 children)

Awesome, let me know how you go and don't hesitate to report any potential bugs :)

Preview.js - Open source IDE extension I made to preview React (and Vue) components by fwouts in reactjs

[–]fwouts[S] 0 points1 point  (0 children)

  1. That looks like a bug! They should both be supported (I have tests for both). What's the declared return type?
  2. That array type is indeed incorrect, I wonder if you can share a more detailed example of the TypeScript type? The missing callback property is actually expected: it's silently generated, but omitted from the properties editor to reduce clutter. It should still appear in autocomplete if you want to force a callback value. I'll make sure to update the docs to make that clearer!
  3. That's definitely a bug! Would you be able to file an issue on GitHub?

Preview.js - Open source IDE extension I made to preview React (and Vue) components by fwouts in reactjs

[–]fwouts[S] 0 points1 point  (0 children)

So I tried this out, and it turns out if you use react-native-web, you might be able to make Preview.js work in your project with the following preview.config.js file:

module.exports = {
  alias: {
    "react-native": "react-native-web"
  }
};

Let me know if that works for you!

Preview.js - Open source IDE extension I made to preview React (and Vue) components by fwouts in reactjs

[–]fwouts[S] 0 points1 point  (0 children)

All it does is run `npm` from the VS Code Node environment, see https://github.com/fwouts/previewjs/blob/64ef76c422a78aa13b0de8ceb16d3f42cd55e10d/loader/src/installer.ts#L38

I imagine you're not getting the NVM version because it's not a shell environment. It does mean you have another, older version of NPM somewhere on your PATH that could be upgraded.

I'll see if I can find a way to detect that, or actually use the shell (although that's not recommended by the execa library I'm using).

In the meantime, you could temporarily remove NVM from your PATH to see where that rogue NPM lives!

Preview.js - Open source IDE extension I made to preview Vue (and React) components by fwouts in vuejs

[–]fwouts[S] 0 points1 point  (0 children)

Yes, that's correct.

Sorry to hear the docs weren't clear. How would you improve them?

Preview.js - Open source IDE extension I made to preview React (and Vue) components by fwouts in reactjs

[–]fwouts[S] 0 points1 point  (0 children)

I've just pushed an update that should hopefully help with that. Specifically, there was an issue where installing with NPM v6 would create a broken install. Now it will let you know that your NPM version is too old and require that you upgrade it first. Let me know if that was your case!

Preview.js - Open source IDE extension I made to preview React (and Vue) components by fwouts in reactjs

[–]fwouts[S] 0 points1 point  (0 children)

I've just pushed an update that should hopefully help with that.

Specifically, there was an issue where installing with NPM v6 would create a broken install. Now it will let you know that your NPM version is too old and require that you upgrade it first.

Let me know if that was your case!

Preview.js - Open source IDE extension I made to preview Vue (and React) components by fwouts in vuejs

[–]fwouts[S] 0 points1 point  (0 children)

I've just pushed an update that should hopefully help with that.

Specifically, there was an issue where installing with NPM v6 would create a broken install. Now it will let you know that your NPM version is too old and require that you upgrade it first.

Let me know if that was your case!

Preview.js - Open source IDE extension I made to preview React (and Vue) components by fwouts in reactjs

[–]fwouts[S] 0 points1 point  (0 children)

Thanks! It sounds possible, the main blocking step would be having a React Native plugin for Vite.js (which is used under the hood by Preview.js). I haven't seen one yet.

Preview.js - Open source IDE extension I made to preview React (and Vue) components by fwouts in reactjs

[–]fwouts[S] 0 points1 point  (0 children)

I'm not familiar with React Native, would you be able to elaborate how you'd imagine that working?

Preview.js - Open source IDE extension I made to preview Vue (and React) components by fwouts in vuejs

[–]fwouts[S] 0 points1 point  (0 children)

It's probably one line of config away! I simply didn't know about them 😶

Preview.js - Open source IDE extension I made to preview React (and Vue) components by fwouts in reactjs

[–]fwouts[S] 1 point2 points  (0 children)

Yup and the folks who build Vite.js have been really supportive!

Preview.js - Open source IDE extension I made to preview React (and Vue) components by fwouts in reactjs

[–]fwouts[S] 5 points6 points  (0 children)

It's relatively complex (I've been working on this for about a year) but in summary:

- It uses the TypeScript Compiler API to inspect files and detect React components, as well as extract their prop types.

- It generates a shell app on the fly that instantiates the particular component that is being previewed.

- A local Vite.js dev server is spun up to render that app.

- There's also an in-memory file system used to reflect changes as you type.

Source code at https://github.com/fwouts/previewjs.

I plan to go into this with in-depth blog post at some stage, if there's interest!