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.
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.
This fixes the issue with eventsource-parser package having source
export condition with different setup.
Now everywhere "webstudio" is used to reference our sources.
## 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
Here removed sources and stories from published packages. Sources were
used in the past instead off .d.ts. But since we generate them we can
reduce packages size significantly.
Cli install size
```diff
du -ck node_modules
- 33192
+ 29176
```
We need to stop publishig all packages. Many of them not used and maybe
never be used in public. Though they bloat packages search, makes
publish step longer. Prisma client publishes 700MB package every time.
Seems like we no longer need commonjs in most packages. Only prisma
cannot be bundled on server because has binary.
Now new package setup is easier and require only esbuild instead of
custom solution.
Cli install size
```diff
du -ck node_modules
- 35516
+ 33192
```
## Description
npm packages update
## 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-builder/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
The main reason for this change is the realization that a product needs
some more protection than a typical library. With this change it is
still an Open Source Core, but now corporations can't build on top of it
without contributing back to the OSS community or without buying a
license.
Before we run two configurations of typescript on CI. Though this leads
to very long checks. Here I enabled "typecheck" script to generate dummy
.d.ts files to enable additional checks.
```diff
pnpm run -r typecheck (serial)
- 239.13s
+ 262.94s
pnpm turbo run size-test build checks dts --force (parallel locally)
- 2m30.609s
+ 1m47.622s
- pnpm turbo run size-test build checks dts --force (Ci)
- 6m 5s
+ pnpm turbo run size-test build checks --force (Ci)
+ 3m 22s
```
While turborepo does not work for us we can try to solve long checks
time with builtin caching. Eslint provides similar one to prettier we
already use.
```
pnpm -r lint
51.53s
pnpm eslint . --ext .ts,.tsx --max-warnings 0
18.10s
pnpm eslint . --ext .ts,.tsx --max-warnings 0 --cache (with cache)
1.82s
```
In this PR I removed all lint scripts in packages and added global one
in the to github workflow. It saves like 30s on my laptop because pnpm.
Already stored cache makes linting almost instant.
Also bumped all eslint dependencies.
We generate dts type for each package on publish.
It requires us to include only "src" to output same structure as in src
folder. Though we have configs and cli scripts outside of it which
should be typechecked, they cannot be ignored.
Ideally would be to have one-line commands in package.json. Though
typescript always has problems with build step. In this case the CLI
have everything to configure this except "include" and "exclude" flags.
So here to workaround that I added tsconfig.dts.json to distinct dts
generation and typechecking.
Blocker for https://github.com/webstudio-is/webstudio-builder/pull/1634
Saas is swithing to moduleResolution=bundler.
Here I replaced types top level field with exoprts condition in all our
packages. Thi should fix issues with new sdk components packages and
simplify using additional entry points.
Fixed a regression from
https://github.com/webstudio-is/webstudio-builder/pull/1470 . @TrySound
noticed that by putting `declarationDir` in the base config all
declaration were emitted relative to... that base config. By switching
back to the CLI argument the issue is fixed.
---------
Co-authored-by: istarkov <istarkov@gmail.com>
## Description
This PR "swaps" the guiding principle behind what options are in the
base `tsconfig.json`.
Previously TS was configured to *not* emit declarations and we were
forcing for them to be emitted with CLI flags. This had an unfortunate
result - errors about "not portable type definitions" were not displayed
in the IDE because to its best knowledge the type definitions were never
supposed to be emitted. So it wasn't worthwhile to surface this error.
With the adjusted options those errors will be raised in the IDE which
should improve the feedback loop for those errors.
## Code Review
- [ ] hi @TrySound, @istarkov, @kof - you need to recheck if you have
any doubts about this approach, if you see anything wrong with it in the
context of this project
## Before merging
- [ ] test IDE setup
- [ ] test build script
- [ ] test typechecking and dts emit
Webpack builder is very slow and hard to use becaause of it. It gave us
a lot of issues recently.
So here I migrated to vite builder. The experience is great. It caught a
bug in shallow-equal package, though fixed in latest release.
There was one issue with reload. When modify packages and rebuild
storybook watcher detects a lot of changes and goes into infinite loop.
Solved by importing packages sources directly with export conditions
vite allows to configure. Now any changes in packages can be reflected
in builder storybook without manual reload, restart and additional
watching.
We would get much better experience with remix if they allow to
configure this.
Also had to remove @storybook/addon-interactions which are incompatible
with vite builder.
Extracted from
https://github.com/webstudio-is/webstudio-designer/pull/797 for upcoming
dashboard split into separate app
## Code Review
- [ ] hi @kof, I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
## 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory