Skip to content

node-only release #1374

Closed
Closed

Description

@cristiand391

Current state

jsforce is an isomorphic (works on browser and node) library, as such it needs to ship multiple builds to cover most scenarios:

  1. CJS & ESM build for node
  2. ESM browser builds
  3. browser bundles + minified builds
  4. TS source code (src folder)

For browser usage this isn't much of an issue since it either loads jsforce from a CDN (can get the full minified build only) or bundle it, but in node projects you end up with around ~28mb of unused code (dist, browser and src folders) + additional deps from the jsforce CLI and browser builds (commander, inquirer, open, @babel/runtime, @babel/runtime-corejs3, core-js, etc).

To help with this, jsforce v3 will start publishing a new node-only pkg for node projects using jsforce that want a smaller package, this should help reducing the final build size and also during security scans (secury reports about library never used in node build).

How it will work:

Each jsforce release will be followed by a @jsforce/jsforce-node release, both having the same package version (e.g. [email protected] -> @jsforce/[email protected]).
This new pkg will not live in a new repo or branch, it will be generated by modifying the package.json before publish (or locally for testing), specifically:

  1. Changing name field to @jsforce/jsforce-node
  2. Removing browser/CLI-related folders from files field.
  3. Removing bin field
  4. Removing browser/CLI dependencies

Will I still be able to use jsforce in node projects?

Yes! jsforce will continue to work on browsers and node.

Will this new pkg include additional, node-only features?

No. @jsforce/jsforce-node will only be a lighter(size) version of jsforce.

ref:
#534
#1117

Activity

  1. pinned this issue on Nov 13, 2023
  2. fedozh commented on Nov 20, 2023

    @fedozh

    Hi @cristiand391 , when new versions will be available on npm?

  3. cristiand391 commented on Nov 27, 2023

    @cristiand391
    ContributorAuthor

    Hey @fedozh

    we just published a new v2 beta:
    https://github.com/jsforce/jsforce/releases/tag/2.0.0-beta.29

    for node-only releases, I'll try to get 1 published this week for testing.

  4. jaagaard01 commented on Dec 1, 2023

    @jaagaard01

    @cristiand391 hey was curious if the node only version has been released? I upgraded to the beta and havent been able to get conn.authorize to work but was fine before upgrade. Hoping the node only version fixes this issue for me. Thank you!

  5. cristiand391 commented on Dec 1, 2023

    @cristiand391
    ContributorAuthor

    @jaagaard01 yep, we published the first version a few hours ago:
    https://www.npmjs.com/package/@jsforce/jsforce-node?activeTab=versions

    note that the 0.0.1 is just a dummy package we published to save the name on npm, 3.0.0-next.1 is the valid one:
    https://www.npmjs.com/package/@jsforce/jsforce-node?activeTab=versions

    I upgraded to the beta and havent been able to get conn.authorize to work but was fine before upgrade

    what version did you update from? v1 or some previous v2 beta?

  6. jaagaard01 commented on Dec 1, 2023

    @jaagaard01

    I updated from 1.11.1 @cristiand391

  7. cristiand391 commented on Dec 1, 2023

    @cristiand391
    ContributorAuthor

    @jaagaard01 oh I see, we plan to get a migration guide for v1 -> v2 before GA but for now you can open an issue in the repo and I can take a look at it.

  8. cristiand391 commented on Jul 15, 2024

    @cristiand391
    ContributorAuthor

    this is already available as @jsforce/jsforce-node, see: #1529

  9. LeandroDaLanca commented on Jul 17, 2024

    @LeandroDaLanca

    Hey @cristiand391, are the ESM builds for node ready? I see this post mentions them, but as far as I can see they aren't there. In the package.json it says they should be under "./module/index", is this still being worked on?

  10. cristiand391 commented on Jul 17, 2024

    @cristiand391
    ContributorAuthor

    @LeandroDaLanca no, IIRC we skipped dual-publishing for now because of some dependency issues (I think it was csv-parse and node-fetch).
    The previous ESM builds in jsforce v2 were being built by babel (which doesn't do typechecking), v3 uses the tsc for node builds so we might need to use something like https://github.com/isaacs/tshy

  11. RupertBarrow commented on Aug 2, 2024

    @RupertBarrow

    So maybe we should reopen this issue, and add a comment to #1529 about it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions