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

Move install logic into separate package #1042

Merged
merged 3 commits into from
Sep 16, 2020
Merged

Move install logic into separate package #1042

merged 3 commits into from
Sep 16, 2020

Conversation

FredKSchott
Copy link
Owner

@FredKSchott FredKSchott commented Sep 11, 2020

Resolves #312

Background - Community

Background - Snowpack

  • Since Snowpack v2.0, we've been trending more towards "Snowpack the build tool" and away from "Snowpack the package installer". Installing packages is still a hugely important feature that all of Snowpack is based on, but the idea of Snowpack trying to be both tools at the same time has been weighing on us (and makes Snowpack harder to communicate, document, etc).
  • As a result, we've tended to prioritize the build tool and failed to support the installer as well as we should, leading to a worse, sometimes-confusing experience for everyone.
  • We have a larger initiative that we'd like to kick off that will require this separation between Snowpack the build tool and Snowpack the package installer. (More on this later :)

New Package: esmpkg

Today, this is just the idea of moving Snowpack's "install" command into a new package. This means no change to how Snowpack works, but a few benefits right off the bat:

  • Our installer finally gets an official, JS interface that people have been asking about for a while.
  • Easier to document esmpkg & Snowpack individually vs. overloading the Snowpack docs.

In the future, esmpkg can lazer-focus on improvements to support better CJS->ESM conversions and begin working on conversions for Node.js (in addition to our current web support).

Testing

  • Covered by existing tests.

@FredKSchott FredKSchott requested a review from a team as a code owner September 11, 2020 23:09
@vercel
Copy link

vercel bot commented Sep 11, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pikapkg/snowpack/kgmv6dt6z
✅ Preview: https://snowpack-git-wip-esmpkg.pikapkg.vercel.app

@drwpow
Copy link
Collaborator

drwpow commented Sep 11, 2020

Testing: Still TODO

I’d be curious how much effort it’d be to just rename tests/integration -> tests/esmpkg and make updates there. Since this has a Node interface, we’d probably be able to test the output even easier? Either way, it feels like those install tests should move away from Snowpack and into esmpkg. Should be a great start for esmpkg, and would simplify Snowpack’s tests too.

@FredKSchott
Copy link
Owner Author

FredKSchott commented Sep 12, 2020

+1, but how do you feel about doing that in a follow up PR? I'm worried it will explode the PR making it harder to review yolo, did it here.

@FredKSchott
Copy link
Owner Author

@drwpow @gr2m PTAL

Copy link
Contributor

@gr2m gr2m left a comment

Choose a reason for hiding this comment

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

I just looked through the code changes, I didn't test the changes in detail. Let me know if you want me to have a thorough look

},
"scripts": {
"build": "pika build",
"version": "pika build"
Copy link
Contributor

Choose a reason for hiding this comment

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

that doesn't look right?

Copy link
Collaborator

@drwpow drwpow Sep 15, 2020

Choose a reason for hiding this comment

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

I think this makes sense; it’s a hook that happens before publishing to npm making sure a fresh build is prepared (i.e. it’s not stale, from a previous commit or different branch)

Copy link
Contributor

Choose a reason for hiding this comment

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

the "version" script is a hook that happens before publishing? Are you sure?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not technically it doesn’t, but in our workflow since we use Lerna, the versioning happens before publishing (I think? Please correct me if I’m still mistaken!).

Copy link
Collaborator

@drwpow drwpow left a comment

Choose a reason for hiding this comment

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

Looks good! I didn’t compare how much esmpkg deviated from the original install script, but nothing seemed to jump out. Seems straightforward, and the updated tests give me confidence it’s working the same. So excited for this!!! 💯 💯

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.

Snowpack Programatic API
3 participants