Skip to content

Commit 9f8d665

Browse files
committed
fix: Use is-async-supported to check for async await
1 parent 8a35c29 commit 9f8d665

File tree

7 files changed

+18
-12
lines changed

7 files changed

+18
-12
lines changed

packages/adapter-utils/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
const supportsAsyncAwait =
2-
parseInt(process.version.slice(1).split('.').join('').substring(0, 3)) > 760;
1+
const isAsyncSupported = require('is-async-supported');
32

4-
const path = supportsAsyncAwait ? './src/index' : './dist/index';
3+
const path = isAsyncSupported() ? './src/index' : './dist/index';
54

65
module.exports = require(path);

packages/adapter-utils/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"node": ">=6.0.0"
2323
},
2424
"dependencies": {
25-
"escape-regex": "^1.0.7"
25+
"escape-regex": "^1.0.7",
26+
"is-async-supported": "^1.2.0"
2627
},
2728
"devDependencies": {
2829
"babel-cli": "^6.24.1",
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
const supportsAsyncAwait =
2-
parseInt(process.version.slice(1).split('.').join('').substring(0, 3)) > 760;
1+
const isAsyncSupported = require('is-async-supported');
32

4-
const path = supportsAsyncAwait ? './src/unit-tests' : './dist/unit-tests';
3+
const path = isAsyncSupported() ? './src/unit-tests' : './dist/unit-tests';
54

65
module.exports = require(path);

packages/adapter-utils/yarn.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,10 @@ invariant@^2.2.0:
611611
dependencies:
612612
loose-envify "^1.0.0"
613613

614+
is-async-supported@^1.2.0:
615+
version "1.2.0"
616+
resolved "https://registry.yarnpkg.com/is-async-supported/-/is-async-supported-1.2.0.tgz#20d58ac4d6707eb1cb3712dd38480c0536f27c07"
617+
614618
is-binary-path@^1.0.0:
615619
version "1.0.1"
616620
resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898"
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#!/usr/bin/env node
2-
32
const { exec } = require('shelljs');
3+
const isAsyncSupported = require('is-async-supported');
44
const updateNotifier = require('update-notifier');
5+
56
const pkg = require('./package.json');
67

78
updateNotifier({ pkg }).notify();
89

9-
const supportsAsyncAwait =
10-
parseInt(process.version.slice(1).split('.').join('').substring(0, 3)) > 760;
11-
12-
const microAnalytics = supportsAsyncAwait ? './src/index' : './dist/index';
10+
const microAnalytics = isAsyncSupported() ? './src/index' : './dist/index';
1311

1412
require(microAnalytics);

packages/micro-analytics-cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"dependencies": {
3131
"args": "^2.3.0",
3232
"flat-file-db": "^1.0.0",
33+
"is-async-supported": "^1.2.0",
3334
"micro": "6.1.0",
3435
"micro-analytics-adapter-flat-file-db": "^1.3.0",
3536
"promise": "^7.1.1",

packages/micro-analytics-cli/yarn.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,10 @@ is-arrayish@^0.2.1:
898898
version "0.2.1"
899899
resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"
900900

901+
is-async-supported@^1.2.0:
902+
version "1.2.0"
903+
resolved "https://registry.yarnpkg.com/is-async-supported/-/is-async-supported-1.2.0.tgz#20d58ac4d6707eb1cb3712dd38480c0536f27c07"
904+
901905
is-binary-path@^1.0.0:
902906
version "1.0.1"
903907
resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898"

0 commit comments

Comments
 (0)