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

feat: esm rewrite #188

Merged
merged 64 commits into from
Jan 14, 2021
Merged

feat: esm rewrite #188

merged 64 commits into from
Jan 14, 2021

Conversation

ericdeansanchez
Copy link
Contributor

The purpose of this PR is to begin the transition to ES modules.

@ericdeansanchez ericdeansanchez requested a review from a team as a code owner November 18, 2020 23:05
Copy link
Contributor

@frederickfogerty frederickfogerty left a comment

Choose a reason for hiding this comment

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

Hey there @ericdeansanchez! This is a really good changeset, and there's not many outright problems here, honestly a lot of my comments were style things, or just improvements. I have some concrete points to discuss here:

Required to discuss before merging:

  • Why 3.0? It seems a little strange to me that we are bumping a major version, if supposedly this is not meant to have any public API changes should have no impact to the end user?
  • Files in dist.. We should be careful about changing the names of the generated files, and we should try keep backwards compatibility here since people most definitely will sometimes be importing directly from dist.
  • Minified output. We need to add a minified output to dist.
  • Different branch. I suggest we merge this PR into a beta branch, rather than main, so that we're not blocked from releasing fixes on main after merging this, since this isn't ready for release yet.
  • Delete src/imgix-core-js.js since it's no longer used.
  • Add back Typescript types (and to package.json).

Style choices/feedback/improvements if you want:

  • A lot of assertions are inconsistent in their ordering of the expected and actual results. The official order from the Node doc is assert.equal(actual, expected).
  • Use const as the default, and only use let when you have to. In fact, for most the code I write these days, I rarely ever use let, and often I treat it as a code smell if I have to use it. For this reason I use IIFEs a lot, which I then refactor into their own functions or methods.
  • The tests in general can be cleaned up a lot. This is a bit out of scope to this PR so you can choose to ignore this, since you already have a lot going on here.
  • There were a lot of lint/indentation changes in this PR. It would've been easier to review if these were kept to a separate PR, so the signal/noise ratio was higher.

Overall I think this is a really good first pass! Good job 👏

package.json Outdated Show resolved Hide resolved
renovate.json Outdated Show resolved Hide resolved
dist/imgix-core-js.d.ts Outdated Show resolved Hide resolved
src/constants.js Outdated Show resolved Hide resolved
src/main.js Outdated Show resolved Hide resolved
test/test-validators.js Outdated Show resolved Hide resolved
test/test-validators.js Outdated Show resolved Hide resolved
test/test-validators.js Outdated Show resolved Hide resolved
test/test-validators.js Outdated Show resolved Hide resolved
test/test-validators.js Show resolved Hide resolved
Copy link
Contributor

@sherwinski sherwinski 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 agree with @frederickfogerty on all points. I'll throw in anything else I noticed/questions I have:

  • I think we should move towards parameterizing the tests. I know it's out of scope here, but just wanted to add that 2¢ somewhere before I forget.
  • In addition to the TS definitions, is there any reason not to have the main file as .ts at this point? At least that way, we can benefit from using TS when developing.
  • This is super nitpicky but I can't help but notice that some files have a newline at the end of the file while others don't. We should make that consistent, and configure prettier to enforce it in the future.

src/main.js Outdated Show resolved Hide resolved
src/main.js Outdated Show resolved Hide resolved
@commit-lint
Copy link

commit-lint bot commented Jan 8, 2021

Features

  • rewrite ix-core-js as esm (7e98689)
  • pull constants into separate file (bb4b36d)
  • pull validation into separate module (a113fea)
  • add rollup config (f62e8db)
  • update package.json (c8491e0)
  • add minimal babelrc (3809a93)
  • remove renovate (for now) (1be0281)
  • update buildSrcSet test suite (5e5d5da)
  • update buildURL test suite (585bb19)
  • update client test suite (e238dc4)
  • add validation tests (91cc39c)
  • reintro renovate (d9afcdb)
  • add src, README to files list (9d3bb9e)
  • use const where possible/appropriate (4c2a31d)
  • use const in validators (be3ee98)
  • update @babel/preset-env (879e235)
  • use crypto-js (a41ef47)
  • test on node version 14 (1d8d4a5)
  • require @babel/register (c488e43)
  • run mocha with babel/register (d5c519c)
  • add babel core for mocha (1266c1a)
  • use --experimental-modules (4c9735d)
  • remove old interface (7a5c1e0)

Bug Fixes

  • update minor or patch prior to release (65c6f3e)

Code Refactoring

  • use more descriptive DEFAULT_OPTIONS varname (6533f68)

Build System

Continuous Integration

  • run against node v12.11 (9b34c53)
  • test cjs version of test-buildSrcSet (9b031f4)
  • transpile tests to cjs (87b967c)
  • return to original md5 vendor (5e254c1)

Contributors

ericdeansanchez

Commit-Lint commands

You can trigger Commit-Lint actions by commenting on this PR:

  • @Commit-Lint merge patch will merge dependabot PR on "patch" versions (X.X.Y - Y change)
  • @Commit-Lint merge minor will merge dependabot PR on "minor" versions (X.Y.Y - Y change)
  • @Commit-Lint merge major will merge dependabot PR on "major" versions (Y.Y.Y - Y change)
  • @Commit-Lint merge disable will desactivate merge dependabot PR
  • @Commit-Lint review will approve dependabot PR
  • @Commit-Lint stop review will stop approve dependabot PR

package.json Outdated Show resolved Hide resolved
Co-authored-by: sherwinski <[email protected]>
@sherwinski sherwinski merged commit cae1605 into main Jan 14, 2021
@sherwinski sherwinski deleted the e/next branch January 14, 2021 00:46
@frederickfogerty
Copy link
Contributor

Congats @ericdeansanchez 👏 this was a big effort and major contribution to this library

@ericdeansanchez ericdeansanchez changed the title feat: initial esm rewrite feat: esm rewrite Jan 27, 2021
@ericdeansanchez
Copy link
Contributor Author

🎉 This PR is included in version 0.3.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

3 participants