68 Commits
Author SHA1 Message Date
Bogdan Chadkin dd21011c31 build: resync fixtures (#2856)
Here updated fixtures after migrating page meta to expressions.
2024-02-01 20:53:58 +07:00
Bogdan Chadkin 443fa5a50c feat: support social image url (#2845)
To integrate cms we need to be able to specify arbitary url as social
image instead of just asset.

Here added input which overrides selected asset. Hidden behind the flag.

<img width="538" alt="Screenshot 2024-01-30 at 21 27 40"
src="https://github.com/webstudio-is/webstudio/assets/5635476/e472028c-1cea-4e7d-9320-75d0cb9d2eff">
2024-01-30 23:39:40 +07:00
Bogdan Chadkin 35fbcb9fc4 refactor: generate page meta in loader (#2844)
Here refactored page meta with simpler type than full page data and
moved it into factory which is invoked lazily in loader.

This will let us support variables and resources in page settings later.
2024-01-30 21:24:55 +07:00
Ivan Starkov 091bd3d9a3 feat: Allow change route template in cli custom templates (#2827)
Allow change route template, so various tests in saas become easier. 
Also now each template can have own route template.
2024-01-26 14:38:53 +07:00
Bogdan Chadkin d0395d072e refactor: generalize generating components (#2816)
Ref https://github.com/webstudio-is/webstudio/issues/2791

Here renamed generatePageComponent to generateWebstudioComponent and
refactored to use it later for slots.

"Page Params" variable is now passed as parameter. Similar way we will
support parameters in design components.
2024-01-25 23:17:17 +07:00
Ivan Starkov b31738b586 feat: Add additional page for fixtures (#2819)
## Description

Add additional page for base fixture to simplify script loading testing.
(In other PR)

## 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
2024-01-25 18:39:27 +03:00
Bogdan Chadkin a474d92069 refactor: inline actions into props (#2813)
Ref https://github.com/webstudio-is/webstudio/issues/2791

Here refactored actions generation and computing
to simplify rendering slots as components.

before

```ts
const onClick = () => {
variableName = 1
set$variableName(variableName)
}
...
<Box
data-ws-id="..."
data-ws-component="Box"
onClick={onClick}>
```

after

```ts
<Box
data-ws-id="..."
data-ws-component="Box"
onClick={() => {
variableName = 1
set$variableName(variableName)
}}>
```

Similar thing done in builder. Actions are generated and executed per
each prop when compute prop values instead of precomputing globally
along with variables.
2024-01-25 12:50:59 +07:00
Bogdan Chadkin 8d073e598d refactor: pass resources to page with context (#2777)
Resources should not be part of component props.
Drilling resources to nested custom components
would be more complex so using context can
simplify this part and prepare for rendering
slots as separate components.
2024-01-18 23:33:54 +07:00
Oleg Isonen 65d0df8213 feat: Nested routes compiler (#2766)
Ref https://github.com/webstudio-is/webstudio/issues/404

## Description

- generate remix app with nested routes

## Steps for reproduction

1. create nested routes 
2.  generate app using cli

## Code Review

- [ ] hi @istarkov , 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
2024-01-16 17:03:54 +01:00
Bogdan Chadkin 694cfefe33 chore: resync fixtures 2024-01-14 15:52:42 +07:00
Ivan Starkov 672ee9a98a feat: Support atomic CSS on build (#2739)
## Description

Logic was changed only in `prebuild.ts`. All other changes or README or
autogenerated

Integrate atomic CSS support into CLI

The Vercel fixtures project now explicitly sets atomicStyles to true.
Netlify explicitly sets atomicStyles to false.
The custom template doesn't have a default setting, so atomicCss=true is
used."

## Steps for reproduction

See fixtures.

## 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
2024-01-08 10:36:09 +02:00
Oleg Isonen 5930064678 feat: Rename Site to Project because we are not just building a site builder (#2718)
## Description

Site is too narrow name for things that are pssible with webstudio


## 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
2023-12-30 10:40:09 +01:00
Bogdan Chadkin f0b7a41824 fix: improve generating resources (#2715)
Ref https://github.com/webstudio-is/webstudio/issues/2532

Here added resources fixture and fixed a few issues with it

- add optional chaining to collection?.map to safely skip iterating
missing data
- added any to resource responses to access remote data without type
errors
- always generate empty headers array
- skip empty body in generated resources
2023-12-27 23:42:50 +07:00
Bogdan Chadkin 842c017c11 refactor: make resources universal (#2710)
Refactored resources generator to use universal http resource which
cover most cases.
- loadResource is imported from sdk
- accepts url (expression), method, headers (value is expression) and
body (expression)
- all variables and page params parameter are available for loader
expressions
2023-12-24 01:03:44 +07:00
Bogdan Chadkin dcd989108e feat: generate resource loaders (#2701)
Ref https://github.com/webstudio-is/webstudio/issues/2532

Here added generation of server modules with resource loaders. These
loaders are invoked in remix loader and result is passed to page
component.

Check fixtures and tests.
2023-12-18 21:24:50 +07:00
Bogdan Chadkin 02534730de feat: support resources in schema and compiler (#2698)
Ref https://github.com/webstudio-is/webstudio/issues/2532

Here added new schema type "Resources" to contain configuration of
requests to services. Their first use case is referencing from variable
to store loaded data.

For now added only client side generation. Later add support for server
code generation as part of remix loaders.
2023-12-16 15:44:49 +07:00
Bogdan Chadkin 7fe4b770d6 feat: support page path params in site compiler (#2682)
Ref https://github.com/webstudio-is/webstudio/issues/2532

Here remix route params are adapted to URLPattern format and passed to
generate page component as prop.

For this added 2 remix specific utilities
- convert subset of url pattern to remix route
- generate utility to adapt remix params to URLPattern params for
example for `/*` `params['*']` is replaced with `params[0]` and for
`/:slug*` `params['*']` is replaced with `params['slug']`
2023-12-15 00:34:51 +07:00
Jaya Krishna Namburu 301e7d95ca fix: Display error messages when a template is not passed for building a project (#2660)
## Description

fixes #2538 and #2615

Don't use `vercel` as default template while exporting from cli

## Code Review

- [ ] hi @istarkov , I need you to do
  - detailed review (read every line)
  
## Before requesting a review

- [x] made a self-review

## Before merging

- [x] tested locally and on preview environment (preview dev login:
5de6)
- [x] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
2023-11-28 18:07:21 +01:00
Jaya Krishna Namburu 6c2a26a464 feat: use netlify image loader for netlify templates (#2655) 2023-11-26 16:10:43 +05:30
Ivan Starkov a939121318 fix: Incorrectly quoted URLs in CSS (#2642)
## Description

Even we have this

https://github.com/webstudio-is/webstudio-builder/blob/9af97656af2e06a789f416bd93e1e1d0e756f063/packages/asset-uploader/src/utils/sanitize-s3-key.ts#L26

Additionally seems like best practice is to add backslashes for `"` and
`\` symbols, even this symbols are impossible having sanitize we are
using. (In case of sanitizer change everything can break)




## 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
2023-11-22 18:53:36 +02:00
Jaya Krishna Namburu c723b81885 feat: Add UI handling for transition timing and delay attributes (#2581)
- Adds `transition-duration` and `transition-delay` input boxes.
- Adds tooltips for all the UI actions for transitions.
2023-11-17 07:49:25 +01:00
Bogdan Chadkin 98f0c348e8 refactor: add remix body component (#2612)
Here replaced scripts injection with special body override which already
includes those scripts.
This would simplify the logic with collections support.
2023-11-14 16:06:20 +03:00
Bogdan Chadkin 4e9986d6e3 refactor: inline expressions into props (#2603)
Ref https://github.com/webstudio-is/webstudio/issues/2532

Collections will introduce nested scope within same component and some
expressions at component scope will not be able to access collection
item. For example

```ts
const PageComponent = () => {
  let [value, set$value] = useState('')
  let show = value === 'error'
  let arialabel = item + ' label'
  return <Form>
    <ErrorMessage data-ws-show={show}></ErrorMessage>
    {list.map(item =>
      <Button aria-label={arialabel}></Button>
    )}
  </Form>
}
```

So the easiest way to workaround it without complicated scope selecting
is just inline all expressions into props.

```ts
const PageComponent = () => {
  let [value, set$value] = useState('')
  return <Form>
    <ErrorMessage data-ws-show={value === 'error'}></ErrorMessage>
    {list.map(item =>
      <Button aria-label={item + ' label'}></Button>
    )}
  </Form>
}
```

## Steps for reproduction

1. Create `Form`
2. Try to change `state` prop
2023-11-12 13:07:14 +03:00
Ivan Starkov 7373d38a32 build: Make migration fast (#2597)
## Description

speedup migration 1000x

## 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
2023-11-10 22:55:22 +02:00
Ivan Starkov eefc96315e fix: Fix cli types (#2592)
## 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.example`
and the `builder/env-check.js` if mandatory
2023-11-09 23:05:22 +02:00
Bogdan Chadkin cdf6681bf3 fix: prop expression removing (#2588)
Ref https://github.com/webstudio-is/webstudio/issues/2532

Here fixed removing prop expression by using own prop setter in
variables instead of onChange callback which was proxied to support
updating variable values and prevented actually setting non-expression
value.

## Steps for reproduction

1. try to clear prop expression
2. try to add new expression
2023-11-09 15:40:47 +03:00
Ivan Starkov 437d23f4d7 fix: Omit excluded pages from sitemap generation (#2579)
## Description

Omit excluded pages from sitemap generation

## 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
2023-11-07 15:26:01 +02:00
Bogdan Chadkin 0d735c2bf8 refactor: compile prop expressions (#2569)
Ref https://github.com/webstudio-is/webstudio/issues/2532

Here changed accessing expression from data source id to prop id in
builder and data source name to prop name in generated code.

This is another step to migrate expressions from data sources to props.

See generated output for clarification.

Note: review with hidden spaces
2023-11-06 13:14:34 +03:00
Ivan Starkov 167c594243 fix: Wrong path in rate limiting (#2570)
## 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.example`
and the `builder/env-check.js` if mandatory
2023-11-05 23:42:24 +02:00
Ivan Starkov c620f1ecba feat: Add sitemap generation (#2566)
## Description

Generates following sitemap.xml for published sites

```
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

  <url>
    <loc>https://localhost:3000/</loc>
    <lastmod>2023-11-03</lastmod>
  </url>
    
  <url>
    <loc>https://localhost:3000/radix</loc>
    <lastmod>2023-11-03</lastmod>
  </url>
    
  <url>
    <loc>https://localhost:3000/_route_with_symbols_</loc>
    <lastmod>2023-11-03</lastmod>
  </url>
    
  <url>
    <loc>https://localhost:3000/form</loc>
    <lastmod>2023-11-03</lastmod>
  </url>
    
  <url>
    <loc>https://localhost:3000/heading-with-id</loc>
    <lastmod>2023-11-03</lastmod>
  </url>
    
</urlset>
```  


## 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
2023-11-05 18:06:56 +02:00
Ivan Starkov 3eba3e1ede feat: Sitemap endpoint support (#2565)
## Description

Need to merge, before proceed with sitemap generation. Will ruin all
fixtures tests after merge

## 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
2023-11-05 17:45:27 +02:00
Ivan Starkov f477954a35 build: Update fixtures (autogenerated) (#2559)
All code is autogenerated
Update fixtures to proceed with vercel rewriter
2023-11-03 20:21:05 +04:00
Ivan Starkov f1267fc962 fix: Allow formatting d.ts files (#2558)
## Description

Otherwise saas check is broken on template generation

## 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
2023-11-03 15:20:48 +02:00
Ivan Starkov f51b0f19dd feat: Add custom metadata to page settings form (#2552)
## Description

Custom metadata pages support
ref #2544

## 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
2023-11-02 23:33:26 +02:00
Ivan Starkov aaaf57da9f feat: Add Twitter card support & exclude pages from search/index (#2545)
## Description

ref #2544

Corresponding SAAS PR
https://github.com/webstudio-is/webstudio-saas/pull/215

- Support of page property - `excludePageFromSearch`
- Introduced functionality to enable the meta robot noindex tag for the
entire website.
- Implemented robots.txt support, which appears to be essential for
Twitter meta cards functionality.

Needs corresponding PR in SAAS deploy.

## 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
2023-11-02 09:39:06 +02:00
Ivan Starkov 50373db9c1 build: Cli support for meta tags (#2537)
## Description

- Added support of   "image/x-icon",  "image/ico", for upload
- changed local dev resize path
- fixed zod meta types
- added favicon, site_name og tags in route template
- added cache headers for html content

## 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
2023-10-31 15:51:17 +02:00
Bogdan Chadkin 19d9d71cbd fix: bundle esm dependencies in templates (#2479)
Fixes https://github.com/webstudio-is/webstudio-community/discussions/62
2023-10-15 23:45:25 +04:00
Oleg Isonen 8e9620721d feat: Rename webstudio-cli to webstudio as we got the shorter namespace (#2443)
## 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.example`
and the `builder/env-check.js` if mandatory
2023-10-10 12:25:00 +04:00
Bogdan Chadkin 5482ec414a perf: drop internal data from generated sites (#2362)
Internal data structures like instances, props, data sources, assets and
pages no longer necessary in generated sites. Nanostores not longer used
to store them.

Now we have less dependencies and smaller runtime.
2023-09-29 16:22:09 +04:00
Jaya Krishna Namburu ac793ca457 chore: Add checks for template names for build command in cli (#2358)
## Description

Small changes that adds checks for templates and hints for templates in
the `--help` command.

## Steps for reproduction

```sh
webstudio-cli --help
```

## Code Review

- [ ] hi @TrySound , I need you to do
  - detailed review (read every line)
2023-09-26 06:52:41 +02:00
Bogdan Chadkin d25e97fe65 perf: generate pages paths (#2360)
Here generated a list of pages paths. It is used in link component to
switch to remix link internally when the link is app route.

Providing whole pages list can bloat runtime when there are many pages
or when there are many seo data so having single page per route should
be enough.

The list is always empty in builder because links are managed with
global interceptor. Ideally frameworks should uses navigation api and
distinct routes from other paths so we would not need to generate
anything.
2023-09-25 12:20:08 +04:00
Bogdan Chadkin 5f93ecb228 perf: generate page prop for links (#2357)
Moved links resolve into props normalizing which is called for whole
project before rendering converting page prop into string.

Remix links now check only if provided path matches any page. Ideally it
should be handled with navigation api to remove all complexity from
links components.

This will let us stop rendering props and assets data in generated
pages.

Also fixed links with hashes.
2023-09-24 20:07:15 +04:00
Jaya Krishna Namburu fa73721355 feat: Allow export to netlify using functions and edge-functions as templates from cli (#2346)
## Description

This PR adds support for templates. 
- Extracted out the defaults like `.vercelignore` and `image-loader`.
As, if the users re using some other service providers they come as
default and won't help.
- Add prompt for selecting a template at the start of the init process.
- Added template for `netlify-functions` and `netlify-edge-functions`. 

## Code Review

- [ ] hi @istarkov , I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview
  
- [ ] 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

- [x] made a self-review
- [x] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging
- [x] tested locally
2023-09-23 12:30:21 +02:00
Bogdan Chadkin 45585c0565 perf: generate asset prop for links and images (#2356)
Before links and images required logic to traverse raw props data and
assets to resolve href and src. This can potentially affect rendering
performance and requires additional data to be stored in runtime.

Here pregenerated props with "asset" type as a first step. Images still
have to be aware of asset base url to trim it from resolved src but no
longer access to assets store. Links now interpret it as string url.

See fixtures for examples.
2023-09-22 17:48:12 +04:00
Bogdan Chadkin 2dbb1597f0 refactor: remove legacy page renderer (#2352)
- dropped InstanceRoot component
- dropped WebstudioComponent component
- dropped sdk-size-test package
- measure size in fixture package
2023-09-22 10:09:19 +04:00
Bogdan Chadkin fd19a3fac2 feat: switch CLI to jsx component generator (#2330)
Now CLI can produce more or less readable jsx components instead of data
and blackbox renderer.

Some generated code is no longer used and removed.
2023-09-21 17:35:54 +04:00
Bogdan Chadkin ada5d24193 perf: generate only preset styles used in the project (#2333)
Fix https://github.com/webstudio-is/webstudio/issues/2256

Here filtered out unused meta for css generation
so we get smaller .css files in production.
2023-09-21 14:58:50 +04:00
Ivan Starkov dfab713c2a fix: Metadata lost on published sites (#2349)
## Description

v2 remix meta has changed behaviour from object to array.

## Steps for reproduction

See fixtures

## 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
2023-09-21 13:39:35 +03:00
Bogdan Chadkin fb5414f93d build: use webstudio export condition for tools (#2347)
This fixes the issue with eventsource-parser package having source
export condition with different setup.

Now everywhere "webstudio" is used to reference our sources.
2023-09-20 22:14:34 +04:00
Ivan Starkov b538b74ef2 Enable CLI Usage in CI Environment (#2321)
## Description

- Allow overriding default templates with custom external or internal
ones.
- Ensure exact dependencies, e.g., workspace:* instead of workspace:^,
to address beta release issues.
- Enable passing buildId, authToken, and origin via flags during sync.
- Rename "host" to "origin" in the CLI.

Most code is custom template.

- [x] - Tested at SaaS

## 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
2023-09-18 14:54:14 +03:00