Skip to content

Commit 1addcd2

Browse files
committed
Merge branch 'develop', prepare 0.17.1
2 parents 3250c5a + 0e093c9 commit 1addcd2

File tree

7 files changed

+240
-127
lines changed

7 files changed

+240
-127
lines changed

.eslintrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
"bracketSpacing": false,
3535
"printWidth": 120
3636
}],
37-
"no-console": "off"
37+
"no-console": "off",
38+
"no-unused-expressions": "off",
39+
"no-param-reassign": "off",
40+
"no-return-assign": "off"
3841
}
3942
}

docs/Links.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Articles, video and related links
2+
3+
### Articles
4+
5+
- [Introducing Exoframe (beta) — self-hosted alternative to Now.sh](https://hackernoon.com/introducing-exoframe-beta-self-hosted-alternative-to-now-sh-80643f96b84b)
6+
- [Continuous deployment for your Node.js projects in 10 minutes with Exoframe](https://hackernoon.com/continuous-deployment-for-your-node-js-projects-in-10-minutes-with-exoframe-bdf48340c1be)
7+
- [Simplifying Docker management with Exoframe](https://hackernoon.com/simplifying-docker-management-with-exoframe-9275e92c7406)
8+
9+
### Videos
10+
11+
- [Introducing Exoframe - self-hosted Now.sh alternative](https://www.youtube.com/watch?v=VZnYKIoh5oA)
12+
- [Continuous Deployment for Node.js projects in 10 mins using Exoframe](https://www.youtube.com/watch?v=AEwLt5hmKYo)

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
* [Basics](Basics.md)
44
* [FAQ](FAQ.md)
5+
* [Articles, video and related links](Links.md)
56
* [Change Log](../CHANGELOG.md)

package.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,24 @@
1414
"coveralls": "cat ./coverage/lcov.info | coveralls"
1515
},
1616
"dependencies": {
17-
"chalk": "^2.0.1",
17+
"chalk": "^2.1.0",
1818
"cli-table": "^0.3.1",
1919
"got": "^7.1.0",
20-
"ignore": "^3.3.0",
21-
"inquirer": "^3.2.1",
20+
"ignore": "^3.3.3",
21+
"inquirer": "^3.2.2",
2222
"js-yaml": "^3.9.1",
23-
"jsonwebtoken": "^7.4.1",
23+
"jsonwebtoken": "^7.4.3",
2424
"lodash": "^4.17.4",
25-
"open": "0.0.5",
26-
"ora": "^1.2.0",
27-
"tar-fs": "^1.15.2",
28-
"yargs": "^8.0.1"
25+
"opn": "^5.1.0",
26+
"ora": "^1.3.0",
27+
"tar-fs": "^1.15.3",
28+
"yargs": "^8.0.2"
2929
},
3030
"devDependencies": {
3131
"coveralls": "^2.13.1",
3232
"nock": "^9.0.14",
33-
"sinon": "^2.4.1",
34-
"tap": "^10.7.1"
33+
"proxyquire": "^1.8.0",
34+
"sinon": "^3.2.1",
35+
"tap": "^10.7.2"
3536
}
3637
}

src/commands/deploy.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const path = require('path');
77
const fs = require('fs');
88
const ora = require('ora');
99
const Table = require('cli-table');
10-
const open = require('open');
10+
const opn = require('opn');
1111

1212
// my modules
1313
const {userConfig, isLoggedIn, logout} = require('../config');
@@ -50,8 +50,8 @@ exports.builder = {
5050
},
5151
open: {
5252
alias: 'o',
53-
description: 'Open deployed project in browser after upload'
54-
}
53+
description: 'Open deployed project in browser after upload',
54+
},
5555
};
5656
exports.handler = async (args = {}) => {
5757
const deployToken = args.token;
@@ -138,13 +138,15 @@ exports.handler = async (args = {}) => {
138138
const formattedServices = formatServices(res.deployments);
139139
formattedServices.forEach(({name, domain, host}) => {
140140
resultTable.push([name, domain, host]);
141-
if(args.open){
142-
open('http://' + domain);
143-
}
144141
});
145142

146143
// draw table
147144
console.log(resultTable.toString());
145+
146+
// open in browser
147+
if (args.open && formattedServices[0].domain && formattedServices[0].domain !== 'not set') {
148+
opn(`http://${formattedServices[0].domain.split(',')[0].trim()}`);
149+
}
148150
} catch (e) {
149151
spinner.fail('Upload failed!');
150152
// if authorization is expired/broken/etc

test/deploy.js

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ const fs = require('fs');
44
const path = require('path');
55
const nock = require('nock');
66
const sinon = require('sinon');
7+
const proxyquire = require('proxyquire');
78

89
// our packages
9-
const {handler: deploy} = require('../src/commands/deploy');
1010
const {userConfig, updateConfig} = require('../src/config');
1111

12+
// opn stub
13+
const opnStub = sinon.spy();
14+
15+
// require deploy with stub for opn
16+
const {handler: deploy} = proxyquire('../src/commands/deploy', {opn: opnStub});
17+
1218
module.exports = () => {
1319
const folder = 'test_html_project';
1420
const folderPath = path.join('test', 'fixtures', folder);
@@ -178,6 +184,41 @@ module.exports = () => {
178184
});
179185
});
180186

187+
// test
188+
tap.test('Should open webpage after deploy', t => {
189+
// spy on console
190+
const consoleSpy = sinon.spy(console, 'log');
191+
192+
// handle correct request
193+
const deployServer = nock('http://localhost:8080').post('/deploy').reply((uri, requestBody, cb) => {
194+
cb(null, [200, {status: 'success', deployments}]);
195+
});
196+
197+
// execute
198+
deploy({open: true}).then(() => {
199+
// make sure log in was successful
200+
// check that server was called
201+
t.ok(deployServer.isDone());
202+
// make sure opn was called once
203+
t.ok(opnStub.calledOnce);
204+
// first check console output
205+
t.deepEqual(
206+
consoleSpy.args,
207+
[
208+
['Deploying current project to endpoint:', 'http://localhost:8080'],
209+
['Your project is now deployed as:\n'],
210+
[' ID URL Hostname \n test localhost test '],
211+
],
212+
'Correct log output'
213+
);
214+
// restore console
215+
console.log.restore();
216+
// tear down nock
217+
deployServer.done();
218+
t.end();
219+
});
220+
});
221+
181222
// test
182223
tap.test('Should not deploy with broken config', t => {
183224
// spy on console

0 commit comments

Comments
 (0)