-
Notifications
You must be signed in to change notification settings - Fork 12
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: make Buffer optional #24
Conversation
8bfdae1
to
107c21a
Compare
Thanks for the PR! But, it looks like it's failing on older node versions. Hopefully that shouldn't be too hard to patch up? |
Also, it may make more sense to evaluate the condition(s) once, rather than on every call? What do you think? |
EDIT: I just pushed some changes which I think will work, but some bundlers will try to add
The conditions are only evaluated once on import. |
Hah, sorry on both counts -- I've not been doing JS for a while! |
No problem! I think the current changes should work with well with bundlers. |
Herm... I think The second branch (without If we were allowed the use of |
Yeah, that's fair -- go ahead and drop Node <= 12 support (in GitHub actions and, lol, package.json says node >= 6!!). Also, I just realized I no longer have permission to merge things on this repo, so we'll need to wait for one of the Taskcluster devs to apply their own review and merge. |
I guess what I am saying is that this repo is technically compatible with node >= 6 (if we don't use
I'd be happy to write that up as a GH Action workflow, but I am not very familiar with |
Ah, I can make that change. |
Haha, well, I can't actually push that change, but something like diff --git a/.taskcluster.yml b/.taskcluster.yml
index 1c80e40..788a7c3 100644
--- a/.taskcluster.yml
+++ b/.taskcluster.yml
@@ -9,28 +9,38 @@ tasks:
else: ${event.after}
repository:
$if: tasks_for == "github-pull-request"
then: ${event.pull_request.head.repo.html_url}
else: ${event.repository.html_url}
environments:
- image: node:6
description: Run tests with node v6
+ command: npm test
- image: node:8
description: Run tests with node v8
+ command: npm test
- image: node:10
description: Run tests with node v10
+ command: npm test
- image: node:12
description: Run tests with node v12
+ command: npm test
- image: node:14
description: Run tests with node v14
+ command: npm test
- image: node:16
description: Run tests with node v16
+ command: npm test
- image: node:latest
description: Run tests with latest node
+ command: npm test
+ - image: node:latest
+ description: Run tests with latest node without Buffer
+ command: npm test-nobuffer
in:
$if: tasks_for == "github-pull-request" && event["action"] in ["opened","reopened","synchronize"]
then:
$map: {$eval: environments}
each(env):
taskId: {$eval: as_slugid(env.image + ":tests")}
deadline:
$fromNow: 1 day
@@ -52,9 +62,9 @@ tasks:
git --version &&
node -v &&
npm -v &&
git clone --no-progress ${repository} repo &&
cd repo &&
git config advice.detachedHead false &&
git checkout --no-progress ${head_rev} &&
npm install --no-progress . &&
- npm test
+ ${env.command} with "test-nobuffer" added to [edit: added |
Ok, thanks! |
Uh oh! Looks like an error! DetailsInterpreterError at template.tasks.payload.command[3]: object has no property "command" |
Think I made a mistake in the config, sorry!
Yes agreed, but hopefully this is an ok proxy for the time being. |
Uh oh! Looks like an error! DetailsInterpreterError at template.tasks.payload.command[3]: object has no property "command" |
Uh oh! Looks like an error! DetailsInterpreterError at template.tasks.payload.command[3]: object has no property "command" |
Thanks! |
I've just published |
Fixes #12
Thanks for this library! We use it extensively in https://github.com/higlass/higlass.
We recently upgraded our build and ran into #12. As mentioned in that issue,
uuid
does not have a dependency on Buffer,so we should be able to refactor the slugid internals and not require browser users to have a large Buffer polyfill. I made a shim for
slugid
in HiGlass (higlass/higlass#1112), but I'd really prefer to keep a compatibleslugid
as a dependency.Changes
toBase64
andfromBase64
which are built onBuffer
oratob
/btoa
Buffer
as a global and once withBuffer
removed fromglobalThis
.btoa
andatob
are deprecated in Node.js, so this PR inspectsglobalThis
for aBuffer
. If it's present (polyfill or Node),then it will use the module. Otherwise it is assumed the environment has
atob
andbtoa
(browser), and will avoid the use ofBuffer
forencoding/decoding uuids.
cc: @pkerpedjiev