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: added support for browserified builds (closes #176) #293

Closed
wants to merge 3 commits into from
Closed

feat: added support for browserified builds (closes #176) #293

wants to merge 3 commits into from

Conversation

niftylettuce
Copy link

@niftylettuce niftylettuce commented Sep 28, 2018

I have added support for #176 in this pull request, and have also updated the README's browser usage section appropriately (specifically dropping wzrd.in in favor of unpkg.com).

Additional comments:

  • Note that I added a default "unpkg" version in package.json which gets consumed by unpkg.com in order to serve as the default version when loaded via <script src="https://unpkg.com/uuid"></script>
  • I added husky in order for commitlint to actually get used by contributors automatically
  • I used npm-run-all to keep the package.json tidier
  • I added eslint-plugin-compat and caniuse-lite with a custom .dist.eslintrc file that gets used to lint the dist folder for browser compatibility specified in .browserlistrc
  • I used babelify to ensure that the builds are built with babel, and @babel/preset-env which lets us target browsers automatically in .browserlistrc
  • I kept source maps turned off for generated browserify/babelify builds to reduce file size
  • I used tinyify to attempt to minify the dist outputs (see https://github.com/browserify/tinyify)

@niftylettuce
Copy link
Author

Screenshot proving it works in browser console:

screen shot 2018-09-28 at 2 31 17 am

@niftylettuce
Copy link
Author

Final note is that the purpose for me doing this in addition to #176 is to support development of Cabin and Lad among other projects.

@styfle
Copy link
Contributor

styfle commented Sep 28, 2018

I'm curious why you went with unpkg instead of jsdelivr? Especially after @broofa's comment.

Is unpkg recommended for production usage now?

@niftylettuce
Copy link
Author

I use unpkg for development, but I suppose it'd work for prod. Never had any issues with it. jsdelivr might be better approach though.

@niftylettuce
Copy link
Author

@styfle I have updated the PR to support jsdelivr

@niftylettuce
Copy link
Author

cc @broofa

@@ -56,7 +56,7 @@ Version 4 (random):

```javascript
const uuidv4 = require('uuid/v4');
uuidv4(); // ⇨ '3a017fc5-4f50-4db9-b0ce-4547ba0a1bfd'
uuidv4(); // ⇨ 'e57d7cee-a174-4463-9f89-1ada39083c5f'
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did this value change?

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

See the runmd module. tl;dr: 'Got fed up with broken README code samples. 'Wrote a utility to evaluate/annotate said examples. Said utility randomly generates UUIDs each time it's run because random is as random does.

@niftylettuce
Copy link
Author

When I run npm run prepare it automatically updates it.

Copy link
Contributor

@styfle styfle left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏼

@broofa
Copy link
Member

broofa commented Jun 7, 2019

My apologies for letting this gather dust, and just generally being unresponsive. By way of excuse/rationalization, the reason for this has been that this PR speaks to an issue have strong opinions about - the extent to which modules should/shouldn't bend over to deal with packager-related issues. Unfortunately my sentiments here don't align well with user interests. I feel bad about that and my conflict-avoidance response kicks in and, thus, PRs like this get neglected.

As this PR demonstrates, supporting a particular form of packaging adds substantial dependencies, and introduces significant complexity.

At the end of the day, dealing with such issues is more trouble than it's worth. I feel bad about that - I know it makes some users lives more difficult - but having to support the never-ending parade of packaging tools... AMD, UMD, CommonJS, ES6, Webpack, Browserify, Bower, Angular, Typescript, Rollup, and so on... it's just painful.

I'm done with it. Sorry, I know that's not exactly "friendly", but I don't have the time/attention needed to deal with this class of problems.

This is a Node/CommonJS-style module. Packagers either support that or they don't. If they don't, then that's an issue for the packager project.

@broofa broofa closed this Jun 7, 2019
ctavan added a commit to ctavan/node-uuid that referenced this pull request Aug 26, 2019
The service wzrd.in seems to be unmaintained for over a year now, see
browserify/wzrd.in@2f7ea69

It currently throws 502 errors on all packages as reported in
uuidjs#302 or
https://talk.observablehq.com/t/wzrd-in-alternatives/571

As stated in
uuidjs#293 (comment)
there are no plans to support legacy bundlers.

Instead, we may consider to go for properly standardized ES6 modules in
the future as has been teased in uuidjs#317

However for the time being let's at least remove these broken
instructions from the README.

Closes uuidjs#176, uuidjs#302
broofa pushed a commit that referenced this pull request Sep 1, 2019
* chore(doc): re-generate README

* fix(doc): remove wzrd.in instruction from README

The service wzrd.in seems to be unmaintained for over a year now, see
browserify/wzrd.in@2f7ea69

It currently throws 502 errors on all packages as reported in
#302 or
https://talk.observablehq.com/t/wzrd-in-alternatives/571

As stated in
#293 (comment)
there are no plans to support legacy bundlers.

Instead, we may consider to go for properly standardized ES6 modules in
the future as has been teased in #317

However for the time being let's at least remove these broken
instructions from the README.

Closes #176, #302
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