Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: updates to dev-deps and QOL improvements #918

Merged
merged 2 commits into from
Jan 10, 2025
Merged

Conversation

edodusi
Copy link
Contributor

@edodusi edodusi commented Dec 30, 2024

Pull request type

Updates and QOL improvements

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Other (please describe): updates

Copy link

pkg-pr-new bot commented Dec 30, 2024

Open in Stackblitz

npm i https://pkg.pr.new/storyblok-js-client@918

commit: 2d50232

Copy link
Contributor

@alvarosabu alvarosabu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @edodusi I left couple of question regarding changes on the builds

@@ -34,7 +34,7 @@ const bundles = [
;(async () => {
for (const bundle of bundles) {
await build({
configFile: false,
configFile: 'vite.config.ts',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @edodusi why this change?

Copy link
Contributor Author

@edodusi edodusi Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alvarosabu because otherwise our vite config is ignored in our build (eg. no types)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So no types were generated before? Let's add this to the fix PR I requested below, I'm not convinced we need to add the whole vite.config.ts, there is a reason why we have a separate build script, otherwise,e we would be using one config instead. We can add the dts plugin directly here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alvarosabu I responded on the other comment about the vite.config, but to better clarify this point, we are using a custom file for the build because here we want to build 4 different bundles in parallel.

In the vite.config we just add a banner and the dts plugin. We could do it here, sure, but why? Passing a config file is normal practice for the build command, do you see any reason why we should ditch the config file and instead add inline configs here?


export default defineConfig(() => ({
plugins: [
dts({
insertTypesEntry: true,
outDir: 'dist/types',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @edodusi why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alvarosabu because this is how the exports are configured in the package.json, otherwise the paths are wrong

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hI @edodusi thanks for clarifying, then this should be in a separate PR marked as a fix. Is there a ticket for the typescript issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alvarosabu to be clear, this is not a fix, the build stays the same, with files in the dist and types in the dist/types folder. This and the above change just ensure that we use, according to the refactor previously made and following the practice of other modules, the dts plugin in vite.config

Without this and the above fix, we just use tsc to generate types, ignoring vite config and dts. This change just normalizes the config.

Let me know if you still think a fix release is needed.

Copy link
Contributor

@alvarosabu alvarosabu Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the build without the changes on this PR

Screenshot 2025-01-10 at 13 27 22

This is the build with the changes

Screenshot 2025-01-10 at 13 27 55

This means that the type directory wasn't generated correctly before.

Copy link
Contributor

@alvarosabu alvarosabu Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2025-01-10 at 13 35 56

Installing storyblok-js-client on a project does have the correct structure, meaning that we probably introduced a bug in #858 but since we haven't released it since then users haven't been affected.

Copy link
Contributor Author

@edodusi edodusi Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alvarosabu on the main branch (latest release) the build structure is the same, including types:

user@host in ~/storyblok-js-client (main)
$ ll -og dist
total 168
-rw-r--r--@  1     28K Jan 10 14:54 index.mjs
-rw-r--r--@  1     19K Jan 10 14:54 index.umd.js
-rw-r--r--@  1     11K Jan 10 14:54 richTextResolver.mjs
-rw-r--r--@  1    7.9K Jan 10 14:54 richTextResolver.umd.js
-rw-r--r--@  1    5.0K Jan 10 14:54 schema.mjs
-rw-r--r--@  1    3.1K Jan 10 14:54 schema.umd.js
drwxr-xr-x@ 12    384B Jan 10 14:54 types

Copy link
Contributor

@alvarosabu alvarosabu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move types-related fixes to another PR with fix and discuss them there. After that we can merge the rest.

@@ -34,7 +34,7 @@ const bundles = [
;(async () => {
for (const bundle of bundles) {
await build({
configFile: false,
configFile: 'vite.config.ts',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So no types were generated before? Let's add this to the fix PR I requested below, I'm not convinced we need to add the whole vite.config.ts, there is a reason why we have a separate build script, otherwise,e we would be using one config instead. We can add the dts plugin directly here


export default defineConfig(() => ({
plugins: [
dts({
insertTypesEntry: true,
outDir: 'dist/types',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hI @edodusi thanks for clarifying, then this should be in a separate PR marked as a fix. Is there a ticket for the typescript issues?

@edodusi edodusi merged commit efcc797 into main Jan 10, 2025
7 checks passed
@edodusi edodusi deleted the chore/updates-and-qol branch January 10, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants