Here improved our checks. No longet rely on "checks" script but run
"test" and "typescript" scripts from each package in monorepo.
Would also make each package less boilerplaty.
## Description
1. What is this PR about (link the issue and add a short description)
## Steps for reproduction
1. click button
2. expect xyz
## Code Review
- [ ] hi @kof, I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
- test it on preview
## Before requesting a review
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
## Before merging
- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
## Description
Part of https://github.com/webstudio-is/webstudio/issues/3149 this
allows us to understand if an instance has text child.
With this knowledge we can place instances into components that don't
have text children and after them if they do.
## Steps for reproduction
1. insert text or paragraph
2. see there is expected placeholder text which is editable
3. select it, tell AI to change color or something
4. see it works and see in payload it didn't send placeholder text
5. try text editing on empty body - shouldn't allow it
## Code Review
- [ ] hi @TrySound , I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
- test it on preview
## Before requesting a review
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
## Before merging
- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
Babel is very big package. It brings a lot of transitive dependencies. A
lot of projects like remix, storybook and jest depends on it.
Updating it is always a challenge because it usually lead to duplicates.
So here I switched to acorn we already use for expressions. JSX parsing
is not builtin but available as a plugin. The only downside is lack of
node types. Though very straightforward to get them from jsx estree
extension spec.
See build sizes change
```diff
- 4716 build/server
+ 3992 build/server
6096 build/client
```
Additionally in this PR prevented "Fragment" component generation, it
should not be used with anything except Slot.
## Description
Use canary react
## Steps for reproduction
1. click button
2. expect xyz
## Code Review
- [ ] hi @kof, I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
- test it on preview
## Before requesting a review
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
## Before merging
- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
With new remix setup we may finally not need hoisted linker which makes
pnpm very buggy.
Here added all missing dependencies to package.json and removed node
linker from .npmrc.
dev, build and dts are not necessary in not published packages and can
be removed. Builder vite setup is able to access webstudio export
conditions. Only prisma client need to be built before builder.
This will reduce CI time which runs build many times in various
workflows.
Here bumped prisma to the latest version
which supports new driver adapters as preview feature.
Also simplified prisma-client build and got rid from build-package
script. prisma-client package files are now commonjs only to avoid
issues with modern bundlers.
Bumped remix to v2 everywhere in CLI, fixtures and builder. Caught a lot
of type stuff. Runtime seem to work without changes. Removed
@vercel/remix and had to upgrade `remix-auth` packages.
Unable to test netlify and vercel from monorepo and need to have sdk
remix with updated remix. So will test after packages release.
## Code Review
- [ ] hi @kof, I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
- test it on preview
## Before requesting a review
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
## Before merging
- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
---------
Co-authored-by: istarkov <istarkov@gmail.com>
## Description
fixes email validation hangs
https://github.com/colinhacks/zod/issues/2580
## Steps for reproduction
1. click button
2. expect xyz
## Code Review
- [ ] hi @kof, I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
- test it on preview
## Before requesting a review
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
## Before merging
- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
Fixes:
- Disable Radix components via feat flag
- classNames should be optional when generating templates
- Prevent unwrapped JSX to fail
- Use shared computeSelectorForInstanceId when inserting templates and deleting instances
- Add extra instruction for GPT to fill required values just in case
Removes markdown code block delimiters from JSX the parser utility and
adds a new utility to extract code blocks from LLM responses.
There was a bug in the previous implementation where we were parsing the JSX stripped out of code blocks
delimiters but when extracting the props from the source string we were slicing the original string with delimiters.
- esbuild
- jest
- eslint
- eslint-typescript
Also removed "jest" binary from packages and use the one installed in
the root
and deduplicated all deps (got a little messy recently).
Implements an operation-based system to accomplish a number of edit
tasks on a JSX+CSS representation of a selected Webstudio tree.
Every JSX element has the instance id as data-ws-id and therefore the
LLM knows what to edit.
The idea is to create a number of operations (aiOperations)
specs/schemas with Zod describing unique edit tasks, make a
discriminated union, convert them to JSON Schema. We then inject this
information and the current JSX+CSS in the LLM prompt asking the model
to generate an array of operations.
The LLM responds with an array of operations (aiOperations) to fulfill
the user request. We then process these doing the necessary
transformations to convert these to a Webstudio-friendly format
(wsOperations) and send them to the client where we apply them (see
applyOperations).
Some of these operations are going to be "intermediate" operations for
now.
Generating quality user interfaces might be challenging with LLMs.
Having to do so within a generic operations framework like the one
described above makes it even more challenging.
For this reason when it comes to generating user interfaces, the
Operation chain instead offers an operation called
generateTemplatePrompt that provides information about insertion point
in the existing UI and a prompt, possibly enhanced.
Another chain can use these information and a more sophisticated prompt
and model to then generate the user interface and return a
generateInsertTemplate wsOperation. Webstudio does exactly this in a
rest endpoint, using the template-generator chain with gpt4 instead of
gpt-3.5-turbo.
Adds utils to work with JSX and transform it to Webstudio Embed Template
as well as converting Tailwind styles to Webstudio Embed Template style
declarations and a fake `<HeroIcon>` component to `HtmlEmbed` with
inline SVG taken from heroicons (we will need this for ai).