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

enhance/dynamic prisma loading #3489

Merged
merged 16 commits into from Sep 6, 2022
Merged

Conversation

kevinslin
Copy link
Member

@kevinslin kevinslin commented Sep 5, 2022

enhance(workspace): dramatically decrease bundle size

  • reduce bundle size by only loading prisma dependencies when sqlite is enabled

  • also change prisma from production to dev dependency (results in smaller dendron-cli)

  • logic

    • if sqlite is enabled, we check if prisma binaries are in $HOME/.dendron/
      • if binaries are not here, we will fetch them from s3
      • subsequent downloads will use the binary from this folder
  • other

    • we added adm-zip as a single minified js file in order to unzip the downloaded s3 binary. forked source code to generated the bundle here
  • future work

    • when we update prisma binaries, we need someway of figuring out whether we need to download a new one
      • simple version:
        • always download latest. use a checksum that is stored in code to check if we have latest binaries
      • if needed, we have have a more detailed versioning scheme
        • eg. encoding version in folder name (eg. $HOME/.dendron/prisma_{version})

commit ee63444
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 15:14:37 2022 -0700

    exclude zip from packing

commit bf50c8c
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 15:00:59 2022 -0700

    update prisma copy script

commit 31ea4cb
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 14:44:46 2022 -0700

    fetch prisma from s3

commit b4de432
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 11:37:28 2022 -0700

    make sure prisma client is initialized properly

commit 080fa8f
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 11:12:14 2022 -0700

    remove prisma as a direct dependency

commit 19a0ffa
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 11:10:22 2022 -0700

    update build step

commit f42771c
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 10:46:59 2022 -0700

    update prisma-shim

commit c521c0c
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 10:22:08 2022 -0700

    conditionally add prisma

commit 1fbd250
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 10:07:53 2022 -0700

    prisma shim update

commit c916f3f
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 10:06:35 2022 -0700

    modify prisma-shim

commit a68e01d
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 09:50:16 2022 -0700

    remove copy of prisma pkg

commit 1270228
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 09:46:48 2022 -0700

    remove prisma-client from webpack

commit d71d6ab
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 09:45:10 2022 -0700

    add prisma-shim
@kevinslin kevinslin marked this pull request as ready for review September 6, 2022 01:01
commit 3cee79c
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 20:43:11 2022 -0700

    update checksum

commit b0ff42e
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 19:38:15 2022 -0700

    add lock file

commit ec11e5a
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 19:32:00 2022 -0700

    remove debugger

commit 214b93d
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 19:31:32 2022 -0700

    add timeout

commit d8f122a
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 19:17:32 2022 -0700

    update yarnrc

commit 6674172
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 18:56:35 2022 -0700

    copy over all js packages for webpack

commit 8c987b4
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 18:10:53 2022 -0700

    update yarnrc

commit f91421e
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 18:10:23 2022 -0700

    remove lockfile

commit 59f7195
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 17:58:54 2022 -0700

    Revert "chore: publish patch"

    This reverts commit 5da8321.

commit 898eb98
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 17:58:40 2022 -0700

    switch to using cloudfront server

commit a5d6d58
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 17:43:00 2022 -0700

    print error on failure

commit 065a2a4
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 17:15:34 2022 -0700

    Revert "update build script"

    This reverts commit 09728d7.

commit 5da8321
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 16:39:41 2022 -0700

    chore: publish patch

commit 09728d7
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 15:47:17 2022 -0700

    update build script

commit bdc4da4
Author: Kevin <kevin@dendron.so>
Date:   Mon Sep 5 15:21:40 2022 -0700

    dynamic prisma loading

    commit ee63444
    Author: Kevin <kevin@dendron.so>
    Date:   Mon Sep 5 15:14:37 2022 -0700

        exclude zip from packing

    commit bf50c8c
    Author: Kevin <kevin@dendron.so>
    Date:   Mon Sep 5 15:00:59 2022 -0700

        update prisma copy script

    commit 31ea4cb
    Author: Kevin <kevin@dendron.so>
    Date:   Mon Sep 5 14:44:46 2022 -0700

        fetch prisma from s3

    commit b4de432
    Author: Kevin <kevin@dendron.so>
    Date:   Mon Sep 5 11:37:28 2022 -0700

        make sure prisma client is initialized properly

    commit 080fa8f
    Author: Kevin <kevin@dendron.so>
    Date:   Mon Sep 5 11:12:14 2022 -0700

        remove prisma as a direct dependency

    commit 19a0ffa
    Author: Kevin <kevin@dendron.so>
    Date:   Mon Sep 5 11:10:22 2022 -0700

        update build step

    commit f42771c
    Author: Kevin <kevin@dendron.so>
    Date:   Mon Sep 5 10:46:59 2022 -0700

        update prisma-shim

    commit c521c0c
    Author: Kevin <kevin@dendron.so>
    Date:   Mon Sep 5 10:22:08 2022 -0700

        conditionally add prisma

    commit 1fbd250
    Author: Kevin <kevin@dendron.so>
    Date:   Mon Sep 5 10:07:53 2022 -0700

        prisma shim update

    commit c916f3f
    Author: Kevin <kevin@dendron.so>
    Date:   Mon Sep 5 10:06:35 2022 -0700

        modify prisma-shim

    commit a68e01d
    Author: Kevin <kevin@dendron.so>
    Date:   Mon Sep 5 09:50:16 2022 -0700

        remove copy of prisma pkg

    commit 1270228
    Author: Kevin <kevin@dendron.so>
    Date:   Mon Sep 5 09:46:48 2022 -0700

        remove prisma-client from webpack

    commit d71d6ab
    Author: Kevin <kevin@dendron.so>
    Date:   Mon Sep 5 09:45:10 2022 -0700

        add prisma-shim
@kevinslin kevinslin merged commit 31000e6 into master Sep 6, 2022
@kevinslin kevinslin deleted the enhance/dynamic-prisma-loading branch September 6, 2022 16:26
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.

None yet

2 participants