Skip to content

Commit

Permalink
moving localtunnel to peer dependency (#2059)
Browse files Browse the repository at this point in the history
* moving localtunnel to peer dependency

* v3.0.0-alpha.0

* optiona

* v3.0.0-alpha.1

* remove package

* v3.0.0-alpha.2

* v3.0.0

---------

Co-authored-by: Shane Osbourne <sosbourne@duckduckgo.com>
  • Loading branch information
shakyShane and Shane Osbourne committed Dec 27, 2023
1 parent f267cb6 commit 6030e87
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 264 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"packages": [
"packages/*"
],
"version": "2.29.3"
"version": "3.0.0"
}
4 changes: 2 additions & 2 deletions packages/browser-sync-client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/browser-sync-client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "browser-sync-client",
"description": "Client-side scripts for BrowserSync",
"version": "2.29.3",
"version": "3.0.0",
"homepage": "https://github.com/shakyshane/browser-sync-client",
"author": "Shane Osbourne <shane.osbourne8@gmail.com>",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions packages/browser-sync-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/browser-sync-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "browser-sync-ui",
"description": "User Interface for BrowserSync",
"version": "2.29.3",
"version": "3.0.0",
"homepage": "http://www.browsersync.io/",
"author": {
"name": "Shane Osbourne"
Expand Down
3 changes: 3 additions & 0 deletions packages/browser-sync/lib/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ module.exports = {
var localTunnel = require("./tunnel");
localTunnel(bs, function(err, tunnel) {
if (err) {
if (err.code === "MODULE_NOT_FOUND") {
return utils.fail(true, err, bs.cb);
}
return done(err);
} else {
return done(null, {
Expand Down
13 changes: 12 additions & 1 deletion packages/browser-sync/lib/tunnel.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ var utils = require("util");
* @param {Function} cb
*/
module.exports = function(bs, cb) {
var localtunnel;
try {
localtunnel = require("localtunnel");
} catch (e) {
if (e.code === "MODULE_NOT_FOUND") {
var error = new Error("Could not find package `localtunnel`. From Browsersync version 3.0 you'll need to install this manually.");
error.code = e.code;
return cb(error);
}
return cb(e);
}
var opts = {};
var options = bs.options;
var port = options.get("port");
Expand All @@ -22,7 +33,7 @@ module.exports = function(bs, cb) {
utils.inspect(opts)
);

require("localtunnel")(port, opts, function(err, tunnel) {
localtunnel(port, opts, function(err, tunnel) {
if (err) {
return cb(err);
}
Expand Down

0 comments on commit 6030e87

Please sign in to comment.