-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
34 lines (29 loc) · 977 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* eslint-env node */
'use strict';
var ncp = require('copy-paste');
var ngrok = require('ngrok');
var Promise = require('rsvp').Promise;
var ServeCommand = require('ember-cli/lib/commands/serve');
module.exports = {
name: 'ember-share',
includedCommands: function() {
return {
share: ServeCommand.extend({
name: 'share',
description: 'Share your local Ember apps with the world using ngrok.',
run: function(commandOptions, rawArgs) {
var port = commandOptions.port;
var self = this;
var ngrokServer = new Promise(function(resolve, reject) {
ngrok.connect(port, function(err, url) {
ncp.copy(url);
self.ui.writeLine('Your sharable URL is ' + url + ' and has been copied to your clipboard.');
resolve();
});
});
return Promise.all([ngrokServer, this._super.run.apply(this, arguments)]);
}
})
}
}
};