Skip to content

Publish pre-build bundles to npm (idiomatic npm life cycle script)#7513

Closed
bershanskiy wants to merge 2 commits intomdn:mainfrom
bershanskiy:bundle-json
Closed

Publish pre-build bundles to npm (idiomatic npm life cycle script)#7513
bershanskiy wants to merge 2 commits intomdn:mainfrom
bershanskiy:bundle-json

Conversation

@bershanskiy
Copy link
Contributor

This PR splits up portion of #7398 to simplify review.

This PR does the following:

  • introduces prepack script that gets triggered automatically on npm publish. This script creates data bundle dist/data.json for npm release.
  • introduces new main script dist/index.js that automatically chooses between index.js (for local development and testing) and dist/data.json (for downloads from npm)
  • moves extend from actual dependency to devDependencies because it's not needed after bundling

This PR does not:

  • remove package.json property engines
    I'd really like to see
  • add tests
    Where would we even plug tests with the limited flexibility of npm life cycle scripts? What would they test?

Background:
#7374

A checklist to help your pull request get merged faster:

  • Summarize your changes
  • Data: link to resources that verify support information (such as browser's docs, changelogs, source control, bug trackers, and tests)
  • Data: if you tested something, describe how you tested with details like browser and version
  • Review the results of the linter and fix problems reported (If you need help, please ask in a comment!)
  • Link to related issues or pull requests, if any

@github-actions github-actions bot added dependencies Pull requests that update a dependency package or file. infra Infrastructure issues (npm, GitHub Actions, releases) of this project scripts Issues or pull requests regarding the scripts in scripts/. labels Nov 26, 2020
@bershanskiy bershanskiy changed the title Publish pre-build bundles to npm Publish pre-build bundles to npm (idiomatic npm life cycle script) Nov 26, 2020
Base automatically changed from master to main March 24, 2021 12:54
@ddbeck
Copy link
Contributor

ddbeck commented Apr 15, 2021

We decided to go the route of #7398, so I'm going to close this PR. Thank you this one too, @bershanskiy. It was genuinely instructive for landing the other PR. 🙇

@ddbeck ddbeck closed this Apr 15, 2021
@bershanskiy bershanskiy deleted the bundle-json branch April 15, 2021 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency package or file. infra Infrastructure issues (npm, GitHub Actions, releases) of this project scripts Issues or pull requests regarding the scripts in scripts/.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants